• I am using the built-in CodeMirror in a plugin to create an email template. I am using
    var editor = wp.codeEditor.initialize($('#email_body'), cm_settings);
    to initialize the textarea into a CodeMirror window.

    This works great, but I want to create a live preview of any changes. I have tried working with CodeMirror’s default options, (seen here: https://codemirror.net/demo/preview.html) but I can’t seem to make it work.

    Default CodeMirror does this
    var editor = CodeMirror.fromTextArea(document.getElementById('divName'), { mode: 'text/html' });
    rather than wp.codeEditor.initialize....

    I have scoured the web and WP.org looking for solutions, but I don’t see any. Any ideas on how access CodeMirror’s content and populate it into an iframe without saving?

    • This topic was modified 4 years, 9 months ago by mlarson154.
    • This topic was modified 4 years, 9 months ago by mlarson154.
    • This topic was modified 4 years, 9 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Everything else WordPress topic
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Create preview of CodeMirror’ is closed to new replies.