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 9524547 commit 7dfc6d2Copy full SHA for 7dfc6d2
src/extensions/TextDirection.ts
@@ -61,12 +61,13 @@ function TextDirectionPlugin({ types }: { types: string[] }) {
61
if (node.attrs.dir !== null && node.textContent.length > 0) {
62
return
63
}
64
+ const newTextDirection = getTextDirection(node.textContent)
65
+ if (node.attrs.dir === newTextDirection) {
66
+ return
67
+ }
68
+
69
const marks = tr.storedMarks || []
- tr.setNodeAttribute(
- pos,
- 'dir',
- getTextDirection(node.textContent),
- )
70
+ tr.setNodeAttribute(pos, 'dir', newTextDirection)
71
// `tr.setNodeAttribute` resets the stored marks so we'll restore them
72
for (const mark of marks) {
73
tr.addStoredMark(mark)
0 commit comments