ueberdosis / tiptap

The headless rich text editor framework for web artisans.
https://tiptap.dev
MIT License
26.65k stars 2.23k forks source link

[Bug]: 2.7.0-pre.0 breaks some input rules and breaks undoing many more of them #5598

Open Nantris opened 1 week ago

Nantris commented 1 week ago

Affected Packages

core

Version(s)

2.7.0-pre.0

Bug Description

Input rule no longer behaves as it had, and even apparently unaffected rules cannot be undone.

Browser Used

Chrome

Code Example URL

No response

Expected Behavior

Upgrade does not break existing input-rule

Additional Context (Optional)

Also ran yarn upgrade in case it was a ProseMirror dependency that needed upgrading, but no change.

Dependency Updates

Nantris commented 1 week ago

Actually, also breaks the inability to undo the broken logic caused by this input rule. It instantly reverts after Ctrl+Z.

Nantris commented 1 week ago

The InputRule is lengthy with a lot of custom logic that would need to be explained, but fortunately I think the issue is the args it's receiving which hopefully will help to get this resolved.

Functional:

image

Broken:

image

Nantris commented 1 week ago

I've ruled out recent changes to prosemirror-view as candidates for the cause of this.

Any ideas for the cause @nperez0111? Or any more info I can provide? I'm not sure why the state's scrollToSelection and the range would be different in 2.7.0 versus 2.6.6. All of our other input rules seem to be unaffected, but perhaps we just don't test them all as extensively.

Nantris commented 1 week ago

I guess maybe it's related to #5261. Assuming that's the cause, I do see value in that PR, but I'm not sure how we could modify our existing logic to function alongside it - especially since it's interfering with undo.

Nantris commented 1 week ago

Confirmed #5261 is the cause, sadly.

nperez0111 commented 1 day ago

Can you give more information to what has changed between the two? I had a lot of hesitation around that change which is why I made the pre version.

Just saying that the values of arguments changed between the two is not enough to warrant a rollback. Since, I did not see an issue with the actual behavior in my testing of it.

re: breaking undo, input rules seem to have always had this behavior, I checked before this change was introduced and on 2.4.0 and it always had that, so that would warrant a separate issue than this.