Spacer paragraph between quotes and adjacent blocks
authorAlexander Ebert <ebert@woltlab.com>
Fri, 27 Apr 2018 09:32:39 +0000 (11:32 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 27 Apr 2018 09:32:39 +0000 (11:32 +0200)
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Quote.js

index 6cfa01315e4b15e75287afb103cbb21ba9a0bf78..cabfee60145f4eb6421a713caf1f468dcf898f5d 100644 (file)
@@ -115,6 +115,14 @@ define(['Core', 'EventHandler', 'EventKey', 'Language', 'StringUtil', 'Dom/Util'
                                block.parentNode.removeChild(block);
                        }
                        
+                       // avoid adjacent blocks that are not paragraphs
+                       var sibling = quote.previousElementSibling;
+                       if (sibling && sibling.nodeName !== 'P') {
+                               sibling = elCreate('p');
+                               sibling.textContent = '\u200B';
+                               quote.parentNode.insertBefore(sibling, quote);
+                       }
+                       
                        this._editor.WoltLabCaret.paragraphAfterBlock(quote);
                        
                        this._editor.buffer.set();