Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] undoable input rule #1545

Open
2 tasks done
ap0nia opened this issue Oct 24, 2024 · 0 comments · May be fixed by #1546
Open
2 tasks done

[Bug] undoable input rule #1545

ap0nia opened this issue Oct 24, 2024 · 0 comments · May be fixed by #1546
Assignees
Labels
bug Something isn't working

Comments

@ap0nia
Copy link

ap0nia commented Oct 24, 2024

Initial checklist

  • I agree to follow the code of conduct
  • I searched issues and discussions and couldn’t find anything (or linked relevant results below)

Affected packages and versions

@milkdown/[email protected] @milkdown/[email protected]

Link to runnable example

No response

Steps to reproduce

  1. Create an input rule, and pass in an object { undoable: false } as the third argument.
  2. Load the input rule as a plugin, initialize the editor as usual.
  3. Type into the editor and activate the input rule.
  4. When pressing "Backspace," undoInputRule should not trigger.

Expected behavior

If an inputrule is specified as undoable, then pressing backspace should not do undoInputRule.

Actual behavior

The code ignores the undoable option because the run function differs from the upstream prosemirror-inputrules function.

Milkdown implementation

prosemirror-inputrules implementation

The solution is simply to add the check. Inputrules are undoable by default, so this should only affect users that are explicitly disabling the feature.

if (rule.undoable) {
  tr.setMeta(plugin, { transform: tr, from, to, text })
}
view.dispatch(tr)

Runtime

Chrome

OS

Windows

Build and bundle tools

Vite

@ap0nia ap0nia added the bug Something isn't working label Oct 24, 2024
@ap0nia ap0nia linked a pull request Oct 24, 2024 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants