Plate 工具集

\@platejs/utils 的 API 参考文档。

@platejs/utils 包含用于 Plate 的实用工具函数。

Hooks

useEditorString

Returnsstring

    编辑器中所有文本节点拼接后的文本内容。

useMarkToolbarButtonState

生成标记工具栏按钮的状态。

Parameters

  • nodeType string

    要检查活动标记的节点类型。

  • clear optional string | string[]

    应用标记时要清除的节点类型或类型数组。

Returnsobject

Collapse all
  • pressed boolean

    当前选中内容中 nodeType 标记是否处于活动状态。

  • nodeType string

    节点类型。

  • clear optional string | string[]

    切换此标记时要清除的类型或类型数组。

useMarkToolbarButton

使用 useMarkToolbarButtonState 创建的状态生成标记工具栏按钮的属性。

Parameters

Collapse all
  • state ReturnType<typeof useMarkToolbarButtonState>

    useMarkToolbarButtonState 生成的标记工具栏按钮状态。

Returnsobject

Collapse all
  • props object

useRemoveNodeButton

生成用于移除编辑器中节点的按钮属性。

Parameters

Collapse all
  • element TElement

    要移除的节点元素。

Returnsobject

Collapse all
  • props object