Skip to content

Commit 11a5783

Browse files
committed
Clearup fix
1 parent 3f68a1c commit 11a5783

1 file changed

Lines changed: 13 additions & 8 deletions

File tree

frontend/src/modules/scaffold/backboneFormsOverrides.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ define([
8484
};
8585
}
8686

87-
until(isAttached(this.$el)).then(function() {
88-
this.editor = CKEDITOR.create(this.$el[0], {
87+
until(isAttached(this.$el)).then(() => {
88+
return CKEDITOR.create(this.$el[0], {
8989
dataIndentationChars: '',
9090
disableNativeSpellChecker: false,
9191
enterMode: CKEDITOR[Origin.constants.ckEditorEnterMode],
@@ -129,8 +129,6 @@ define([
129129
'indent',
130130
'outdent',
131131
'|',
132-
'heading',
133-
'|',
134132
'bold',
135133
'italic',
136134
'underline',
@@ -149,8 +147,15 @@ define([
149147
],
150148
shouldNotGroupWhenFull: true
151149
}
152-
});
153-
}.bind(this));
150+
}).then(editor => {
151+
this.editor = editor
152+
CKEDITOR.instances = CKEDITOR.instances || []
153+
CKEDITOR.instances.length = CKEDITOR.instances.length || 0;
154+
this.editor.id = CKEDITOR.instances.length
155+
CKEDITOR.instances.length++;
156+
CKEDITOR.instances[this.editor.id] = this.editor
157+
})
158+
});
154159
return this;
155160
};
156161

@@ -170,8 +175,8 @@ define([
170175

171176
// ckeditor removal
172177
Backbone.Form.editors.TextArea.prototype.remove = function() {
173-
this.editor.removeAllListeners();
174-
CKEDITOR.remove(this.editor);
178+
this.editor.stopListening()
179+
delete CKEDITOR.instances[this.editor]
175180
};
176181

177182
// add override to allow prevention of validation

0 commit comments

Comments
 (0)