PeakTai/vue-html5-editor

@Change doesn't fire on paste

andreixk opened this issue · 2 comments

When content is changed by right clicking inside the editor and selecting paste, the @change event doesn't trigger. It seems the only way to trigger @change event is to press a key inside the editor.

Any news on this? It's causing us issues too.

I solved the problem by listen "DOMSubtreeModified"

  mounted() {
    const el = this.$refs.vueHtml5Editor.$el;
    const content = el.querySelector(".content");
    content.addEventListener(
      "DOMSubtreeModified",
      () => {
        //manual trigger ‘change’
        this.$emit("change", content.innerHTML);
      },
      false
    );
  },