Can anyone tell me what’s wrong with this code? (pared down significantly for display):
import { history, historyKeymap } from ‘@codemirror/commands’
…
const extensions = [
…
history(),
keymap.of([
historyKeymap,
{ key: ‘Ctrl-Shift-Z’, preventDefault: true, run: redo },
]),
]
When run, this produces an error of:
Uncaught (in promise) ReferenceError: redo is not defined
The documentation seems to suggest that the “redo” state-action is added, either by the “history” extension or the “historyKeyMap”. I also tried “history.redo” and “historyKeymap.redo” with the same result.
EDIT - SOLUTION:
Ok, I’ve resolved this issue. First, I needed to import the “redo” state-action explicitly (it’s not part of anything else):
import { redo } from ‘@codemirror/commands’
Second, “Ctrl-Shift-Z” needed to be changed to “Ctrl-Shift-z”.