@lexical/extension/NodeSelectionDataSelectedExtension
Interfaces
NodeSelectionDataSelectedConfig
Defined in: packages/lexical-extension/src/NodeSelectionDataSelectedExtension.ts:25
Properties
attribute
attribute:
string
Defined in: packages/lexical-extension/src/NodeSelectionDataSelectedExtension.ts:39
The attribute toggled on the matched node's host DOM while it is part of
a NodeSelection. Defaults to 'data-selected'. The value is always
'true'; the attribute is removed when the node is no longer selected.
nodes
nodes:
KlassConstructor<typeofLexicalNode>[]
Defined in: packages/lexical-extension/src/NodeSelectionDataSelectedExtension.ts:33
The node types whose host DOM should reflect their NodeSelection
membership. Pass the node classes (e.g. [CardNode, FigureNode]).
Registered subclasses of these classes are matched too, resolved to their
own LexicalNode.getType during init (before the editor is created)
so the update listener never needs a runtime instanceof.
Variables
NodeSelectionDataSelectedExtension
constNodeSelectionDataSelectedExtension:LexicalExtension<NodeSelectionDataSelectedConfig,"@lexical/extension/NodeSelectionDataSelected",unknown, {matchTypes:Set<string>; }>
Defined in: packages/lexical-extension/src/NodeSelectionDataSelectedExtension.ts:56
Experimental
Mirrors NodeSelection membership onto the host DOM as an attribute
so CSS can render a selection outline for ElementNode hosts, which have
no decorate() render path of their own. Configure it per node type:
configExtension(NodeSelectionDataSelectedExtension, {nodes: [CardNode]})
The matched host needs a corresponding CSS rule, e.g.
.lexical-card-node[data-selected='true'] { outline: ... }.