flyween / vue3-quill

Quill editor for vue3
https://flyween.github.io/vue3-quill/
MIT License
59 stars 16 forks source link

"TypeError: Cannot read property 'indexOf' of undefined" #6

Open led101 opened 3 years ago

led101 commented 3 years ago

When I added the option:

modules: {
    toolbar: false,
}

console would display "TypeError: Cannot read property 'indexOf' of undefined" whenever my router changes to a different link. The error comes from an if statement in editor.vue on line 55:

    onBeforeUnmount(() => {
      const editorToolbar = editor.value.previousSibling
      if (editorToolbar && editorToolbar.className.indexOf('ql-toolbar') > -1) {
        editorToolbar.parentNode.removeChild(editorToolbar)
      }
    })

This error is messing up my app a lot because it's not unmounting quill properly. Quill editor would show up on pages that should not have quill editor.

led101 commented 3 years ago

Here is the full error message:

Uncaught (in promise) TypeError: Cannot read property 'indexOf' of undefined at eval (editor.vue?9757:155) at callWithErrorHandling (runtime-core.esm-bundler.js?5c40:6990) at callWithAsyncErrorHandling (runtime-core.esm-bundler.js?5c40:6999) at Array.hook.weh.hook.weh (runtime-core.esm-bundler.js?5c40:2270) at invokeArrayFns (shared.esm-bundler.js?9ff4:552) at unmountComponent (runtime-core.esm-bundler.js?5c40:5083) at unmount (runtime-core.esm-bundler.js?5c40:4993) at unmountChildren (runtime-core.esm-bundler.js?5c40:5121) at unmount (runtime-core.esm-bundler.js?5c40:5011) at unmountComponent (runtime-core.esm-bundler.js?5c40:5092)

Winston-Guess commented 2 years ago

Same issue :(