toggleWrap 命令

toggleWrap 将当前节点包装为一个新节点或移除一个包装节点。

参数

typeOrName: string | NodeType

用于包装节点的节点类型。

attributes?: Record<string, any>

应应用于节点的属性。这是可选的。

使用 toggleWrap 命令

// toggle wrap the current selection with a blockquote node
editor.commands.toggleWrap('blockquote')