this.dropdownShow(e, btnName);
}, this));
this.buttonAwesome('wsmiley', 'fa-smile-o');
+
+ this.opts.initCallback = $.proxy(function() {
+ if (this.$source.val().length) {
+ this.toggle();
+ this.toggle();
+ }
+ }, this);
},
/**
return true;
},
- /**
- * Overwrites $.Redactor.buildContent() to handle BBCode -> HTML on init
- */
- buildContent: function() {
- if (this.opts.textareamode) this.content = $.trim(this.$source.val());
- else {
- this._convertToHtml();
- this.content = $.trim(this.$source.html());
- }
- },
-
/**
* Overwrites $.Redactor.toggle() to transform the source mode into a BBCode view.
*
// prevent Redactor's own autosave
this.setOption('autosave', false);
+
+ // disable autosave on destroy
+ var $mpDestroy = this.destroy;
+ var self = this;
+ this.destroy = function() {
+ self.autosaveDisable();
+ $mpDestroy.call(self);
+ };
},
/**
_cancel: function() {
var $container = this._container[this._activeElementID].removeClass('jsInvalidQuoteTarget');
- // remove ckEditor
- try {
- var $ckEditor = $('#' + this._messageEditorIDPrefix + $container.data('objectID')).ckeditorGet();
- $ckEditor.destroy();
- }
- catch (e) {
- // CKEditor might be not initialized yet, ignore
- }
+ // remove editor
+ var $target = $('#' + this._messageEditorIDPrefix + $container.data('objectID'));
+ $target.redactor('autosavePurge');
+ $target.redactor('destroy');
// restore message
var $messageBody = $container.find('.messageBody');