Create preview of CodeMirror
-
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 thanwp.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?
- The topic ‘Create preview of CodeMirror’ is closed to new replies.