@lexical/extension/ClickAfterLastBlockExtension
Interfaces
ClickAfterLastBlockConfig
Defined in: packages/lexical-extension/src/ClickAfterLastBlockExtension.ts:51
Properties
$shouldInsertAfter
$shouldInsertAfter: (
node) =>boolean
Defined in: packages/lexical-extension/src/ClickAfterLastBlockExtension.ts:61
Called inside the editor update with the last child of the root when
the user clicks the empty area below it. Return true to insert a
new paragraph after that node and select it; return false to leave
the click alone. Default is $defaultShouldInsertAfter — see
its docs for composition patterns.
Parameters
node
Returns
boolean
disabled
disabled:
boolean
Defined in: packages/lexical-extension/src/ClickAfterLastBlockExtension.ts:53
Set to true to disable this extension.
ClickAfterLastBlockOutput
Defined in: packages/lexical-extension/src/ClickAfterLastBlockExtension.ts:64
Properties
$shouldInsertAfter
$shouldInsertAfter:
Signal<(node) =>boolean>
Defined in: packages/lexical-extension/src/ClickAfterLastBlockExtension.ts:68
Predicate signal — see ClickAfterLastBlockConfig.$shouldInsertAfter.
disabled
disabled:
Signal<boolean>
Defined in: packages/lexical-extension/src/ClickAfterLastBlockExtension.ts:66
Set to true to disable this extension.
Variables
ClickAfterLastBlockExtension
constClickAfterLastBlockExtension:LexicalExtension<ClickAfterLastBlockConfig,"@lexical/ClickAfterLastBlock",ClickAfterLastBlockOutput,unknown>
Defined in: packages/lexical-extension/src/ClickAfterLastBlockExtension.ts:131
Click handling for the empty area below the last block of the document.
Without this extension, clicking the area below the last block when that
block is a DecoratorNode, a shadow-root ElementNode (e.g.
TableNode), or any other block that doesn't accept the click naturally
leaves the selection in an awkward place — null for a bare decorator,
or at the end of a table cell. Users typically expect a new paragraph
to appear below the block with the caret in it, matching the behavior
of editors like Notion.
This extension intercepts clicks under those conditions, inserts a new empty paragraph after the last block, and selects it.
Closes #8544.
Functions
$defaultShouldInsertAfter()
$defaultShouldInsertAfter(
node):boolean
Defined in: packages/lexical-extension/src/ClickAfterLastBlockExtension.ts:41
Experimental
Default predicate matches DecoratorNode and shadow-root
ElementNodes (e.g. TableNode). Apps that want to also trigger on
other node types — CodeNode, custom non-editable blocks — should
compose this default in their own predicate rather than re-deriving
the check:
configExtension(ClickAfterLastBlockExtension, {
$shouldInsertAfter: (node) =>
$defaultShouldInsertAfter(node) || $isCodeNode(node),
});
Parameters
node
Returns
boolean