Codemirror does not work when adding a </textarea> tag to it

I am using codemirror http://marijn.haverbeke.nl/codemirror/ so that users can create their own web templates inside a web application.

Codemirror works just fine, except when users put the tag in their source code. When I download this internal code mirror, it interrupts everything in the source code that follows it after it finds that my area of ​​text code is closed.

I use the following method to trigger codemirror:

CodeMirror.fromTextArea ('code')

It works fine on my existing "code" text box, unless users add inside their templates (in the codemirror text box).

Any help is much appreciated!

+4
source share
1 answer

solved by wrapping htmlspecialchars () around the code before putting it in the code mirror!

+4
source

Source: https://habr.com/ru/post/1309530/


All Articles