We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 34043b7 commit dbca728Copy full SHA for dbca728
src/extensions/TextDirection.ts
@@ -62,12 +62,13 @@ function TextDirectionPlugin({ types }: { types: string[] }) {
62
if (node.attrs.dir !== null && node.textContent.length > 0) {
63
return
64
}
65
+ const newTextDirection = getTextDirection(node.textContent)
66
+ if (node.attrs.dir === newTextDirection) {
67
+ return
68
+ }
69
+
70
const marks = tr.storedMarks || []
- tr.setNodeAttribute(
- pos,
- 'dir',
- getTextDirection(node.textContent),
- )
71
+ tr.setNodeAttribute(pos, 'dir', newTextDirection)
72
// `tr.setNodeAttribute` resets the stored marks so we'll restore them
73
for (const mark of marks) {
74
tr.addStoredMark(mark)
0 commit comments