Skip to content

Commit

Permalink
#49 - Fix error in destroy instance
Browse files Browse the repository at this point in the history
  • Loading branch information
dangvanthanh committed Oct 21, 2018
1 parent b028ab5 commit cf15af1
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 29 deletions.
12 changes: 6 additions & 6 deletions dist/vue-ckeditor2.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ var script = {
},
data: function data() {
return {
destroyed: false,
instanceValue: ''
};
},
Expand Down Expand Up @@ -124,11 +123,12 @@ var script = {
},
destroy: function destroy() {
try {
if (!this.destroyed) {
this.instance.focusManager.blur(true);
this.instance.removeAllListeners();
this.instance.destroy();
this.destroyed = true;
var editor = window['CKEDITOR'];

if (editor.instances) {
for (var instance in editor.instances) {
instance.destroy();
}
}
} catch (e) {}
},
Expand Down
12 changes: 6 additions & 6 deletions dist/vue-ckeditor2.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ var script = {
},
data: function data() {
return {
destroyed: false,
instanceValue: ''
};
},
Expand Down Expand Up @@ -120,11 +119,12 @@ var script = {
},
destroy: function destroy() {
try {
if (!this.destroyed) {
this.instance.focusManager.blur(true);
this.instance.removeAllListeners();
this.instance.destroy();
this.destroyed = true;
var editor = window['CKEDITOR'];

if (editor.instances) {
for (var instance in editor.instances) {
instance.destroy();
}
}
} catch (e) {}
},
Expand Down
12 changes: 6 additions & 6 deletions dist/vue-ckeditor2.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
},
data: function data() {
return {
destroyed: false,
instanceValue: ''
};
},
Expand Down Expand Up @@ -129,11 +128,12 @@
},
destroy: function destroy() {
try {
if (!this.destroyed) {
this.instance.focusManager.blur(true);
this.instance.removeAllListeners();
this.instance.destroy();
this.destroyed = true;
var editor = window['CKEDITOR'];

if (editor.instances) {
for (var instance in editor.instances) {
instance.destroy();
}
}
} catch (e) {}
},
Expand Down
14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
{
"name": "vue-ckeditor2",
"version": "2.0.9",
"version": "2.0.10",
"description": "Ckeditor 4 using with Vue.js",
"author": "Dang Van Thanh <[email protected]>",
"main": "dist/vue-ckeditor2.cjs.js",
"module": "dist/vue-ckeditor2.es.js",
"unpkg": "dist/vue-ckeditor2.js",
"scripts": {
"precommit": "pretty-quick --staged",
"build": "bili src/index.js --plugin vue --format umd,cjs,es --exports named --module-name VueCkeditor"
},
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged"
}
},
"peerDependencies": {
"vue": ">= 2",
"ckeditor": ">= 4"
Expand All @@ -26,9 +30,9 @@
"license": "MIT",
"devDependencies": {
"bili": "^3.1.2",
"husky": "^0.14.3",
"prettier": "1.14.2",
"pretty-quick": "^1.6.0",
"husky": "^1.1.2",
"prettier": "1.14.3",
"pretty-quick": "^1.8.0",
"rollup-plugin-vue": "^4.3.2",
"vue-template-compiler": "^2.5.17"
}
Expand Down
11 changes: 5 additions & 6 deletions src/VueCkeditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export default {
},
data() {
return {
destroyed: false,
instanceValue: ''
};
},
Expand Down Expand Up @@ -109,11 +108,11 @@ export default {
},
destroy() {
try {
if (!this.destroyed) {
this.instance.focusManager.blur(true);
this.instance.removeAllListeners();
this.instance.destroy();
this.destroyed = true;
let editor = window['CKEDITOR'];
if (editor.instances) {
for (let instance in editor.instances) {
instance.destroy();
}
}
} catch (e) {}
},
Expand Down

0 comments on commit cf15af1

Please sign in to comment.