From 9316946a63d39d5d31156f4abdf32757cbadfa1b Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 29 Aug 2017 13:47:12 +0200 Subject: [PATCH] Fixed formatting of deleted text --- .../WoltLabSuite/Core/Ui/Redactor/Format.js | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Format.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Format.js index 5e8c2bad4d..bdbc0462f1 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Format.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Format.js @@ -377,20 +377,22 @@ define(['Dom/Util'], function(DomUtil) { * @protected */ _getSelectionMarker: function (editorElement, selection) { - var node = selection.anchorNode; - - var tag, tags = ['DEL', 'SUB', 'SUP']; + var hasNode, node, tag, tags = ['DEL', 'SUB', 'SUP']; for (var i = 0, length = tags.length; i < length; i++) { tag = tags[i]; - var hasNode = false; - while (node && node !== editorElement) { - if (node.nodeName === tag) { - hasNode = true; - break; + node = selection.anchorNode; + hasNode = (elBySel(tag.toLowerCase(), node) !== null); + + if (!hasNode) { + while (node && node !== editorElement) { + if (node.nodeName === tag) { + hasNode = true; + break; + } + + node = node.parentNode; } - - node = node.parentNode; } if (hasNode) { -- 2.20.1