From: Alexander Ebert Date: Tue, 19 Nov 2013 18:00:05 +0000 (+0100) Subject: Using ckeditorGet() again (ckeditor().editor does not work properly) X-Git-Tag: 2.0.0_RC_2~11 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=dc8c22faf54aed563266e6a0438967ce17c48882;p=GitHub%2FWoltLab%2FWCF.git Using ckeditorGet() again (ckeditor().editor does not work properly) --- diff --git a/wcfsetup/install/files/js/WCF.Attachment.js b/wcfsetup/install/files/js/WCF.Attachment.js index 47b33e03b4..9b05e28629 100644 --- a/wcfsetup/install/files/js/WCF.Attachment.js +++ b/wcfsetup/install/files/js/WCF.Attachment.js @@ -240,7 +240,7 @@ WCF.Attachment.Upload = WCF.Upload.extend({ var $attachmentID = $(event.currentTarget).data('objectID'); var $bbcode = '[attach=' + $attachmentID + '][/attach]'; - var $ckEditor = ($.browser.mobile) ? null : $('#' + this._wysiwygContainerID).ckeditor().editor; + var $ckEditor = ($.browser.mobile) ? null : $('#' + this._wysiwygContainerID).ckeditorGet(); if ($ckEditor !== null && $ckEditor.mode === 'wysiwyg') { // in design mode $ckEditor.insertText($bbcode); diff --git a/wcfsetup/install/files/js/WCF.Attachment.min.js b/wcfsetup/install/files/js/WCF.Attachment.min.js index 91f20f5d87..a469cecb12 100755 --- a/wcfsetup/install/files/js/WCF.Attachment.min.js +++ b/wcfsetup/install/files/js/WCF.Attachment.min.js @@ -1 +1 @@ -WCF.Attachment={};WCF.Attachment.Upload=WCF.Upload.extend({_objectType:"",_objectID:0,_tmpHash:"",_parentObjectID:0,_wysiwygContainerID:"",init:function(c,g,a,h,d,e,f,b){this._super(c,g,"wcf\\data\\attachment\\AttachmentAction",{multiple:true,maxUploads:f});this._objectType=a;this._objectID=h;this._tmpHash=d;this._parentObjectID=e;this._wysiwygContainerID=b;this._buttonSelector.children("p.button").click($.proxy(this._validateLimit,this));this._fileListSelector.find(".jsButtonInsertAttachment").click($.proxy(this._insert,this));WCF.DOMNodeRemovedHandler.addCallback("WCF.Attachment.Upload",$.proxy(this._removeLimitError,this))},_validateLimit:function(){var c=this._buttonSelector.next("small.innerError");var a=this._options.maxUploads-this._fileListSelector.children("li:not(.uploadFailed)").length;var d=(this._fileUpload)?this._fileUpload.prop("files").length:0;if(a<=0||a').insertAfter(this._buttonSelector)}c.html(b);return false}c.remove();return true},_removeLimitError:function(b){var a=$(b.target);if(a.is("li.box48")&&a.parent().wcfIdentify()===this._fileListSelector.wcfIdentify()){this._buttonSelector.next("small.innerError").remove()}},_upload:function(){if(this._validateLimit()){this._super()}if(this._fileUpload){this._removeButton();this._createButton()}},_createUploadMatrix:function(a){this._fileListSelector.children("li.uploadFailed").remove();return this._super(a)},_getParameters:function(){return{objectType:this._objectType,objectID:this._objectID,tmpHash:this._tmpHash,parentObjectID:this._parentObjectID}},_initFile:function(a){var b=$('
  • '+a.name+'

    • ').data("filename",a.name);this._fileListSelector.append(b);this._fileListSelector.show();if(this._buttonSelector.data("maxSize") div").append($(''+WCF.Language.get("wcf.attachment.upload.error.tooLarge")+""));b.addClass("uploadFailed")}return b},_success:function(b,c){for(var i in this._uploadMatrix[b]){var g=this._uploadMatrix[b][i];g.find("progress").remove();var h=g.data("filename");var j=g.data("internalFileID");if(c.returnValues&&c.returnValues.attachments[j]){if(c.returnValues.attachments[j]["tinyURL"]){g.children(".icon-spinner").replaceWith($(''))}else{g.children(".icon-spinner").removeClass("icon-spinner").addClass("icon-paper-clip")}var e=$('');e.text(h).attr("href",c.returnValues.attachments[j]["url"]);if(c.returnValues.attachments[j]["isImage"]!=0){e.addClass("jsImageViewer").attr("title",h)}g.find("p").empty().append(e);g.find("small").append(c.returnValues.attachments[j]["formattedFilesize"]);var f=$('
    • ');g.find("ul").append(f);if(this._wysiwygContainerID){var a=$('
    • ');a.children(".jsButtonInsertAttachment").click($.proxy(this._insert,this));g.find("ul").append(a)}}else{g.children(".icon-spinner").removeClass("icon-spinner").addClass("icon-ban-circle");var d="";if(c.returnValues&&c.returnValues.errors[j]){d=c.returnValues.errors[j]["errorType"]}else{d="uploadFailed"}g.find("div > div").append($(''+WCF.Language.get("wcf.attachment.upload.error."+d)+""));g.addClass("uploadFailed")}g.css("display","block")}WCF.DOMNodeInsertedHandler.execute()},_insert:function(e){var d=$(e.currentTarget).data("objectID");var c="[attach="+d+"][/attach]";var a=($.browser.mobile)?null:$("#"+this._wysiwygContainerID).ckeditor().editor;if(a!==null&&a.mode==="wysiwyg"){a.insertText(c)}else{var g=($.browser.mobile)?$("#"+this._wysiwygContainerID):$("#"+this._wysiwygContainerID).next(".cke_editor_text").find("textarea");var b=g.val();if(b.length==0){g.val(c)}else{var f=g.getCaret();g.val(b.substr(0,f)+c+b.substr(f))}}},_error:function(a){this._fileListSelector.find("li").each(function(b,d){var c=$(d);if(c.children(".icon-spinner").length){c.addClass("uploadFailed").children(".icon-spinner").removeClass("icon-spinner").addClass("icon-ban-circle");c.find("div > div").append($(''+(a.responseJSON&&a.responseJSON.message?a.responseJSON.message:WCF.Language.get("wcf.attachment.upload.error.uploadFailed"))+""))}})}}); \ No newline at end of file +WCF.Attachment={};WCF.Attachment.Upload=WCF.Upload.extend({_objectType:"",_objectID:0,_tmpHash:"",_parentObjectID:0,_wysiwygContainerID:"",init:function(c,g,a,h,d,e,f,b){this._super(c,g,"wcf\\data\\attachment\\AttachmentAction",{multiple:true,maxUploads:f});this._objectType=a;this._objectID=h;this._tmpHash=d;this._parentObjectID=e;this._wysiwygContainerID=b;this._buttonSelector.children("p.button").click($.proxy(this._validateLimit,this));this._fileListSelector.find(".jsButtonInsertAttachment").click($.proxy(this._insert,this));WCF.DOMNodeRemovedHandler.addCallback("WCF.Attachment.Upload",$.proxy(this._removeLimitError,this))},_validateLimit:function(){var c=this._buttonSelector.next("small.innerError");var a=this._options.maxUploads-this._fileListSelector.children("li:not(.uploadFailed)").length;var d=(this._fileUpload)?this._fileUpload.prop("files").length:0;if(a<=0||a').insertAfter(this._buttonSelector)}c.html(b);return false}c.remove();return true},_removeLimitError:function(b){var a=$(b.target);if(a.is("li.box48")&&a.parent().wcfIdentify()===this._fileListSelector.wcfIdentify()){this._buttonSelector.next("small.innerError").remove()}},_upload:function(){if(this._validateLimit()){this._super()}if(this._fileUpload){this._removeButton();this._createButton()}},_createUploadMatrix:function(a){this._fileListSelector.children("li.uploadFailed").remove();return this._super(a)},_getParameters:function(){return{objectType:this._objectType,objectID:this._objectID,tmpHash:this._tmpHash,parentObjectID:this._parentObjectID}},_initFile:function(a){var b=$('
    • '+a.name+'

      • ').data("filename",a.name);this._fileListSelector.append(b);this._fileListSelector.show();if(this._buttonSelector.data("maxSize") div").append($(''+WCF.Language.get("wcf.attachment.upload.error.tooLarge")+""));b.addClass("uploadFailed")}return b},_success:function(b,c){for(var i in this._uploadMatrix[b]){var g=this._uploadMatrix[b][i];g.find("progress").remove();var h=g.data("filename");var j=g.data("internalFileID");if(c.returnValues&&c.returnValues.attachments[j]){if(c.returnValues.attachments[j]["tinyURL"]){g.children(".icon-spinner").replaceWith($(''))}else{g.children(".icon-spinner").removeClass("icon-spinner").addClass("icon-paper-clip")}var e=$('');e.text(h).attr("href",c.returnValues.attachments[j]["url"]);if(c.returnValues.attachments[j]["isImage"]!=0){e.addClass("jsImageViewer").attr("title",h)}g.find("p").empty().append(e);g.find("small").append(c.returnValues.attachments[j]["formattedFilesize"]);var f=$('
      • ');g.find("ul").append(f);if(this._wysiwygContainerID){var a=$('
      • ');a.children(".jsButtonInsertAttachment").click($.proxy(this._insert,this));g.find("ul").append(a)}}else{g.children(".icon-spinner").removeClass("icon-spinner").addClass("icon-ban-circle");var d="";if(c.returnValues&&c.returnValues.errors[j]){d=c.returnValues.errors[j]["errorType"]}else{d="uploadFailed"}g.find("div > div").append($(''+WCF.Language.get("wcf.attachment.upload.error."+d)+""));g.addClass("uploadFailed")}g.css("display","block")}WCF.DOMNodeInsertedHandler.execute()},_insert:function(e){var d=$(e.currentTarget).data("objectID");var c="[attach="+d+"][/attach]";var a=($.browser.mobile)?null:$("#"+this._wysiwygContainerID).ckeditorGet();if(a!==null&&a.mode==="wysiwyg"){a.insertText(c)}else{var g=($.browser.mobile)?$("#"+this._wysiwygContainerID):$("#"+this._wysiwygContainerID).next(".cke_editor_text").find("textarea");var b=g.val();if(b.length==0){g.val(c)}else{var f=g.getCaret();g.val(b.substr(0,f)+c+b.substr(f))}}},_error:function(a){this._fileListSelector.find("li").each(function(b,d){var c=$(d);if(c.children(".icon-spinner").length){c.addClass("uploadFailed").children(".icon-spinner").removeClass("icon-spinner").addClass("icon-ban-circle");c.find("div > div").append($(''+(a.responseJSON&&a.responseJSON.message?a.responseJSON.message:WCF.Language.get("wcf.attachment.upload.error.uploadFailed"))+""))}})}}); \ No newline at end of file diff --git a/wcfsetup/install/files/js/WCF.Message.js b/wcfsetup/install/files/js/WCF.Message.js index ce393fde9b..2464909418 100644 --- a/wcfsetup/install/files/js/WCF.Message.js +++ b/wcfsetup/install/files/js/WCF.Message.js @@ -234,7 +234,7 @@ WCF.Message.Preview = Class.extend({ return this._messageField.val(); } else if (this._messageField.data('ckeditorInstance')) { - var $ckEditor = this._messageField.ckeditor().editor; + var $ckEditor = this._messageField.ckeditorGet(); return $ckEditor.getData(); } @@ -546,7 +546,7 @@ WCF.Message.Smilies = Class.extend({ var $smileyCode = $target.data('smileyCode'); // get ckEditor - var $ckEditor = this._ckEditor.ckeditor().editor; + var $ckEditor = this._ckEditor.ckeditorGet(); // get smiley path var $smileyPath = $target.find('img').attr('src'); @@ -694,7 +694,7 @@ WCF.Message.QuickReply = Class.extend({ $empty = (!this._messageField.val().length); } else { - $empty = (!$.trim(this._messageField.ckeditor().editor.getData()).length); + $empty = (!$.trim(this._messageField.ckeditorGet().getData()).length); } if ($empty) { @@ -709,7 +709,7 @@ WCF.Message.QuickReply = Class.extend({ this._messageField.focus(); } else { - this._messageField.ckeditor().editor.ui.editor.focus(); + this._messageField.ckeditorGet().ui.editor.focus(); } }, this), 250); } @@ -744,7 +744,7 @@ WCF.Message.QuickReply = Class.extend({ this._messageField.val(data.returnValues.template); } else { - this._messageField.ckeditor().editor.insertText(data.returnValues.template); + this._messageField.ckeditorGet().insertText(data.returnValues.template); } }, @@ -762,7 +762,7 @@ WCF.Message.QuickReply = Class.extend({ $message = $.trim(this._messageField.val()); } else { - var $ckEditor = this._messageField.ckeditor().editor; + var $ckEditor = this._messageField.ckeditorGet(); $message = $.trim($ckEditor.getData()); } @@ -830,7 +830,7 @@ WCF.Message.QuickReply = Class.extend({ } else { // revert CKEditor - this._messageField.ckeditor().editor.setData(''); + this._messageField.ckeditorGet().setData(''); } }, @@ -874,7 +874,7 @@ WCF.Message.QuickReply = Class.extend({ $message = this._messageField.val(); } else { - var $ckEditor = this._messageField.ckeditor().editor; + var $ckEditor = this._messageField.ckeditorGet(); $message = $ckEditor.getData(); } @@ -932,7 +932,7 @@ WCF.Message.QuickReply = Class.extend({ } else { // remove CKEditor contents - this._messageField.ckeditor().editor.setData(''); + this._messageField.ckeditorGet().setData(''); } // hide quick reply and revert it @@ -1251,7 +1251,7 @@ WCF.Message.InlineEditor = Class.extend({ // remove ckEditor try { - var $ckEditor = $('#' + this._messageEditorIDPrefix + $container.data('objectID')).ckeditor().editor; + var $ckEditor = $('#' + this._messageEditorIDPrefix + $container.data('objectID')).ckeditorGet(); $ckEditor.destroy(); } catch (e) { @@ -1329,7 +1329,7 @@ WCF.Message.InlineEditor = Class.extend({ pe.stop(); var $ckEditor = $('#' + this._messageEditorIDPrefix + this._container[this._activeElementID].data('objectID')); - $ckEditor.ckeditor().editor.ui.editor.focus(); + $ckEditor.ckeditorGet().ui.editor.focus(); if (this._quoteManager) { this._quoteManager.setAlternativeCKEditor($ckEditor); @@ -1365,7 +1365,7 @@ WCF.Message.InlineEditor = Class.extend({ $message = $('#' + this._messageEditorIDPrefix + $objectID).val(); } else { - var $ckEditor = $('#' + this._messageEditorIDPrefix + $objectID).ckeditor().editor; + var $ckEditor = $('#' + this._messageEditorIDPrefix + $objectID).ckeditorGet(); $message = $ckEditor.getData(); } @@ -1398,7 +1398,7 @@ WCF.Message.InlineEditor = Class.extend({ $message = $('#' + this._messageEditorIDPrefix + $objectID).val(); } else { - var $ckEditor = $('#' + this._messageEditorIDPrefix + $objectID).ckeditor().editor; + var $ckEditor = $('#' + this._messageEditorIDPrefix + $objectID).ckeditorGet(); $message = $ckEditor.getData(); } @@ -1454,7 +1454,7 @@ WCF.Message.InlineEditor = Class.extend({ // remove editor if (!$.browser.mobile) { - var $ckEditor = $('#' + this._messageEditorIDPrefix + $container.data('objectID')).ckeditor().editor; + var $ckEditor = $('#' + this._messageEditorIDPrefix + $container.data('objectID')).ckeditorGet(); $ckEditor.destroy(); } @@ -2524,10 +2524,10 @@ WCF.Message.Quote.Manager = Class.extend({ var $ckEditor = null; if (!$.browser.mobile) { if (this._ckEditorAlternative === null) { - $ckEditor = this._ckEditor.ckeditor().editor; + $ckEditor = this._ckEditor.ckeditorGet(); } else { - $ckEditor = this._ckEditorAlternative.ckeditor().editor; + $ckEditor = this._ckEditorAlternative.ckeditorGet(); } } diff --git a/wcfsetup/install/files/js/WCF.Message.min.js b/wcfsetup/install/files/js/WCF.Message.min.js index c4fecd9415..486c77588c 100755 --- a/wcfsetup/install/files/js/WCF.Message.min.js +++ b/wcfsetup/install/files/js/WCF.Message.min.js @@ -1 +1 @@ -WCF.Message={};WCF.Message.BBCode={};WCF.Message.BBCode.CodeViewer=Class.extend({_dialog:null,init:function(){this._dialog=null;this._initCodeBoxes();WCF.DOMNodeInsertedHandler.addCallback("WCF.Message.BBCode.CodeViewer",$.proxy(this._initCodeBoxes,this));WCF.DOMNodeInsertedHandler.execute()},_initCodeBoxes:function(){$(".codeBox:not(.jsCodeViewer)").each($.proxy(function(a,c){var b=$(c).addClass("jsCodeViewer");$('').appendTo(b.find("div > h3")).click($.proxy(this._click,this))},this))},_click:function(b){var a="";$(b.currentTarget).parents("div").next("ol").children("li").each(function(c,d){if(a){a+="\n"}a+=$(d).text().replace(/\n+$/,"")});if(this._dialog===null){this._dialog=$('