2
0
mirror of https://github.com/Ionaru/easy-markdown-editor synced 2025-09-24 16:40:55 -06:00

Merge a31e56d42113c21bb5c6ac42dbf136f175613806 into 4d065c361e685a8b896741aa89dbe109b5338500

This commit is contained in:
johannes karoff 2022-06-22 20:46:54 +02:00 committed by GitHub
commit 91418bad1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -995,7 +995,7 @@ function toggleSideBySide(editor) {
var sideBySideRenderingFunction = function () {
var newValue = editor.options.previewRender(editor.value(), preview);
if (newValue != null) {
preview.innerHTML = newValue;
editor.options.setPreviewRender(preview, newValue);
}
};
@ -1006,7 +1006,7 @@ function toggleSideBySide(editor) {
if (useSideBySideListener) {
var newValue = editor.options.previewRender(editor.value(), preview);
if (newValue != null) {
preview.innerHTML = newValue;
editor.options.setPreviewRender(preview, newValue);
}
cm.on('update', cm.sideBySideRenderingFunction);
} else {
@ -1072,8 +1072,7 @@ function togglePreview(editor) {
toolbar_div.classList.add('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) {
@ -1830,6 +1829,12 @@ function EasyMDE(options) {
};
}
if (!options.setPreviewRender) {
options.setPreviewRender = function (preview, html) {
preview.innerHTML = html;
};
}
// Set default options for parsing config
options.parsingConfig = extend({
@ -2878,7 +2883,7 @@ EasyMDE.prototype.value = function (val) {
if (this.isPreviewActive()) {
var wrapper = cm.getWrapperElement();
var preview = wrapper.lastChild;
preview.innerHTML = this.options.previewRender(val, preview);
this.options.setPreviewRender(preview, this.options.previewRender(val, preview));
}
return this;
}