From cfa84d7af30f98ad4d6524f6b2d87166ed15793e Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 5 Jul 2017 13:14:20 +0530 Subject: [PATCH] [text-editor] dont keep refreshing value --- frappe/public/js/frappe/form/control.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/frappe/public/js/frappe/form/control.js b/frappe/public/js/frappe/form/control.js index 677842b4c2..e0860a7299 100755 --- a/frappe/public/js/frappe/form/control.js +++ b/frappe/public/js/frappe/form/control.js @@ -1884,12 +1884,16 @@ frappe.ui.form.ControlTextEditor = frappe.ui.form.ControlCode.extend({ }, set_in_editor: function(value) { // set value after user has stopped editing - let interval = setInterval(() => { - if(moment() - moment(this._last_change_on) > 3000) { - this.editor.summernote('code', value); - clearInterval(interval); - } - }, 1000); + if(!this._last_change_on || (moment() - moment(this._last_change_on) > 3000)) { + this.editor.summernote('code', value); + } else { + var interval = setInterval(() => { + if(moment() - moment(this._last_change_on) > 3000) { + this.editor.summernote('code', value); + clearInterval(interval); + } + }, 1000); + } }, set_focus: function() { return this.editor.summernote('focus');