mirror of
https://github.com/sparksuite/simplemde-markdown-editor.git
synced 2024-06-17 05:05:11 +02:00
Fix bugs: preview/fullscreen with multiple editors on same page
This commit is contained in:
parent
91095a93d5
commit
2f6335e640
|
@ -27,7 +27,7 @@
|
|||
wrap.style.height = "auto";
|
||||
wrap.className += " CodeMirror-fullscreen";
|
||||
document.documentElement.style.overflow = "hidden";
|
||||
document.getElementsByClassName("editor-toolbar")[0].className += " fullscreen";
|
||||
wrap.previousSibling.className += " fullscreen";
|
||||
cm.refresh();
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
|||
var info = cm.state.fullScreenRestore;
|
||||
wrap.style.width = info.width; wrap.style.height = info.height;
|
||||
window.scrollTo(info.scrollLeft, info.scrollTop);
|
||||
document.getElementsByClassName("editor-toolbar")[0].className = document.getElementsByClassName("editor-toolbar")[0].className.replace(/\s*fullscreen\b/, "");
|
||||
wrap.previousSibling.className = wrap.previousSibling.className.replace(/\s*fullscreen\b/, "");
|
||||
cm.refresh();
|
||||
}
|
||||
});
|
|
@ -211,11 +211,11 @@ function redo(editor) {
|
|||
* Preview action.
|
||||
*/
|
||||
function togglePreview(editor) {
|
||||
var toolbar_div = document.getElementsByClassName('editor-toolbar')[0];
|
||||
var toolbar = editor.toolbarElements.preview;
|
||||
var parse = editor.constructor.markdown;
|
||||
var cm = editor.codemirror;
|
||||
var wrapper = cm.getWrapperElement();
|
||||
var toolbar_div = wrapper.previousSibling;
|
||||
var toolbar = editor.toolbarElements.preview;
|
||||
var parse = editor.constructor.markdown;
|
||||
var preview = wrapper.lastChild;
|
||||
if (!/editor-preview/.test(preview.className)) {
|
||||
preview = document.createElement('div');
|
||||
|
|
Loading…
Reference in a new issue