From: Vincent Vanwaelscappel Date: Mon, 18 Dec 2023 17:16:39 +0000 (+0100) Subject: wait #6582 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=5f329dfcb31866c1fa49e85847962ca3d7189f0e;p=fluidbook-toolbox.git wait #6582 @1 --- diff --git a/resources/linkeditor/js/linkeditor.form.js b/resources/linkeditor/js/linkeditor.form.js index bc36bee4a..88782a380 100644 --- a/resources/linkeditor/js/linkeditor.form.js +++ b/resources/linkeditor/js/linkeditor.form.js @@ -3,6 +3,7 @@ function LinkeditorForm(linkeditor) { this.loadingFields = {}; this._maskChangeEvent = false; this._maskChangeEventTimeout = null; + this._saveFormDataAfterTextChangeTimeout=null; this.init(); } @@ -64,11 +65,22 @@ LinkeditorForm.prototype = { } }, 250); - $(document).on('change keyup', "#linkeditor-panel-form input,#linkeditor-panel-form select,#linkeditor-panel-form textarea", function () { + $(document).on('change keyup', "#linkeditor-panel-form input,#linkeditor-panel-form select,#linkeditor-panel-form textarea", function (e) { if ($this._maskChangeEvent) { return; } - $this.saveFormDataInLink(); + + let callback = function () { + console.log('Save form data in link after change'); + $this.saveFormDataInLink(); + } + + clearTimeout($this._saveFormDataAfterTextChangeTimeout); + if (e.type === 'change') { + callback(); + } else { + $this._saveFormDataAfterTextChangeTimeout = setTimeout(callback, 500); + } });