探索 Tiptap V3 的最新功能

resetAttributes 命令

resetAttributes 将某些节点的属性重置为其默认属性。

参数

typeOrName: string | Node

应被重置的节点。可以是字符串或 Node。

attributes: string | string[]

一个字符串或字符串数组,定义要重置哪些属性。

使用 resetAttributes 命令

// 重置当前选中的段落节点上的样式和类属性
editor.commands.resetAttributes('paragraph', ['style', 'class'])