mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Fixing issue 989 (#997)
* Fixing issue 989 Signed-off-by: Moshe Wajnberg <wajnberg@il.ibm.com> * Fixing the getRangeAt problem on Chrome Signed-off-by: Moshe Wajnberg <wajnberg@il.ibm.com> * Fixing the getRangeAt problem on Chrome Signed-off-by: Moshe Wajnberg <wajnberg@il.ibm.com>
This commit is contained in:
@@ -1237,11 +1237,12 @@ RED.text.format = (function() {
|
||||
|
||||
function displayWithStructure(element) {
|
||||
var txt = element.textContent || "";
|
||||
if (txt.length === 0) {
|
||||
var selection = document.getSelection();
|
||||
if (txt.length === 0 || !selection || selection.rangeCount <= 0) {
|
||||
element.dispatchEvent(event);
|
||||
return;
|
||||
}
|
||||
var selection = document.getSelection();
|
||||
|
||||
var range = selection.getRangeAt(0);
|
||||
var tempRange = range.cloneRange(), startNode, startOffset;
|
||||
startNode = range.startContainer;
|
||||
|
Reference in New Issue
Block a user