I'm using codemirror http://marijn.haverbeke.nl/codemirror/ to let users create their own web templates inside a web application.
Codemirror works great, except for the time that users have put a tag inside their source code. When I load that up inside code mirror, it breaks everything in the source code that follows after because it thinks my codemirror text area is closed.
I'm using the following way to launch codemirror:
CodeMirror.fromTextArea('code')
It works great on my existing textarea "code" except when users add inside their templates (in the codemirror textarea).
If you don't want to kill the CodeMirror instance, just change the entire document holding the text, data on markers etc. This can be done by calling cm. swapDoc(doc: CodeMirror. Doc) .
solved by wrapping htmlspecialchars() around the code, before putting it in code mirror!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With