From bc7ed5ebc00f4248bc4df2c8f48a7e2834b7a7c2 Mon Sep 17 00:00:00 2001 From: Patrick Kalita Date: Wed, 8 Nov 2023 16:11:44 -0800 Subject: [PATCH] Identify input created by FlatpickrEditor as belonging to HOT --- lib/editors/FlatpickrEditor.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/editors/FlatpickrEditor.js b/lib/editors/FlatpickrEditor.js index 9c1d9f84..6e9ff04f 100644 --- a/lib/editors/FlatpickrEditor.js +++ b/lib/editors/FlatpickrEditor.js @@ -31,10 +31,11 @@ class FlatpickrEditor extends Handsontable.editors.TextEditor { this.TEXTAREA = this.hot.rootDocument.createElement('input'); this.TEXTAREA.className = 'handsontableInput'; + this.TEXTAREA.setAttribute('data-hot-input', true); this.textareaStyle = this.TEXTAREA.style; this.textareaStyle.width = 0; this.textareaStyle.height = 0; - Handsontable.dom.empty(this.TEXTAREA_PARENT); + this.TEXTAREA_PARENT.innerText = ''; this.TEXTAREA_PARENT.appendChild(this.TEXTAREA); this.datePicker = this.hot.rootDocument.createElement('DIV'); @@ -52,10 +53,10 @@ class FlatpickrEditor extends Handsontable.editors.TextEditor { */ const eventManager = new Handsontable.EventManager(this); eventManager.addEventListener(this.datePicker, 'mousedown', (event) => { - Handsontable.dom.stopImmediatePropagation(event); + event.stopPropagation(); }); eventManager.addEventListener(this.datePicker, 'keydown', (event) => { - Handsontable.dom.stopImmediatePropagation(event); + event.stopPropagation(); }); eventManager.addEventListener(this.TEXTAREA, 'keydown', (event) => { if (event.keyCode === Handsontable.helper.KEY_CODES.ENTER) { @@ -112,6 +113,7 @@ class FlatpickrEditor extends Handsontable.editors.TextEditor { */ close() { this._opened = false; + this.fp && this.fp.destroy(); this.removeHooksByKey('beforeKeyDown'); super.close(); } @@ -141,8 +143,8 @@ class FlatpickrEditor extends Handsontable.editors.TextEditor { */ showDatepicker(event) { const offset = this.TD.getBoundingClientRect(); - const isMouseDown = this.instance.view.isMouseDown(); - const isMeta = event ? Handsontable.helper.isMetaKey(event.keyCode) : false; + const isMouseDown = this.hot.view.isMouseDown(); + const isMeta = event ? Handsontable.helper.isFunctionKey(event.keyCode) : false; const defaultConfig = this.getFlatpickrConfig(); const cellConfig =