From a65ec87c53fceee69dac87d1051b46ebb7aaaf75 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Sat, 7 Mar 2020 14:00:46 +0000 Subject: [PATCH] Fix test for needing to update text editor DOM Checking the active element is clumsy, and interferes with debugging. Checking the content is clearer, and avoids the Firefox bug. Fixes #4472 --- core/modules/editor/engines/framed.js | 2 +- core/modules/editor/engines/simple.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/modules/editor/engines/framed.js b/core/modules/editor/engines/framed.js index 6e7da24da..d792309ed 100644 --- a/core/modules/editor/engines/framed.js +++ b/core/modules/editor/engines/framed.js @@ -106,7 +106,7 @@ Set the text of the engine if it doesn't currently have focus */ FramedEngine.prototype.setText = function(text,type) { if(!this.domNode.isTiddlyWikiFakeDom) { - if(this.domNode.ownerDocument.activeElement !== this.domNode) { + if(this.domNode.value !== text) { this.domNode.value = text; } // Fix the height if needed diff --git a/core/modules/editor/engines/simple.js b/core/modules/editor/engines/simple.js index bb77893d7..b94934810 100644 --- a/core/modules/editor/engines/simple.js +++ b/core/modules/editor/engines/simple.js @@ -67,7 +67,7 @@ Set the text of the engine if it doesn't currently have focus */ SimpleEngine.prototype.setText = function(text,type) { if(!this.domNode.isTiddlyWikiFakeDom) { - if(this.domNode.ownerDocument.activeElement !== this.domNode || text === "") { + if(this.domNode.value !== text) { this.domNode.value = text; } // Fix the height if needed