unsetTextDirection command
The unsetTextDirection command removes the text direction attribute from nodes at the current selection or at a specified position. This allows nodes to inherit the direction from the editor's global textDirection setting or to have no direction attribute at all.
See also: setTextDirection
Parameters
position
Optional. The position or range where the direction should be removed. If not provided, the command will use the current selection.
Can be:
- A number representing a specific position
- An object with
fromandtoproperties representing a range
Examples
// Remove direction from current selection
editor.commands.unsetTextDirection()
// Remove direction from a specific position
editor.commands.unsetTextDirection(5)
// Remove direction from a specific range
editor.commands.unsetTextDirection({ from: 0, to: 10 })
// Chain with other commands
editor.chain().focus().unsetTextDirection().run()