Skip to content

Commit e35b2b1

Browse files
committed
Removes debugger statement, free editor on close
fix(patternkit.jsoneditor.js)
1 parent 1e54f06 commit e35b2b1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

js/patternkit.jsoneditor.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,27 +287,28 @@
287287
// @TODO Add handling for AJAX errors and re-attach.
288288
var parent_call = Drupal.Ajax.prototype.beforeSubmit;
289289
Drupal.Ajax.prototype.beforeSubmit = function (formValues, elementSettings, options) {
290-
debugger;
291290
if (window.patternkitEditor) {
292291
window.patternkitEditor.disable();
293292
saveSchema();
294-
var index = formValues.findIndex(function (o) { return o.name == "settings[instance_config]"; });
293+
var index = formValues.findIndex(function (o) { return o.name === "settings[instance_config]"; });
295294
formValues[index] = {
296295
name: "settings[instance_config]",
297296
value: JSON.stringify(window.patternkitEditor.getValue()),
298297
type: "hidden",
299298
required: false
300299
};
301-
window.patternkitEditor.destroy()
300+
window.patternkitEditor.destroy();
301+
delete window.patternkitEditor;
302302
}
303303
parent_call.call(this, formValues, elementSettings, options);
304-
}
304+
};
305305
$('[data-drupal-selector="edit-actions-submit"]').parent('form').once().each(function () {
306306
$(this).submit(function (e) {
307307
e.preventDefault();
308308
window.patternkitEditor.disable();
309309
saveSchema();
310310
window.patternkitEditor.destroy();
311+
delete window.patternkitEditor;
311312
$(this).unbind('submit').submit();
312313
});
313314
});

0 commit comments

Comments
 (0)