Improved bad selection causing issues when inserting HTML
authorAlexander Ebert <ebert@woltlab.com>
Thu, 27 Nov 2014 15:59:16 +0000 (16:59 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 27 Nov 2014 15:59:16 +0000 (16:59 +0100)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js
wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js

index c2d4e601757a40cdf3af2b6595d35005d2540e99..2528d3855dd105bc3859bfbfdfeb116b1315d5cf 100644 (file)
@@ -1501,6 +1501,8 @@ RedactorPlugins.wbbcode = function() {
                                this.wutil.insertAtCaret($openTag + plainText + $closingTag);
                        }
                        
+                       this.wmonkeypatch.saveSelection();
+                       
                        return $quote;
                },
                
index 35d37ef0e33d3b02764b07c54c783f379e4f47b1..017af9fc2bfe3b6041a3fcda8cee902b91147de6 100644 (file)
@@ -707,7 +707,7 @@ RedactorPlugins.wutil = function() {
                _setCaret: function(element, setBefore) {
                        var $node = $(this.opts.emptyHtml);
                        $node[(setBefore ? 'insertBefore' : 'insertAfter')](element);
-                       this.caret.setStart($node[0]);
+                       this.caret.setEnd($node[0]);
                }
        };
 };