From 327fed30c810e5ec944fb3bab2f33abde45b03fd Mon Sep 17 00:00:00 2001 From: Jermolene Date: Tue, 23 Jan 2018 16:22:35 +0000 Subject: [PATCH] Mitigate problem with microscropic editor in zoomin view See #3098 --- core/modules/editor/engines/framed.js | 9 +++++++++ core/modules/utils/dom/dom.js | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/core/modules/editor/engines/framed.js b/core/modules/editor/engines/framed.js index d4328c509..d3694320f 100644 --- a/core/modules/editor/engines/framed.js +++ b/core/modules/editor/engines/framed.js @@ -74,6 +74,7 @@ function FramedEngine(options) { this.copyStyles(); // Add event listeners $tw.utils.addEventListeners(this.domNode,[ + {name: "click",handlerObject: this,handlerMethod: "handleClickEvent"}, {name: "input",handlerObject: this,handlerMethod: "handleInputEvent"}, {name: "keydown",handlerObject: this.widget,handlerMethod: "handleKeydownEvent"} ]); @@ -147,6 +148,14 @@ FramedEngine.prototype.focus = function() { } }; +/* +Handle a click +*/ +FramedEngine.prototype.handleClickEvent = function(event) { + this.fixHeight(); + return true; +}; + /* Handle a dom "input" event which occurs when the text has changed */ diff --git a/core/modules/utils/dom/dom.js b/core/modules/utils/dom/dom.js index c21b5638b..a418197af 100644 --- a/core/modules/utils/dom/dom.js +++ b/core/modules/utils/dom/dom.js @@ -99,7 +99,7 @@ exports.resizeTextAreaToFit = function(domNode,minHeight) { scrollTop = container.scrollTop; // Measure the specified minimum height domNode.style.height = minHeight; - var measuredHeight = domNode.offsetHeight; + var measuredHeight = domNode.offsetHeight || parseInt(minHeight,10); // Set its height to auto so that it snaps to the correct height domNode.style.height = "auto"; // Calculate the revised height