Fixed inserting successive block elements
authorAlexander Ebert <ebert@woltlab.com>
Mon, 23 May 2016 15:03:10 +0000 (17:03 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 23 May 2016 16:33:49 +0000 (18:33 +0200)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js

index d41694bb41a95be8f6a4b1f0b5030fc3a87ffcb3..8c61a5169e590e478e3335382cfa5e3646f1a2c0 100644 (file)
@@ -757,7 +757,11 @@ RedactorPlugins.wutil = function() {
                                }
                                else {
                                        // walk tree up until we find a direct children of the editor and place the caret afterwards
-                                       var $insertAfter = $($startContainer).parentsUntil(this.$editor[0]).last();
+                                       var $insertAfter = $startContainer;
+                                       if ($insertAfter !== this.$editor[0]) {
+                                               $startContainer = $($startContainer).parentsUntil(this.$editor[0]).last();
+                                       }
+                                       
                                        if ($insertAfter[0] === document.body.parentElement) {
                                                // work-around if selection never has been within the editor before
                                                this.wutil.selectionEndOfEditor();