Skip to content
This repository has been archived by the owner on Sep 11, 2020. It is now read-only.

Commit

Permalink
extend editor's functions only once (#316)
Browse files Browse the repository at this point in the history
when multiple instances of InsertPlugin are on the same MediumEditor instance, the functions  _serialize, _destroy and _setup are reset with the previous extended functions causing infinite loop on editorSerialize, editorDestroy and editorSetup
  • Loading branch information
acekat authored and linkesch committed Apr 18, 2016
1 parent 9a122cb commit e19bf31
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,15 @@

// Extend editor's functions
if (this.options && this.options.editor) {
this.options.editor._serialize = this.options.editor.serialize;
this.options.editor._destroy = this.options.editor.destroy;
this.options.editor._setup = this.options.editor.setup;
if (this.options.editor._serialize === undefined) {
this.options.editor._serialize = this.options.editor.serialize;
}
if (this.options.editor._destroy === undefined) {
this.options.editor._destroy = this.options.editor.destroy;
}
if (this.options.editor._setup === undefined) {
this.options.editor._setup = this.options.editor.setup;
}
this.options.editor._hideInsertButtons = this.hideButtons;

this.options.editor.serialize = this.editorSerialize;
Expand Down

0 comments on commit e19bf31

Please sign in to comment.