resetAttributes 命令

resetAttributes 将节点或标记的指定属性重置为其默认值。

参数

typeOrName: string | NodeType | MarkType

应重置其属性的节点或标记的名称或类型。

attributes: string | string[]

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

使用 resetAttributes 命令

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