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

Commit e19bf31

Browse files
acekatlinkesch
authored andcommitted
extend editor's functions only once (#316)
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
1 parent 9a122cb commit e19bf31

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/js/core.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,15 @@
5757

5858
// Extend editor's functions
5959
if (this.options && this.options.editor) {
60-
this.options.editor._serialize = this.options.editor.serialize;
61-
this.options.editor._destroy = this.options.editor.destroy;
62-
this.options.editor._setup = this.options.editor.setup;
60+
if (this.options.editor._serialize === undefined) {
61+
this.options.editor._serialize = this.options.editor.serialize;
62+
}
63+
if (this.options.editor._destroy === undefined) {
64+
this.options.editor._destroy = this.options.editor.destroy;
65+
}
66+
if (this.options.editor._setup === undefined) {
67+
this.options.editor._setup = this.options.editor.setup;
68+
}
6369
this.options.editor._hideInsertButtons = this.hideButtons;
6470

6571
this.options.editor.serialize = this.editorSerialize;

0 commit comments

Comments
 (0)