Codemirror in textareas #113
-
Hello, |
Beta Was this translation helpful? Give feedback.
Replies: 10 comments 7 replies
-
tried it some time before but had some issues with CSS. For what purpose do you need it? |
Beta Was this translation helpful? Give feedback.
-
Hello,
You just need for the first one (header.xml), and you can find it here: You can comment the other two lines with instances. Thanks, |
Beta Was this translation helpful? Give feedback.
-
@orazionelson i just pushed an example that either displays and updates the codemirror component. You can check it out in /demo/codemirror-raw.html on dev branch. Certainly not very generic for now but it works. Let me know what you think. |
Beta Was this translation helpful? Give feedback.
-
Hello @JoernT ,
You can see that after editing the textarea:
I solved quite easily the second problem by using 2 lines of code in codemirror trigger:
But I have no idea of how to solve the first problem. Thanks, |
Beta Was this translation helpful? Give feedback.
-
well, yes - that's true. Didn't watch close enough. As the 'setvalue' function of control usually is just for setting a value (as the name implies ;) it's converted to a string. What actually is needed here is a replace of the referenced node. That certainly can be implemented. However i can make no promises that will happen within days as there's much work around here and i have to do this in spare time. Would however be a cool feature to have. |
Beta Was this translation helpful? Give feedback.
-
Hello, |
Beta Was this translation helpful? Give feedback.
-
as a follow-up on this thead... we are currently developing a standalone web component wrapping up codemirror for Fore and others. It will use the latest codemirror 6 and directly pass a node to codemirror. The relevant parts in Fore are already implemented and will be merged soon into dev. The component is already working but still lacks some docs before rollout. I will follow up on this. |
Beta Was this translation helpful? Give feedback.
-
Thank you very much. |
Beta Was this translation helpful? Give feedback.
-
I wonder whether anyone is trying this with Prosemirror. |
Beta Was this translation helpful? Give feedback.
-
to be honest i haven't heard of it before, but yes, it should be possible. However from very quick scanning their docs i can't see immediately where and how. However Fore has been designed to connect to any component as long as it offers an API that lets us connect to the 'in' and 'out' of the component and react to their value changes. For at least 90% of what i have dealt with so far that possible without much effort. However these inline code editors are all quite complex beasts and may be required some work to play nicely. Ideally a library or component you integrate fires an event when their content changes and provides a way to pass in the data as string or DOM Node. Update to this thread: It gets a serialized node as input and returns us nodes again. We are using that in a quite complex page to edit some TEI snippets. |
Beta Was this translation helpful? Give feedback.
@orazionelson i just pushed an example that either displays and updates the codemirror component. You can check it out in /demo/codemirror-raw.html on dev branch.
Certainly not very generic for now but it works. Let me know what you think.