chenjuneking / quill-image-drop-and-paste

A quill editor module for drop and paste image, with a callback hook before insert image into the editor
ISC License
101 stars 42 forks source link

QuillImageDropAndPaste.ImageData is not a constructor #27

Closed nmitra6 closed 2 years ago

nmitra6 commented 2 years ago

Also, one more issue to instantiate an object out of ImageData class. I am using Nuxt (Vue) framework and when importing this class inside plugin, error is thrown as QuillImageDropAndPaste.ImageData is not a constructor.

const ImageData = QuillImageDropAndPaste.ImageData

But if you declare the class as an expression, this error goes away. So if you declare as

ImageData = class {

constructor(dataUrl, type) {
    this.dataUrl = dataUrl
    this.type = type
}

// rest of the codes }

then that error is not thrown. I would request you to incorporate this modification in the next minor version. Also if you change the name 'ImageData' it would be better as browsers have builtin ImageData class/method.

chenjuneking commented 2 years ago

fixed on v1.2.5.

try this:

import { ImageData as QuillImageData } from 'quill-image-drop-and-paste'

In order to avoid the changes affecting the previous version, I decided not to change the name of ImageData, you could rename the ImageData as above.

If you have other questions, please feel free to let me know, thanks!

nmitra6 commented 2 years ago

Thank you Mr Chen for the upgrade. I will try the new version. With a little change in the coding, it is possible to extend this good module to work universally with any html element, let alone Quill. Hope you will consider that in future version

Sent from Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 for Windows

From: Jacket @.> Sent: 12 August 2021 14:05 To: @.> Cc: Nabendu @.>; @.> Subject: Re: [chenjuneking/quill-image-drop-and-paste] QuillImageDropAndPaste.ImageData is not a constructor (#27)

fixed on v1.2.5.

try this:

import { ImageData as QuillImageData } from 'quill-image-drop-and-paste'

In order to avoid the changes affecting the previous version, I decided not to change the name of ImageData, you could rename the ImageData as above.

If you have other questions, please feel free to let me know, thanks!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/chenjuneking/quill-image-drop-and-paste/issues/27#issuecomment-897452453, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABYH6D7ISFHMXGU3BSREHPTT4OBUPANCNFSM5B5O3FYQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email.