mirror of
https://github.com/Ionaru/easy-markdown-editor
synced 2025-07-18 23:44:29 -06:00
Changed: ignore output of previewRender if it is null
This commit is contained in:
parent
0c31e06928
commit
8295aa6a5a
@ -1124,7 +1124,11 @@ function togglePreview(editor) {
|
|||||||
toolbar_div.className += ' disabled-for-preview';
|
toolbar_div.className += ' disabled-for-preview';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
preview.innerHTML = editor.options.previewRender(editor.value(), preview);
|
|
||||||
|
var preview_result = editor.options.previewRender(editor.value(), preview);
|
||||||
|
if (preview_result !== null) {
|
||||||
|
preview.innerHTML = preview_result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2849,7 +2853,11 @@ 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);
|
var preview_result = this.options.previewRender(val, preview);
|
||||||
|
if (preview_result !== null) {
|
||||||
|
preview.innerHTML = preview_result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
2
types/easymde.d.ts
vendored
2
types/easymde.d.ts
vendored
@ -196,7 +196,7 @@ declare namespace EasyMDE {
|
|||||||
previewClass?: string | ReadonlyArray<string>;
|
previewClass?: string | ReadonlyArray<string>;
|
||||||
previewImagesInEditor?: boolean;
|
previewImagesInEditor?: boolean;
|
||||||
imagesPreviewHandler?: (src: string) => string,
|
imagesPreviewHandler?: (src: string) => string,
|
||||||
previewRender?: (markdownPlaintext: string, previewElement: HTMLElement) => string;
|
previewRender?: (markdownPlaintext: string, previewElement: HTMLElement) => string | null;
|
||||||
promptURLs?: boolean;
|
promptURLs?: boolean;
|
||||||
renderingConfig?: RenderingOptions;
|
renderingConfig?: RenderingOptions;
|
||||||
shortcuts?: Shortcuts;
|
shortcuts?: Shortcuts;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user