Skip to content

Commit dbca728

Browse files
committed
fix(TextDirection): Ignore unchanged nodes in appendTransaction
Amongh other things, fixes the `undoInputRule()` command. Signed-off-by: Jonas <[email protected]>
1 parent 34043b7 commit dbca728

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/extensions/TextDirection.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,13 @@ function TextDirectionPlugin({ types }: { types: string[] }) {
6262
if (node.attrs.dir !== null && node.textContent.length > 0) {
6363
return
6464
}
65+
const newTextDirection = getTextDirection(node.textContent)
66+
if (node.attrs.dir === newTextDirection) {
67+
return
68+
}
69+
6570
const marks = tr.storedMarks || []
66-
tr.setNodeAttribute(
67-
pos,
68-
'dir',
69-
getTextDirection(node.textContent),
70-
)
71+
tr.setNodeAttribute(pos, 'dir', newTextDirection)
7172
// `tr.setNodeAttribute` resets the stored marks so we'll restore them
7273
for (const mark of marks) {
7374
tr.addStoredMark(mark)

0 commit comments

Comments
 (0)