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

Commit 16b145d

Browse files
committed
fix #142 - avoid deep copying options.editor
1 parent 4309fa3 commit 16b145d

File tree

4 files changed

+22
-2
lines changed

4 files changed

+22
-2
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
],
2323
"dependencies": {
2424
"jquery": ">=1.9.0",
25-
"medium-editor": "~2.0",
25+
"medium-editor": "~2.3.0",
2626
"handlebars": "~2.0.0",
2727
"blueimp-file-upload": "~9.9.0",
2828
"jquery-sortable": "~0.9.12"

dist/js/medium-editor-insert-plugin.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,21 @@ this["MediumInsert"]["Templates"]["src/js/templates/images-toolbar.hbs"] = Handl
131131
*/
132132

133133
function Core (el, options) {
134+
var editor;
135+
134136
this.el = el;
135137
this.$el = $(el);
136138
this.templates = window.MediumInsert.Templates;
137139

140+
if (options) {
141+
// Fix #142
142+
// Avoid deep copying editor object, because since v2.3.0 it contains circular references which causes jQuery.extend to break
143+
// Instead copy editor object to this.options manually
144+
editor = options.editor;
145+
options.editor = null;
146+
}
138147
this.options = $.extend(true, {}, defaults, options);
148+
this.options.editor = editor;
139149

140150
this._defaults = defaults;
141151
this._name = pluginName;

0 commit comments

Comments
 (0)