@lexical/hashtag
Classes
HashtagNode
Defined in: packages/lexical-hashtag/src/LexicalHashtagNode.ts:15
Extends
Methods
canInsertTextBefore()
canInsertTextBefore():
boolean
Defined in: packages/lexical-hashtag/src/LexicalHashtagNode.ts:34
This method is meant to be overridden by TextNode subclasses to control the behavior of those nodes when a user event would cause text to be inserted before them in the editor. If true, Lexical will attempt to insert text into this node. If false, it will insert the text in a new sibling node.
Returns
boolean
true if text can be inserted before the node, false otherwise.
Overrides
createDOM()
createDOM(
config
):HTMLElement
Defined in: packages/lexical-hashtag/src/LexicalHashtagNode.ts:24
Called during the reconciliation process to determine which nodes to insert into the DOM for this Lexical Node.
This method must return exactly one HTMLElement. Nested elements are not supported.
Do not attempt to update the Lexical EditorState during this phase of the update lifecycle.
Parameters
config
Returns
HTMLElement
Overrides
isTextEntity()
isTextEntity():
true
Defined in: packages/lexical-hashtag/src/LexicalHashtagNode.ts:38
This method is meant to be overridden by TextNode subclasses to control the behavior of those nodes when used with the registerLexicalTextEntity function. If you're using registerLexicalTextEntity, the node class that you create and replace matched text with should return true from this method.
Returns
true
true if the node is to be treated as a "text entity", false otherwise.
Overrides
clone()
static
clone(node
):HashtagNode
Defined in: packages/lexical-hashtag/src/LexicalHashtagNode.ts:20
Clones this node, creating a new node with a different key and adding it to the EditorState (but not attaching it anywhere!). All nodes must implement this method.
Parameters
node
Returns
Overrides
getType()
static
getType():string
Defined in: packages/lexical-hashtag/src/LexicalHashtagNode.ts:16
Returns the string type of this node. Every node must implement this and it MUST BE UNIQUE amongst nodes registered on the editor.
Returns
string
Overrides
importJSON()
static
importJSON(serializedNode
):HashtagNode
Defined in: packages/lexical-hashtag/src/LexicalHashtagNode.ts:30
Controls how the this node is deserialized from JSON. This is usually boilerplate, but provides an abstraction between the node implementation and serialized interface that can be important if you ever make breaking changes to a node schema (by adding or removing properties). See Serialization & Deserialization.
Parameters
serializedNode
Returns
Overrides
Functions
$createHashtagNode()
$createHashtagNode(
text
):HashtagNode
Defined in: packages/lexical-hashtag/src/LexicalHashtagNode.ts:48
Generates a HashtagNode, which is a string following the format of a # followed by some text, eg. #lexical.
Parameters
text
string
= ''
The text used inside the HashtagNode.
Returns
- The HashtagNode with the embedded text.
$isHashtagNode()
$isHashtagNode(
node
):node is HashtagNode
Defined in: packages/lexical-hashtag/src/LexicalHashtagNode.ts:57
Determines if node is a HashtagNode.
Parameters
node
The node to be checked.
undefined
| null
| LexicalNode
Returns
node is HashtagNode
true if node is a HashtagNode, false otherwise.