mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-07-24 10:24:29 -06:00
Fix bug with className
This commit is contained in:
parent
5790ab6c54
commit
07479c7f02
2
simplemde.min.js
vendored
2
simplemde.min.js
vendored
File diff suppressed because one or more lines are too long
@ -216,6 +216,7 @@ function redo(editor) {
|
||||
* Preview action.
|
||||
*/
|
||||
function togglePreview(editor) {
|
||||
var toolbar_div = document.getElementsByClassName('editor-toolbar')[0];
|
||||
var toolbar = editor.toolbar.preview;
|
||||
var parse = editor.constructor.markdown;
|
||||
var cm = editor.codemirror;
|
||||
@ -231,7 +232,7 @@ function togglePreview(editor) {
|
||||
/\s*editor-preview-active\s*/g, ''
|
||||
);
|
||||
toolbar.className = toolbar.className.replace(/\s*active\s*/g, '');
|
||||
editor.toolbar.className = editor.toolbar.className.replace(/\s*disabled-for-preview\s*/g, '');
|
||||
toolbar_div.className = toolbar_div.className.replace(/\s*disabled-for-preview\s*/g, '');
|
||||
} else {
|
||||
/* When the preview button is clicked for the first time,
|
||||
* give some time for the transition from editor.css to fire and the view to slide from right to left,
|
||||
@ -241,7 +242,7 @@ function togglePreview(editor) {
|
||||
preview.className += ' editor-preview-active'
|
||||
}, 1);
|
||||
toolbar.className += ' active';
|
||||
editor.toolbar.className += ' disabled-for-preview';
|
||||
toolbar_div.className += ' disabled-for-preview';
|
||||
}
|
||||
var text = cm.getValue();
|
||||
preview.innerHTML = parse(text);
|
||||
|
Loading…
x
Reference in New Issue
Block a user