Files
simple-react-app-kit/packages/lexical/src/actions/indent.ts
T
2026-09-20 15:52:22 +08:00

23 lines
717 B
TypeScript

import { IndentDecrease, IndentIncrease } from "@workspace/ui/components/icon"
import { INDENT_CONTENT_COMMAND, OUTDENT_CONTENT_COMMAND } from "lexical"
import type { LexicalActionDefinition } from "../types"
import { lexicalMessages } from "../messages"
export const outdentAction: LexicalActionDefinition = {
name: "outdent",
label: lexicalMessages.outdent,
icon: IndentDecrease,
execute: ({ editor }) => {
editor.dispatchCommand(OUTDENT_CONTENT_COMMAND, undefined)
},
}
export const indentAction: LexicalActionDefinition = {
name: "indent",
label: lexicalMessages.indent,
icon: IndentIncrease,
execute: ({ editor }) => {
editor.dispatchCommand(INDENT_CONTENT_COMMAND, undefined)
},
}