mycurelabs / vue-wysiwyg

A simple wysiwyg editor for Vue.js

Home Page:https://mycurelabs.github.io/vue-wysiwyg/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not reactive

jartaud opened this issue · comments

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:

if (!document.getElementById('editor').innerHTML) {

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?

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

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.

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