You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are several ways to copy and paste an image. You can copy it from the file system or copy it from the browser using the context menu. When copying an image from a browser, the image is not pasted as a file. Instead, an HTML import is performed
copy-from-browser.mov
This happens because when you copy an image from a web page via the context menu, the browser contains two mime types in the clipboard at the same time: text/html and the file type
The current limitation prevents images copied from the browser from being pasted as a file, even though the clipboard contains a file. The DRAG_DROP_PASTE command handler will never trigger. Pasting via HTML may not be desirable if the user wants to strictly control the sources of images
To support this scenario, you have to override the PASTE_COMMAND, although it would be nice to have this kind of paste built-in. Alternatively, the eventFiles function could be parameterized so that overriding PASTE_COMMAND in a custom editor doesn't duplicate the existing logic, but reuses it
Description
There are several ways to copy and paste an image. You can copy it from the file system or copy it from the browser using the context menu. When copying an image from a browser, the image is not pasted as a file. Instead, an HTML import is performed
copy-from-browser.mov
This happens because when you copy an image from a web page via the context menu, the browser contains two mime types in the clipboard at the same time: text/html and the file type
evetFilesfunction returns false for thehasTextContentflag because DataTransfer has text/html type and theDRAG_DROP_PASTEdispatch is skipped https://github.com/facebook/lexical/blob/main/packages/lexical-rich-text/src/index.ts#L1292-L1298Impact
The current limitation prevents images copied from the browser from being pasted as a file, even though the clipboard contains a file. The
DRAG_DROP_PASTEcommand handler will never trigger. Pasting via HTML may not be desirable if the user wants to strictly control the sources of imagesTo support this scenario, you have to override the
PASTE_COMMAND, although it would be nice to have this kind of paste built-in. Alternatively, theeventFilesfunction could be parameterized so that overridingPASTE_COMMANDin a custom editor doesn't duplicate the existing logic, but reuses it