Fixed attachment insert on mobile devices
authorAlexander Ebert <ebert@woltlab.com>
Sat, 13 Jul 2013 18:21:40 +0000 (20:21 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 13 Jul 2013 18:21:40 +0000 (20:21 +0200)
wcfsetup/install/files/js/WCF.Attachment.js

index e558047b0a8b905101aa8f79c698a0164055140c..5ca158c249009115a35d86db190670e878cbbe26 100644 (file)
@@ -238,14 +238,14 @@ WCF.Attachment.Upload = WCF.Upload.extend({
                var $attachmentID = $(event.currentTarget).data('objectID');
                var $bbcode = '[attach=' + $attachmentID + '][/attach]';
                
-               var $ckEditor = $('#' + this._wysiwygContainerID).ckeditorGet();
-               if ($ckEditor.mode === 'wysiwyg') {
+               var $ckEditor = ($.browser.mobile) ? null : $('#' + this._wysiwygContainerID).ckeditorGet();
+               if ($ckEditor !== null && $ckEditor.mode === 'wysiwyg') {
                        // in design mode
                        $ckEditor.insertText($bbcode);
                }
                else {
                        // in source mode
-                       var $textarea = $('#' + this._wysiwygContainerID).next('.cke_editor_text').find('textarea');
+                       var $textarea = ($.browser.mobile) ? $('#' + this._wysiwygContainerID) : $('#' + this._wysiwygContainerID).next('.cke_editor_text').find('textarea');
                        var $value = $textarea.val();
                        if ($value.length == 0) {
                                $textarea.val($bbcode);