Skip to content

Commit

Permalink
this.rte was already used for the signature editor.
Browse files Browse the repository at this point in the history
Moving everything to ImpComposeBase made both editors referencing the same
instance, causing all kind of broken behavior.
  • Loading branch information
yunosh committed Apr 9, 2014
1 parent cc69331 commit ea9821d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions imp/js/compose-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

var ImpComposeBase = {

// Vars defaulting to null: editor_on, identities, rte, rte_loaded
// Vars defaulting to null: editor_on, identities, rte, rte_sig, rte_loaded, rte_sig_loaded

getSpellChecker: function()
{
Expand Down Expand Up @@ -68,28 +68,28 @@ var ImpComposeBase = {
if (rte) {
s.setValue(Object.isString(identity) ? identity : identity.hsig);

if (Object.isUndefined(this.rte_loaded)) {
if (Object.isUndefined(this.rte_sig_loaded)) {
CKEDITOR.on('instanceReady', function(evt) {
this.rte_loaded = true;
this.rte_sig_loaded = true;
}.bind(this));
CKEDITOR.on('instanceDestroyed', function(evt) {
this.rte_loaded = false;
this.rte_sig_loaded = false;
}.bind(this));
}

if (this.rte) {
this.rte.setData($F('signature'));
if (this.rte_sig) {
this.rte_sig.setData($F('signature'));
} else {
config = Object.clone(IMP.ckeditor_config);
config.removePlugins = 'toolbar,elementspath';
config.contentsCss = [ CKEDITOR.basePath + 'contents.css', CKEDITOR.basePath + 'nomargin.css' ];
config.height = ($('signatureBorder') ? $('signatureBorder') : $('signature')).getLayout().get('height');
this.rte = CKEDITOR.replace('signature', config);
this.rte_sig = CKEDITOR.replace('signature', config);
}
} else {
if (this.rte) {
this.rte.destroy(true);
delete this.rte;
if (this.rte_sig) {
this.rte_sig.destroy(true);
delete this.rte_sig;
}
s.setValue(Object.isString(identity) ? identity : identity.sig);
}
Expand Down

0 comments on commit ea9821d

Please sign in to comment.