Skip to content

Feature: Add $deepCopy util function to public API #9898

Open

Description

@levensta

Description

In various tests, a $deepCopy function is declared; its purpose is to perform a deep clone of a node, including its slots (and potentially nodes that possess excludeCopy methods?), given that the existing $copyNode function does not handle this.

I suggest exposing this function in the public API, as it could be useful both in tests and in user code. You should also write about this function in the documentation. Also this function should be mentioned in the documentation https://lexical.dev/docs/concepts/node-cloning

Impact

Reduces boilerplate code in tests and adds the ability to implement a "Duplicate" feature for elements, similar to what is found in some popular editors

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementImprovement over existing feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions