Improved keyboard navigation for nested quotes
authorAlexander Ebert <ebert@woltlab.com>
Mon, 23 Feb 2015 15:35:16 +0000 (16:35 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 23 Feb 2015 15:35:16 +0000 (16:35 +0100)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js
wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js
wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js

index 33ee10cd1381dca46238c18549d8ef5c4beabcb5..ebc5c2691a2fef24c9efd7653d54b73c577ad19d 100644 (file)
@@ -1304,8 +1304,8 @@ RedactorPlugins.wbbcode = function() {
                        }
                        
                        // remove <p> wrapping a quote or a div
-                       data = data.replace(/<p><(blockquote|div)/g, '<$1');
-                       data = data.replace(/<\/(blockquote|div)><\/p>/g, '</$1>');
+                       data = data.replace(/<(?:div|p)><(blockquote|div)/g, '<$1');
+                       data = data.replace(/<\/(blockquote|div)><\/(?:div|p)>/g, '</$1>');
                        
                        WCF.System.Event.fireEvent('com.woltlab.wcf.redactor', 'afterConvertToHtml', { data: data });
                        
index 73cbe5f173c2e9e74030a3162f37bb51c6fd4d91..8dc8c15867695f6474783d07cbb569718370373c 100644 (file)
@@ -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 {
index 26311b6c0e756f86851a1ab83802bcc395d1a033..12db841f99a429592cf2b34420e066b955d7511e 100644 (file)
@@ -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 = $('<div>' + this.opts.invisibleSpace + '</div>');
+                       }
+                       else {
+                               $node = $('<p>' + this.opts.invisibleSpace + '</p>');
+                       }
+                       
                        $node[(setBefore ? 'insertBefore' : 'insertAfter')](element);
                        this.caret.setEnd($node[0]);
                },