Search code examples
javascriptcopycodemirror

CodeMirror copy preserving style


How to copy javascript code from CodeMirror preserving style. If I copy and paste code from CodeMirror editor my coloring and style is dropped. Content is pasted as text/plain. Is there a way to save text formatting and style from editor?


Solution

  • Content is pasted as text/plain

    It seems like this the normal behavior. However to copy from CodeMirror "preserving the style", you could use the runmode addon according to this answer.

    A demo could be found here: http://codemirror.net/demo/runmode.html