Fixed code box viewer selection
authorAlexander Ebert <ebert@woltlab.com>
Mon, 5 Sep 2016 10:19:15 +0000 (12:19 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 5 Sep 2016 13:15:19 +0000 (15:15 +0200)
wcfsetup/install/files/js/WCF.Message.js

index dc489546a41bc2249e7126af3680a226f4027a7c..f4bfa110ab9c9373514e6a86aefeced093fd96f8 100644 (file)
@@ -75,7 +75,14 @@ WCF.Message.BBCode.CodeViewer = Class.extend({
                        this._dialog.wcfDialog('open');
                }
                
-               this._dialog.children('textarea').select();
+               var textarea = this._dialog.children('textarea')[0];
+               var selectAll = function () {
+                       textarea.selectionStart = 0;
+                       textarea.selectionEnd = textarea.value.length;
+               };
+               
+               textarea.addEventListener('mouseup', selectAll);
+               window.setTimeout(selectAll, 10);
        }
 });