yikoyu / vuetify-pro-tiptap

A Rich Text Editor (WYSIWYG) for Vue3 with tiptap & Vuetify.
https://yikoyu.github.io/vuetify-pro-tiptap/
MIT License
177 stars 24 forks source link

Adding images from file failes #237

Closed GrantAnt closed 10 months ago

GrantAnt commented 11 months ago

Hi,

I have just installed the latest version (2.3.0) with extension-image: 2.1.10. I can add images by URL, but I can't add images from filesystem since the button "Apply" is locked when I have "Upload" open.

"Apply" only unlocks when under "URL" a link is inserted. In this case the image from the link is shown.

Thanks!

leo1200 commented 11 months ago

This is a sign, that the upload function is not correctly specified.

If you specify the upload function not globally but within components, it can be done as follows via the extensions:

    const extensions = [
      BaseKit.configure({
        placeholder: {
          placeholder: 'Enter some text...'
        }
      }),
      Bold,
      Italic,
      Underline,
      Strike,
      Color,
      Highlight,
      Heading,
      Image.configure({
        upload(file: File) {
          // your upload function returning Promise<string>
          return uploadImage(file)
        }
      }),
      Link,
      Table,
      History
    ]