mirror of
https://github.com/sparksuite/simplemde-markdown-editor.git
synced 2024-05-18 13:46:38 +02:00
Deactivate toolbar buttons on preview
This commit is contained in:
parent
590dbe5c9a
commit
5790ab6c54
2
simplemde.min.css
vendored
2
simplemde.min.css
vendored
File diff suppressed because one or more lines are too long
6
simplemde.min.js
vendored
6
simplemde.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -231,6 +231,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, '');
|
||||
} 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,
|
||||
|
@ -240,12 +241,16 @@ function togglePreview(editor) {
|
|||
preview.className += ' editor-preview-active'
|
||||
}, 1);
|
||||
toolbar.className += ' active';
|
||||
editor.toolbar.className += ' disabled-for-preview';
|
||||
}
|
||||
var text = cm.getValue();
|
||||
preview.innerHTML = parse(text);
|
||||
}
|
||||
|
||||
function _replaceSelection(cm, active, start, end) {
|
||||
if (/editor-preview-active/.test(cm.getWrapperElement().lastChild.className))
|
||||
return;
|
||||
|
||||
var text;
|
||||
var startPoint = cm.getCursor('start');
|
||||
var endPoint = cm.getCursor('end');
|
||||
|
@ -270,6 +275,9 @@ function _replaceSelection(cm, active, start, end) {
|
|||
|
||||
|
||||
function _toggleLine(cm, name) {
|
||||
if (/editor-preview-active/.test(cm.getWrapperElement().lastChild.className))
|
||||
return;
|
||||
|
||||
var stat = getState(cm);
|
||||
var startPoint = cm.getCursor('start');
|
||||
var endPoint = cm.getCursor('end');
|
||||
|
@ -304,6 +312,9 @@ function _toggleLine(cm, name) {
|
|||
}
|
||||
|
||||
function _toggleBlock(editor, type, start_chars, end_chars) {
|
||||
if (/editor-preview-active/.test(cm.getWrapperElement().lastChild.className))
|
||||
return;
|
||||
|
||||
end_chars = (typeof end_chars === 'undefined') ? start_chars : end_chars;
|
||||
var cm = editor.codemirror;
|
||||
var stat = getState(cm);
|
||||
|
|
|
@ -99,6 +99,11 @@
|
|||
position: absolute;
|
||||
right: 10px
|
||||
}
|
||||
.editor-toolbar.disabled-for-preview a:not(.fa-eye){
|
||||
pointer-events:none;
|
||||
background:#fff;
|
||||
border:none;
|
||||
}
|
||||
.editor-statusbar {
|
||||
padding: 8px 10px;
|
||||
font-size: 12px;
|
||||
|
@ -123,7 +128,7 @@
|
|||
height: 100%;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background: #fff;
|
||||
background: #fafafa;
|
||||
z-index: 9999;
|
||||
overflow: auto;
|
||||
display: none
|
||||
|
|
Loading…
Reference in a new issue