if (navigator.userAgent.match(/[aA]ndroid/)) {
return;
}
+
+ var $editorName = '{if $wysiwygSelector|isset}{$wysiwygSelector|encodeJS}{else}text{/if}';
+ var $callbackIdentifier = 'CKEditor';
+ if ($editorName != 'text') {
+ $callbackIdentifier += '_' + $editorName;
+ }
- head.load([
- { CKEditorCore: '{@$__wcf->getPath()}js/3rdParty/ckeditor/ckeditor.js' },
- { CKEditor: '{@$__wcf->getPath()}js/3rdParty/ckeditor/adapters/jquery.js' }
- {event name='javascriptFiles'}
- ], function() {
- WCF.System.Dependency.Manager.invoke('CKEditor');
- });
-
- head.ready('CKEditorCore', function() {
- // prevent double editor initialization if used in combination with divarea-plugin
- CKEDITOR.disableAutoInline = true;
- });
-
- WCF.System.Dependency.Manager.setup('CKEditor', function() {
+ WCF.System.Dependency.Manager.setup($callbackIdentifier, function() {
{include file='wysiwygToolbar'}
if (__CKEDITOR_BUTTONS.length) {
CKEDITOR.dom.element.prototype.disableContextMenu = function() { };
}
- var $editor = CKEDITOR.instances['{if $wysiwygSelector|isset}{$wysiwygSelector|encodeJS}{else}text{/if}'];
+ var $editor = CKEDITOR.instances[$editorName];
if ($editor) $editor.destroy(true);
- //CKEDITOR.replace('{if $wysiwygSelector|isset}{$wysiwygSelector|encodeJS}{else}text{/if}');
- $('{if $wysiwygSelector|isset}#{$wysiwygSelector|encodeJS}{else}#text{/if}').ckeditor($config);
- })
+ $('#' + $editorName).ckeditor($config);
+ });
+
+ head.load([
+ { CKEditorCore: '{@$__wcf->getPath()}js/3rdParty/ckeditor/ckeditor.js' },
+ { CKEditor: '{@$__wcf->getPath()}js/3rdParty/ckeditor/adapters/jquery.js' }
+ {event name='javascriptFiles'}
+ ], function() {
+ WCF.System.Dependency.Manager.invoke($callbackIdentifier);
+ });
+
+ head.ready('CKEditorCore', function() {
+ // prevent double editor initialization if used in combination with divarea-plugin
+ CKEDITOR.disableAutoInline = true;
+ });
});
//]]>
</script>
if (this._quoteManager) {
// check if message field is empty
var $empty = true;
- if ($.browser.touch) {
- $empty = (!this._messageField.val().length);
+ if (CKEDITOR) {
+ var self = this;
+ this._messageField.ckeditor(function() {
+ $empty = (!$.trim(this.getData()).length);
+ self._ckeditorCallback($empty);
+ });
+
}
else {
- $empty = (!$.trim(this._messageField.ckeditorGet().getData()).length);
- }
-
- if ($empty) {
- this._quoteManager.insertQuotes(this._getClassName(), this._getObjectID(), $.proxy(this._insertQuotes, this));
+ $empty = (!this._messageField.val().length);
+ this._ckeditorCallback($empty);
}
}
-
- new WCF.PeriodicalExecuter($.proxy(function(pe) {
- pe.stop();
-
- if ($.browser.mobile) {
- this._messageField.focus();
- }
- else {
- this._messageField.ckeditorGet().ui.editor.focus();
- }
- }, this), 250);
}
// discard event
}
},
+ _ckeditorCallback: function(isEmpty) {
+ if (isEmpty) {
+ this._quoteManager.insertQuotes(this._getClassName(), this._getObjectID(), $.proxy(this._insertQuotes, this));
+ }
+
+ /*new WCF.PeriodicalExecuter($.proxy(function(pe) {
+ pe.stop();
+ */
+ if (CKEDITOR) {
+ this._messageField.ckeditorGet().ui.editor.focus();
+ }
+ else {
+ this._messageField.focus();
+ }
+ //}, this), 250);
+ },
+
/**
* Returns container element.
*
pe.stop();
var $ckEditor = $('#' + this._messageEditorIDPrefix + this._container[this._activeElementID].data('objectID'));
- $ckEditor.ckeditorGet().ui.editor.focus();
+ $ckEditor.ckeditor(function() { this.ui.editor.focus(); });
if (this._quoteManager) {
this._quoteManager.setAlternativeCKEditor($ckEditor);