Skip to content

Instantly share code, notes, and snippets.

@patrickdavey
Created March 6, 2019 03:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save patrickdavey/266bf06b39237dcc40679978fdd229d4 to your computer and use it in GitHub Desktop.
Save patrickdavey/266bf06b39237dcc40679978fdd229d4 to your computer and use it in GitHub Desktop.
simple app to show destroy on vue-ckeditor2
<template>
<div>
<vue-ckeditor
v-model="content"
:key="myKey"
:id="myKey"
:config="config" />
<button @click="updateKey">Update Key</button>
<span :key="blah['id']" v-for="blah in instances">
{{ blah["id"] }}
</span>
</div>
</template>
<script>
/* eslint-disable */
import VueCkeditor from 'vue-ckeditor2';
export default {
components: { VueCkeditor },
data() {
return {
key: 1,
instances: [],
content: '',
config: {
toolbar: [
['Bold', 'Italic', 'Underline', 'Strike', 'Subscript', 'Superscript']
],
height: 300
}
};
},
computed: {
myKey () {
return `ck-${this.key}`;
}
},
methods: {
updateKey () {
this.key += 1;
setTimeout(() => {
this.instances = window.CKEDITOR.instances;
}, 200);
}
}
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment