探索 Tiptap V3 的最新功能

提升命令

lift 命令将给定节点提升到其父节点。提升意味着该块将被移动到它当前所在块的父级。

参数

typeOrName: String | NodeType

应该被提升的节点。如果在当前选择中找不到该节点,则忽略该命令。

attributes: Record<string, any>

节点应该具备的属性,以便被提升。此项可选

使用提升命令

// 提升任何标题
editor.commands.lift('headline')

// 仅提升 h2
editor.commands.lift('headline', { level: 2 })