Skip to content

Filter out mixed files + content copy pasting#3329

Merged
fantactuka merged 1 commit into
mainfrom
file-pasting-fix
Nov 8, 2022
Merged

Filter out mixed files + content copy pasting#3329
fantactuka merged 1 commit into
mainfrom
file-pasting-fix

Conversation

@fantactuka

@fantactuka fantactuka commented Nov 8, 2022

Copy link
Copy Markdown
Collaborator

When copying, MSWord adds content as an image to the clipboard (apart from various text formats data), and our file copy/pasting logic which is executed before text content parsing inserts that image instead of actual text content:

Screen.Recording.2022-11-07.at.10.28.00.PM.mov

@vercel

vercel Bot commented Nov 8, 2022

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
lexical ✅ Ready (Inspect) Visit Preview Nov 8, 2022 at 3:28AM (UTC)
lexical-playground ✅ Ready (Inspect) Visit Preview Nov 8, 2022 at 3:28AM (UTC)

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 8, 2022
const types = dataTransfer.types;
const hasFiles = types.includes('Files');
const hasContent =
types.includes('text/html') || types.includes('text/plain');

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@zurfyx Not sure which check is better: text/html | plain/text or just check if there's anything else except 'Files'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd say what you have now is best as many apps including Mac Finder tend to include a variety of formats

@zurfyx zurfyx left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you Maksim!

const types = dataTransfer.types;
const hasFiles = types.includes('Files');
const hasContent =
types.includes('text/html') || types.includes('text/plain');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd say what you have now is best as many apps including Mac Finder tend to include a variety of formats

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants