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

Cleanup ArtificialNode__DO_NOT_USE #5966

Open
potatowagon opened this issue Apr 26, 2024 · 5 comments
Open

Cleanup ArtificialNode__DO_NOT_USE #5966

potatowagon opened this issue Apr 26, 2024 · 5 comments

Comments

@potatowagon
Copy link
Contributor

A followup task to #5857

During html pasting, ArtificialNode is a temp wrapper node to group nodes within block elements that should be separated by a linebreak (
). It is currently represented by a class extending ElementNode to be compatible with the typings in packages/lexical-html/src/index.ts.

A cleaner soln would be to not have ArtificialNode extend ElementNode so that it would not be confused as a LexicalNode. ArtificialNode is only used in the pasting logic and ideally should not need to be initialised in the Editor.

@jaapvanblaaderen
Copy link

jaapvanblaaderen commented May 15, 2024

Hi @potatowagon, when upgrading to Lexical to 0.15.0 I now get warnings in the console since ArtificialNode__DO_NOT_USE is not implementing methods required by ElementNode. I guess this is not be expected? Or am I maybe doing something wrong in the way I use Lexical?

ArtificialNode__DO_NOT_USE should implement "importJSON" method to ensure JSON and default HTML serialization works as expected
ArtificialNode__DO_NOT_USE should implement "exportJSON" method to ensure JSON and default HTML serialization works as expected
ArtificialNode__DO_NOT_USE must implement static "clone" method

@potatowagon
Copy link
Contributor Author

@jaapvanblaaderen #6107 should fix the warnings

@potatowagon
Copy link
Contributor Author

potatowagon commented May 15, 2024

#6048 another fix

@MrPand-21
Copy link

I still get errors

ArtificialNode__DO_NOT_USE should implement "exportJSON" method to ensure JSON and default HTML serialization works as expected 
ArtificialNode__DO_NOT_USE should implement "importJSON" method to ensure JSON and default HTML serialization works as expected
ArtificialNode__DO_NOT_USE must implement static "clone" method

Is that because I use custom plugins?

@mudcube
Copy link

mudcube commented May 26, 2024

@MrPand-21 For npm version last build was 2-weeks ago, fix was posted 4-days ago.

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

4 participants