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

Convert pasted Google Docs Title text into a Heading #2729

Merged
merged 3 commits into from
Aug 1, 2022
Merged

Conversation

acywatson
Copy link
Contributor

This adds some pretty fragile logic to preserve the formatting of a Google Docs "Title" when pasted into a Lexical editor using the core HeadingNode from @lexical/rich-text.

I do not understand why Google doesn't put something vaguely resembling semantic HTML on the clipboard when users copy from Docs, but I don't think it's going to change and we need to find a more robust way to deal with the idiosyncrasies.

I noticed CKEditor has a whole separate plugin just for handling pasted HTML from Docs. Perhaps the most robust solution would be to not use HTML at all and instead build a conversion between the Google Docs JSON format (that is also on the clipboard) and Lexical.

For now, we have this.

@vercel
Copy link

vercel bot commented Jul 29, 2022

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

Name Status Preview Updated
lexical ✅ Ready (Inspect) Visit Preview Jul 29, 2022 at 4:39AM (UTC)
lexical-playground ✅ Ready (Inspect) Visit Preview Jul 29, 2022 at 4:39AM (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 Jul 29, 2022
@acywatson acywatson merged commit 27430b1 into main Aug 1, 2022
@acywatson acywatson deleted the gdocs-title branch August 1, 2022 18:45
thegreatercurve pushed a commit that referenced this pull request Nov 25, 2022
* support GDocs title

* handle it better

* reorg and tests
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.

None yet

3 participants