feat(lexical): support styling declarative actions

Accept className on action declarations and carry it through compiled actions, default toolbar controls, menu items, custom renderers, and custom controls. Keep preset action ordering consistent across toolbar and bubble placements, with coverage for default and custom rendering paths.
This commit is contained in:
Maofeng
2026-08-08 21:13:49 +08:00
parent bc84912e48
commit c64864b3b5
6 changed files with 90 additions and 16 deletions
+3 -1
View File
@@ -4,13 +4,13 @@ import {
TooltipContent,
TooltipTrigger,
} from "@workspace/ui/components/tooltip"
import { useLexicalActionContext } from "./context"
import { useLexicalMessage } from "./i18n"
import type { LexicalControlProps } from "./types"
export function LexicalControl<Value = string>({
action,
className,
label,
presentation = "control",
render,
@@ -25,6 +25,7 @@ export function LexicalControl<Value = string>({
const onClick = () => execute()
const renderProps = {
active,
className,
disabled,
execute,
label: resolvedLabel,
@@ -54,6 +55,7 @@ export function LexicalControl<Value = string>({
<Button
type="button"
size="icon-sm"
className={className}
variant={active ? "secondary" : "ghost"}
disabled={disabled}
aria-label={resolvedLabel}