Skip to content

Conversation

@johanneswilm
Copy link
Contributor

@johanneswilm johanneswilm commented Sep 1, 2025

This takes care of images inserted by means of insertContent, pasting or potentially other means. Note: Images with a src-attribute linking to an image on another website will run into CORS issues. This is handled gracefully, but it means that these images will not actually end up in the document. Base64 encoded images should work fine.

Copy link
Contributor

@artem-harbour artem-harbour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a couple of comments for consideration.

Note: also need to pay extra attention to adding new appendTransaction so that it doesn't lead to infinite loops and affect performance.

fyi @harbournick @johanneswilm

Copy link
Contributor

@artem-harbour artem-harbour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

cc @harbournick

@johanneswilm
Copy link
Contributor Author

Added a couple of comments for consideration.

I believe I answered all of those.

Note: also need to pay extra attention to adding new appendTransaction so that it doesn't lead to infinite loops and affect performance.

True, that is always important to consider. But as long as one has it limited to only acting in very specific cases and filtering out all other cases and not performing any dom lookups/operations before determining that another tr is needed, it should not have much of an impact on performance.

If one would want to limit the number of appendTransactions in the future, one could turn this into a single function that is executed to find all relevant content that enters through paste and the insertContent command. It could then make sense to move it to a clipboard handling plugin or similar.

@harbournick
Copy link
Collaborator

I moved everything to an internal PR and merged from there FYI: #1010
Closing this one. Just seemed quicker as I was testing and resolving merge conflicts. Feature looks great @johanneswilm !

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.

how to export image(it's invalid when I imported by editorRef.current.activeEditor.commands.insertContent(<img src=${base64}>))

4 participants