mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-09-24 16:40:55 -06:00
option for settings previewhtml
This commit is contained in:
parent
531a0e6227
commit
a31e56d421
@ -936,7 +936,7 @@ function toggleSideBySide(editor) {
|
|||||||
var sideBySideRenderingFunction = function () {
|
var sideBySideRenderingFunction = function () {
|
||||||
var newValue = editor.options.previewRender(editor.value(), preview);
|
var newValue = editor.options.previewRender(editor.value(), preview);
|
||||||
if (newValue != null) {
|
if (newValue != null) {
|
||||||
preview.innerHTML = newValue;
|
editor.options.setPreviewRender(preview, newValue);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -947,7 +947,7 @@ function toggleSideBySide(editor) {
|
|||||||
if (useSideBySideListener) {
|
if (useSideBySideListener) {
|
||||||
var newValue = editor.options.previewRender(editor.value(), preview);
|
var newValue = editor.options.previewRender(editor.value(), preview);
|
||||||
if (newValue != null) {
|
if (newValue != null) {
|
||||||
preview.innerHTML = newValue;
|
editor.options.setPreviewRender(preview, newValue);
|
||||||
}
|
}
|
||||||
cm.on('update', cm.sideBySideRenderingFunction);
|
cm.on('update', cm.sideBySideRenderingFunction);
|
||||||
} else {
|
} else {
|
||||||
@ -1014,8 +1014,7 @@ function togglePreview(editor) {
|
|||||||
toolbar_div.className += ' disabled-for-preview';
|
toolbar_div.className += ' disabled-for-preview';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
preview.innerHTML = editor.options.previewRender(editor.value(), preview);
|
editor.options.setPreviewRender(preview, editor.options.previewRender(editor.value(), preview));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function _replaceSelection(cm, active, startEnd, url) {
|
function _replaceSelection(cm, active, startEnd, url) {
|
||||||
@ -1690,6 +1689,12 @@ function EasyMDE(options) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!options.setPreviewRender) {
|
||||||
|
options.setPreviewRender = function (preview, html) {
|
||||||
|
preview.innerHTML = html;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Set default options for parsing config
|
// Set default options for parsing config
|
||||||
options.parsingConfig = extend({
|
options.parsingConfig = extend({
|
||||||
@ -2609,7 +2614,7 @@ EasyMDE.prototype.value = function (val) {
|
|||||||
if (this.isPreviewActive()) {
|
if (this.isPreviewActive()) {
|
||||||
var wrapper = cm.getWrapperElement();
|
var wrapper = cm.getWrapperElement();
|
||||||
var preview = wrapper.lastChild;
|
var preview = wrapper.lastChild;
|
||||||
preview.innerHTML = this.options.previewRender(val, preview);
|
this.options.setPreviewRender(preview, this.options.previewRender(val, preview));
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user