Fixed selection
authorAlexander Ebert <ebert@woltlab.com>
Wed, 8 Apr 2015 13:01:49 +0000 (15:01 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 8 Apr 2015 13:01:49 +0000 (15:01 +0200)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js

index d92af6f14f0150562af1e35080393def4034ec4d..c65f1e0325849e8f374779d8e584f8fc0b74035a 100644 (file)
@@ -2074,6 +2074,18 @@ RedactorPlugins.wbbcode = function() {
                                // assign a unique id in order to recognize the inserted quote
                                $html = $html.replace(/<blockquote/, '<blockquote id="' + $id + '"');
                                
+                               if (!window.getSelection().rangeCount) {
+                                       this.wutil.restoreSelection();
+                                       
+                                       if (!window.getSelection().rangeCount) {
+                                               this.$editor.focus();
+                                               
+                                               if (!window.getSelection().rangeCount) {
+                                                       this.wutil.selectionEndOfEditor();
+                                               }
+                                       }
+                               }
+                               
                                var $originalRange = window.getSelection().getRangeAt(0).cloneRange();
                                
                                this.wutil.restoreSelection();