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

Support Google Translate #3496

Closed
li-yechao opened this issue Dec 6, 2022 · 1 comment
Closed

Support Google Translate #3496

li-yechao opened this issue Dec 6, 2022 · 1 comment

Comments

@li-yechao
Copy link

Lexical editor need support google translate, it's because of Lexical's DOM mutation observers reverting the content back.

Lexical version: 0.6.0

Steps To Reproduce

  1. Translate web page contain lexical editor in Chrome.

Link to code example:

The current behavior

Lexical editor content not translated.

@trueadm
Copy link
Collaborator

trueadm commented Jan 3, 2023

So looking more into this and it's a really complex one. Essentially, the DOM mutation observers are doing the right job – they're treating the Lexical EditorState as the source of truth – not the DOM. If we change this logic for read only mode, then this assumption is no longer true and subsequent updates to the EditorState will likely fail.

In your case, if you want to have Google Translate support, I'd suggest not using Lexical to render the content if this is possible to do. Instead, you can extract the HTML from the EditorState and render that directly as part of your view logic.

@trueadm trueadm closed this as completed Jan 3, 2023
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

No branches or pull requests

2 participants