fix(HTML Editor): Update preview when form changes (#7108)
This commit is contained in:
parent
f544dcafbe
commit
f01130d1da
3 changed files with 9 additions and 1 deletions
|
|
@ -54,7 +54,7 @@ frappe.ui.form.ControlCode = frappe.ui.form.ControlText.extend({
|
|||
},
|
||||
|
||||
set_formatted_input(value) {
|
||||
this.load_lib().then(() => {
|
||||
return this.load_lib().then(() => {
|
||||
if (!this.editor) return;
|
||||
if (!value) value = '';
|
||||
if (value === this.get_input_value()) return;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ frappe.ui.form.ControlHTMLEditor = frappe.ui.form.ControlMarkdownEditor.extend({
|
|||
this._super();
|
||||
},
|
||||
update_preview() {
|
||||
if (!this.markdown_preview) return;
|
||||
let value = this.get_value() || '';
|
||||
value = frappe.dom.remove_script_and_style(value);
|
||||
this.markdown_preview.html(value);
|
||||
|
|
|
|||
|
|
@ -35,5 +35,12 @@ frappe.ui.form.ControlMarkdownEditor = frappe.ui.form.ControlCode.extend({
|
|||
update_preview() {
|
||||
const value = this.get_value() || "";
|
||||
this.markdown_preview.html(frappe.markdown(value));
|
||||
},
|
||||
|
||||
set_formatted_input(value) {
|
||||
this._super(value)
|
||||
.then(() => {
|
||||
this.update_preview();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue