From d01b781283115f32eac345f92e483741918a65a7 Mon Sep 17 00:00:00 2001 From: Simon Huber Date: Sat, 12 Oct 2019 15:08:52 +0200 Subject: [PATCH] Restore previous popup mechanism (no cancelling when focusing inputs) (#4305) * remove cancelpopups from factory.js * remove handleFocusEvent from framed engine * remove cancelPopups from simple engine * Update popup.js --- core/modules/editor/engines/framed.js | 11 ------- core/modules/editor/engines/simple.js | 1 - core/modules/editor/factory.js | 7 ----- core/modules/utils/dom/popup.js | 41 ++++++--------------------- 4 files changed, 8 insertions(+), 52 deletions(-) diff --git a/core/modules/editor/engines/framed.js b/core/modules/editor/engines/framed.js index 7984eff4f..6e7da24da 100644 --- a/core/modules/editor/engines/framed.js +++ b/core/modules/editor/engines/framed.js @@ -79,7 +79,6 @@ function FramedEngine(options) { // Add event listeners $tw.utils.addEventListeners(this.domNode,[ {name: "click",handlerObject: this,handlerMethod: "handleClickEvent"}, - {name: "focus",handlerObject: this,handlerMethod: "handleFocusEvent"}, {name: "input",handlerObject: this,handlerMethod: "handleInputEvent"}, {name: "keydown",handlerObject: this.widget,handlerMethod: "handleKeydownEvent"} ]); @@ -153,16 +152,6 @@ FramedEngine.prototype.focus = function() { this.domNode.select(); } }; - -/* -Handle the focus event -*/ -FramedEngine.prototype.handleFocusEvent = function(event) { - if(this.widget.cancelPopups) { - this.widget.cancelPopups(); - } - return true; -}; /* Handle a click diff --git a/core/modules/editor/engines/simple.js b/core/modules/editor/engines/simple.js index acd4bc3d2..bb77893d7 100644 --- a/core/modules/editor/engines/simple.js +++ b/core/modules/editor/engines/simple.js @@ -122,7 +122,6 @@ SimpleEngine.prototype.handleInputEvent = function(event) { Handle a dom "focus" event */ SimpleEngine.prototype.handleFocusEvent = function(event) { - this.widget.cancelPopups(); if(this.widget.editFocusPopup) { $tw.popup.triggerPopup({ domNode: this.domNode, diff --git a/core/modules/editor/factory.js b/core/modules/editor/factory.js index 82b4484c6..8dfc88037 100644 --- a/core/modules/editor/factory.js +++ b/core/modules/editor/factory.js @@ -248,13 +248,6 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) { } }; - /* - Cancel Popups - */ - EditTextWidget.prototype.cancelPopups = function() { - $tw.popup.cancel(0,this.engine.domNode); - }; - /* Handle a dom "keydown" event, which we'll bubble up to our container for the keyboard widgets benefit */ diff --git a/core/modules/utils/dom/popup.js b/core/modules/utils/dom/popup.js index aa89d705c..4ae1a44cd 100644 --- a/core/modules/utils/dom/popup.js +++ b/core/modules/utils/dom/popup.js @@ -149,46 +149,21 @@ Popup.prototype.show = function(options) { } }; -/* -Detect if a Popup contains an input field that has focus -Returns true or false -*/ -Popup.prototype.detectInputWithinPopup = function(node) { - var withinPopup = false, - currNode = node; - for(var i=0; i