模組: lexical
類別
- ArtificialNode__DO_NOT_USE
- DecoratorNode
- EditorState
- ElementNode
- LexicalEditor
- LexicalNode
- LineBreakNode
- NodeSelection
- ParagraphNode
- Point
- RangeSelection
- RootNode
- TabNode
- TextNode
介面
型別別名
CommandListener
Ƭ CommandListener<P
>: (payload
: P
, editor
: LexicalEditor
) => boolean
型別參數
名稱 |
---|
P |
型別宣告
▸ (payload
, editor
): boolean
參數
名稱 | 型別 |
---|---|
payload | P |
editor | LexicalEditor |
回傳值
boolean
定義於
packages/lexical/src/LexicalEditor.ts:256
CommandListenerPriority
Ƭ CommandListenerPriority: 0
| 1
| 2
| 3
| 4
定義於
packages/lexical/src/LexicalEditor.ts:260
CommandPayloadType
Ƭ CommandPayloadType<TCommand
>: TCommand
extends LexicalCommand
<infer TPayload> ? TPayload
: never
型別助手,用於從命令中提取有效負載型別。
範例
const MY_COMMAND = createCommand<SomeType>();
// ...
editor.registerCommand(MY_COMMAND, (payload) => {
// `payload` 的型別在這裡被推斷出來。但假設我們想提取一個函數來委派給
handleMyCommand(editor, payload);
return true;
});
function handleMyCommand(
editor: LexicalEditor,
payload: CommandPayloadType<typeof MY_COMMAND>,
) {
// `payload` 是從命令中提取的 `SomeType` 型別。
}
型別參數
名稱 | 型別 |
---|---|
TCommand | extends LexicalCommand <unknown > |
定義於
packages/lexical/src/LexicalEditor.ts:293
CreateEditorArgs
Ƭ CreateEditorArgs: Object