Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new MenuButtonImageUpload and insertImages util for handling/inserting user-uploaded images #147

Merged
merged 4 commits into from
Sep 11, 2023

Conversation

sjdemartini
Copy link
Owner

@sjdemartini sjdemartini commented Sep 10, 2023

Addresses one of the requests from #136 (likely the more common one, vs the external URL use-case).

Also add paste and drop handlers to the mui-tiptap demo example, so users can copy-paste and drag-and-drop images directly into the editor content.

Note that for the purposes of this demo, there is no server where images are uploaded, so they're simply temporary local object URLs which wouldn't persist in a "real" production context. Users of MenuButtonImageUpload will need to provide their own onUploadFiles prop in order to take the image Files, upload them, and return URLs at which the images can be served/viewed.

Demo

mui-tiptap-image-upload-demo

This better handles the text selection, utilizing Tiptap's internal
`insertContentAt` logic to set the subsequent selection. It also inserts
all nodes in one go, simplifying how we perform insertion.

This also changes the API/fields of the image upload and insert
functionality so that it directly uses all image node attributes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant