mycurelabs / vue-wysiwyg

A simple wysiwyg editor for Vue.js
https://mycurelabs.github.io/vue-wysiwyg/
MIT License
51 stars 13 forks source link

Not reactive #15

Open jartaud opened 4 years ago

jartaud commented 4 years ago

Step to reproduce:

  1. Create a select element

  2. Watch the data of the select onchange

  3. Set v-model (nothing happens when I change the selected value)

I think the problem is due to this line: https://github.com/mycurelabs/vue-wysiwyg/blob/196e876efcb4f159fe7fab02292197644b7270a2/src/McWysiwyg.vue#L188

How i solve it:

onSelectType(item) {
      Setting the data to <mc-wysiwyg />  v-model      
      .....
      // The trick to make it reactive
      this.$nextTick(() => {
           document.getElementById('editor').innerHTML = ''
      });
},

Is there any better way?

jofftiquez commented 4 years ago

@MAvalleza @jamorajj @MarJaysonSanAgustin @gerald35canonizado would guys mind looking into this? Thanks.

carlolol commented 3 years ago

This could be considered as a bug, depending on the use-case. It isn't reactive for a purpose. If the highlighted line is removed, it will make typing hard as every time you would type, the cursor will go back to the start. You really might have to apply that work around if you want to it to be reactive.

jofftiquez commented 3 years ago

This could be considered as a bug, depending on the use-case. It isn't reactive for a purpose. If the highlighted line is removed, it will make typing hard as every time you would type, the cursor will go back to the start. You really might have to apply that work around if you want to it to be reactive.

Thanks @carlolol