Skip to content

Commit 7dfc6d2

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 9524547 commit 7dfc6d2

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
@@ -61,12 +61,13 @@ function TextDirectionPlugin({ types }: { types: string[] }) {
6161
if (node.attrs.dir !== null && node.textContent.length > 0) {
6262
return
6363
}
64+
const newTextDirection = getTextDirection(node.textContent)
65+
if (node.attrs.dir === newTextDirection) {
66+
return
67+
}
68+
6469
const marks = tr.storedMarks || []
65-
tr.setNodeAttribute(
66-
pos,
67-
'dir',
68-
getTextDirection(node.textContent),
69-
)
70+
tr.setNodeAttribute(pos, 'dir', newTextDirection)
7071
// `tr.setNodeAttribute` resets the stored marks so we'll restore them
7172
for (const mark of marks) {
7273
tr.addStoredMark(mark)

0 commit comments

Comments
 (0)