Document Uploader module and Expose File-to-URL Functionality as Configurable #4348
probably-not
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The Quill Uploader module is currently fully undocumented. It is what Quill uses to upload files (specifically images) into the editor. It is used internally by the clipboard module to handle pasting, and on it's own can handle dropping an image into the editor.
It's default handler is great, but unfortunately the Uploader itself is not very configurable - it either expects the default options, or it expects the user to write the entire handler function.
The handler function itself can be fairly complex, as can be seen by the default handler code that can be found here: https://github.com/slab/quill/blob/main/packages/quill/src/modules/uploader.ts#L57
Extracted handler:
Not only does the user need to know that they must upload the files, but they also need to know that they must write the logic for inserting/deleting/retaining Deltas for each file uploaded, and they must write the logic for updating the contents and setting the selection. And to be honest, I'm not even sure what that first if statement does... but I assume it's important if it's in the handler code.
I propose that instead of exposing the entire handler as a configuration, Quill exposes just the upload itself as configurable. The signature of the upload function configuration should accept a file, and return a URL for that file. This can let the user decide how and where to upload the files, without requiring the user to know everything about the underlying details that the handler takes care of for them.
Beta Was this translation helpful? Give feedback.
All reactions