From: Alexander Ebert Date: Mon, 23 Feb 2015 15:35:16 +0000 (+0100) Subject: Improved keyboard navigation for nested quotes X-Git-Tag: 2.1.0~55 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=068cdd4811984b65341859b9df60ece918e18d48;p=GitHub%2FWoltLab%2FWCF.git Improved keyboard navigation for nested quotes --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js index 33ee10cd13..ebc5c2691a 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js @@ -1304,8 +1304,8 @@ RedactorPlugins.wbbcode = function() { } // remove

wrapping a quote or a div - data = data.replace(/

<(blockquote|div)/g, '<$1'); - data = data.replace(/<\/(blockquote|div)><\/p>/g, ''); + data = data.replace(/<(?:div|p)><(blockquote|div)/g, '<$1'); + data = data.replace(/<\/(blockquote|div)><\/(?:div|p)>/g, ''); WCF.System.Event.fireEvent('com.woltlab.wcf.redactor', 'afterConvertToHtml', { data: data }); diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js index 73cbe5f173..8dc8c15867 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js @@ -106,7 +106,7 @@ RedactorPlugins.wmonkeypatch = function() { var $setCaretBeforeOrAfter = (function(element, setBefore) { if (setBefore) { - if (element.previousElementSibling && element.previousElementSibling.tagName === 'P') { + if (element.previousElementSibling && (element.previousElementSibling.tagName === 'P' || element.previousElementSibling.tagName === 'DIV')) { this.caret.setEnd(element.previousElementSibling); } else { @@ -114,7 +114,7 @@ RedactorPlugins.wmonkeypatch = function() { } } else { - if (element.nextElementSibling && element.nextElementSibling.tagName === 'P') { + if (element.nextElementSibling && (element.nextElementSibling.tagName === 'P' || element.nextElementSibling.tagName === 'DIV')) { this.caret.setEnd(element.nextElementSibling); } else { diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js index 26311b6c0e..12db841f99 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js @@ -928,7 +928,14 @@ RedactorPlugins.wutil = function() { * @param boolean setBefore */ _setCaret: function(element, setBefore) { - var $node = $(this.opts.emptyHtml); + var $node; + if ((element[0] || element).parentElement && (element[0] || element).parentElement.tagName === 'BLOCKQUOTE') { + $node = $('

' + this.opts.invisibleSpace + '
'); + } + else { + $node = $('

' + this.opts.invisibleSpace + '

'); + } + $node[(setBefore ? 'insertBefore' : 'insertAfter')](element); this.caret.setEnd($node[0]); },