Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
zurfyx
left a comment
There was a problem hiding this comment.
LGTM, thank you! But I'd be curious to know more about the use case. I wasn't able to repro this from my LinkedIn app, Pasteboard shows type public.url and it isn't retrievable via text/uri-list
You also need to update $insertDataTransferForPlainText for plain text users support
| @@ -130,22 +130,35 @@ export function $insertDataTransferForRichText( | |||
| // instead of single paragraph with linebreaks. | |||
| const text = dataTransfer.getData('text/plain'); | |||
There was a problem hiding this comment.
Given that we're doing a nullish check below you can just do this
| const text = dataTransfer.getData('text/plain'); | |
| const text = dataTransfer.getData('text/plain') || dataTransfer.getData('text/uri-list'); |
There was a problem hiding this comment.
Thank you, this has been fixed in the newest commit and i have also apply the changes to plain text paste.
Hi, i believe this has something to do with the copy operation in the share pop-up menu in IOS. i am able to reproduce by using the copy in share pop-up menu of Safari, Linkedin and instagram in IOS. Below is the screen recording of the repro in Safari and Linkedin app RPReplay_Final1683728447.1.mp4RPReplay_Final1683728291.1.mp4Sorry my phone's language is Chinese so it might be not so clear, but what i did is just use the copy from ios share pop-up menu and paste it in lexical playground. you can see from the log that there is a Clipboard Event but nothing is pasted. This also happens in instagram when trying to share in the same way and I believe it happens as long as user are using the copy operation provided by IOS native share pop-up menu. After the fix, it was able to paste the content from clipboard that are from the share menu pop-up. RPReplay_Final1683729504.MP4 |
zurfyx
left a comment
There was a problem hiding this comment.
Thanks for the videos, appreciate it!
Background
Issue #4409 highlights a problem where users are unable to paste text/uri-list type content. This PR aims to address and resolve this issue.
Cause of the Problem
The problem is due to discrepancies in the valid MIME types for read/write operations in the clipboard between Chromium and WebKit.
Chromium supports the read/write operations for the following MIME types (Chromium):
text/plaintext/htmlimage/pngOn the other hand, WebKit supports all the above types as well as
text/uri-list(WebKit).This inconsistency causes an issue when, for example, a user opens a webpage in Safari on iOS, copies content via the share menu, and tries to paste it elsewhere. In this case, the MIME type of the content in the clipboard is
text/uri-list.However, based on the current logic in
$insertDataTransferForRichTextinclipboard.ts, onlytext/plain,text/html,image/png, and'application/x-lexical-editor'are accepted for pasting. Hence, when a user attempts to paste text of typetext/uri-list, no content is pasted.Proposed Changes
This PR proposes a modification to the
$insertDataTransferForRichTextfunction inclipboard.tsto support pasting oftext/uri-listMIME type.Impact of Changes
This change will allow pasting of
text/uri-listtype content in Safari. However, given Chrome's current lack of support for reading/writingtext/uri-listin the clipboard, the behaviour of pasting this MIME type in Chrome remains unchanged.Fixes #4409