Files

43 lines
1014 B
Plaintext
Raw Permalink Normal View History

---
title: 编排操作
description: 用显式 Actions 替换预设,并将控件放入正确的编辑区域。
order: 11
toc:
- id: explicit-actions
title: 显式 Actions
- id: placement
title: 放置位置
- id: action-groups
title: Action 分组
---
## 显式 Actions {#explicit-actions}
当产品需要精确控制功能和顺序时,将预设切换为子元素:
```tsx
<LexicalActions>
<Undo />
<Redo />
<Bold />
<Italic />
<Link />
</LexicalActions>
```
## 放置位置 {#placement}
Actions 默认显示在固定工具栏中。`in` 属性接受一个或多个区域:
```tsx
<Bold in={["toolbar", "bubble"]} />
<Date in="bubble" />
<ClearFormatting in="footer" />
```
隐藏 Action 可以提供编辑器行为而不渲染控件,`DraggableBlocks` 就使用了这种模式。
## Action 分组 {#action-groups}
`ActionGroup` 可以是逻辑分组,也可以是可见菜单。普通文本、标题、引用和列表样式等相互关联的选择适合放入菜单。