Skip to content

Commit b3a1584

Browse files
author
Dmitry Kuzin (DevExpress)
committed
Fix ck-editor will unmount exception
1 parent b07f176 commit b3a1584

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/ck-editor.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,24 @@ function init(Survey) {
33
name: "editor",
44
title: "Editor",
55
iconName: "icon-editor",
6-
widgetIsLoaded: function() {
6+
widgetIsLoaded: function () {
77
return typeof CKEDITOR != "undefined";
88
},
9-
isFit: function(question) {
9+
isFit: function (question) {
1010
return question.getType() === "editor";
1111
},
1212
htmlTemplate:
1313
"<textarea rows='10' cols='80' style: {width:'100%'}></textarea>",
14-
activatedByChanged: function(activatedBy) {
14+
activatedByChanged: function (activatedBy) {
1515
Survey.JsonObject.metaData.addClass("editor", [], null, "empty");
1616
Survey.JsonObject.metaData.addProperty("editor", {
1717
name: "height",
1818
default: 300
1919
});
2020
},
21-
afterRender: function(question, el) {
21+
afterRender: function (question, el) {
2222
var name = question.name;
23-
CKEDITOR.editorConfig = function(config) {
23+
CKEDITOR.editorConfig = function (config) {
2424
config.language = "es";
2525
config.height = question.height;
2626
config.toolbarCanCollapse = true;
@@ -36,18 +36,18 @@ function init(Survey) {
3636
CKEDITOR.instances[name].config.readOnly = question.isReadOnly;
3737

3838
var isValueChanging = false;
39-
var updateValueHandler = function() {
39+
var updateValueHandler = function () {
4040
if (isValueChanging || typeof question.value === "undefined") return;
4141
editor.setData(question.value);
4242
};
43-
editor.on("change", function() {
43+
editor.on("change", function () {
4444
isValueChanging = true;
4545
question.value = editor.getData();
4646
isValueChanging = false;
4747
});
4848

4949
question.valueChangedCallback = updateValueHandler;
50-
question.readOnlyChangedCallback = function() {
50+
question.readOnlyChangedCallback = function () {
5151
if (question.isReadOnly) {
5252
editor.setReadOnly(true);
5353
} else {
@@ -58,7 +58,7 @@ function init(Survey) {
5858
},
5959
willUnmount: function (question, el) {
6060
question.readOnlyChangedCallback = null;
61-
CKEDITOR.instances[question.id].destroy(false);
61+
CKEDITOR.instances[question.name].destroy(false);
6262
}
6363
};
6464

0 commit comments

Comments
 (0)