History broken in @codemirror/view 0.19.9?

Hi, I updated @codemirror/view from 0.19.8 to 0.19.9, and I notice that now the history behaves in a wierd way.

  1. Create an application with code mirror, that has some initial value in there.
  2. Refresh the page (must be fresh)
  3. Place your cursor somewhere in the middle of the content
  4. Type two letters
  5. Press Ctrl+Z three times

you will see that letters are gone, but so are the letters to the right of it, those that were there from the begining.

Which version of @codemirror/history are you using? I’m not seeing this issue with the latest version of all packages.

False alarm, the reason for it was that I was missing “historyKeymap” added to “keymap.of()”.

For some strange reason, if I downgraded @codemirror/view to 0.19.8, the bug disappeared, and when I installed 0.19.9 it was broken back again. so I assumed it was version related bug.

But never the less, the real bug was missing historyKeymap added. Sorry to bother you.

If you remove the historyKeymap, you’ll see that on Chrome Ctrl+Z still works, but if you press it twice, it’ll eat up your letters :smiley:

Can you tell me how you added the historyKeymap? I have the exact same problem that you had.

I didn’t add the whole heymap, I just added what I needed:

import {keymap} from '@codemirror/view';
import {redo, undo} from '@codemirror/history';

const history = [
  {key: 'Ctrl-z', run: undo, shift: redo, preventDefault: true},
  {key: 'Ctrl-y', run: redo, preventDefault: true},
];

export default keymap.of(history);

and I used that as an extension to EditorState.