mbouclas / tinymce-vue-2

A vue 2 component for TinyMCE
49 stars 15 forks source link

Two way binding doesn't work? #10

Open Adam-78 opened 7 years ago

Adam-78 commented 7 years ago

If you have some thing as follows:

<tiny-mce id="description" v-model="description"></tiny-mce>

If you update description outside of tinymce editor, then tinymce editor does not reflect the changed value.

It only seems to work one way i.e. changes made inside tinymce will update the description but not the other way round.

When I reset description outside of tinymce how can I update tinymce to reflect the same?

Adam-78 commented 7 years ago

I've had to add the following code to fix:

  watch: {
            value () {
                if (this.value == '')
                    if (typeof tinyMCE != "undefined") {
                        tinymce.get(this.id).setContent('');
                    }
            }
        },
mikermcneil commented 6 years ago
watch: {
    value: function(newVal, unusedOldVal) {
      window.tinymce.get(this.id).setContent(newVal);
    }
}