unsetTextDirection 命令

unsetTextDirection 命令会从当前选区或指定位置的节点中移除文本方向属性。这样节点就会继承编辑器全局的 textDirection 设置,或者完全没有方向属性。

另请参阅:setTextDirection

参数

position

可选。移除方向属性的位置或范围。如果未提供,命令将使用当前选区。

可以是:

  • 表示具体位置的数字
  • 具有 fromto 属性表示范围的对象

示例

// 从当前选区移除方向属性
editor.commands.unsetTextDirection()

// 从指定位置移除方向属性
editor.commands.unsetTextDirection(5)

// 从指定范围移除方向属性
editor.commands.unsetTextDirection({ from: 0, to: 10 })

// 与其他命令链式调用
editor.chain().focus().unsetTextDirection().run()