codemirror fails when adding </textarea> tag inside it
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 user开发者_运维百科s 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).
solved by wrapping htmlspecialchars() around the code, before putting it in code mirror!
精彩评论