From 006bf2f788b9976b5390a1e86b03f0803e4c6db8 Mon Sep 17 00:00:00 2001 From: Pakcy Date: Fri, 27 Oct 2017 09:52:35 +0800 Subject: [PATCH] fix the problem of not updating the content in real time --- example/main.js | 2 +- src/vue-tinymce.vue | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/example/main.js b/example/main.js index 55fe97a..2e2fce1 100644 --- a/example/main.js +++ b/example/main.js @@ -29,7 +29,7 @@ var vm = new Vue({ }) }, { - content: '

多个文本测试


第二行

', + content: '

Vue


The Progressive JavaScript Framework

', setting: { language_url: "langs/zh_CN.js", height: 200, diff --git a/src/vue-tinymce.vue b/src/vue-tinymce.vue index 4a48c08..9d4303b 100644 --- a/src/vue-tinymce.vue +++ b/src/vue-tinymce.vue @@ -60,9 +60,14 @@ export default { // console.log('init', this.value); editor.setContent(this.value); //fix execCommand not change ,more see issues#2 - editor.on('input change undo redo execCommand', ()=>{ + editor.on('input change undo redo execCommand KeyUp', ()=>{ if(this.status === INPUT || this.status === INIT) return this.status = CHANGED; this.$emit('input', editor.getContent()); + console.log('editor change', editor.getContent()); + }); + //fix have chang not to emit input,more see issues #4 + editor.on('NodeChange', ()=>{ + this.$emit('input', editor.getContent()); }); }); }