Fix bug with className

pull/75/head
Wes Cossick 9 years ago
parent 5790ab6c54
commit 07479c7f02

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…
Cancel
Save