Tran Anh Minh
Tran Anh Minh

Reputation: 306

Monaco Editor: Custom Undo / Redo

I'm wondering how can we disable the default undo/redo stack and implement our own so that whenever the user press Ctrl-Z, customUndo() function is called.

I'm building a real-time code collaborator and reimplementing undo/redo action is needed.

I have been looking up the documentation and the issues page on Github but didn't find much relevant information.

Please help!

Thank you

Upvotes: 1

Views: 1547

Answers (1)

Yakov .P
Yakov .P

Reputation: 98

editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.KEY_Z, function() {
   customUndo();
});

Upvotes: 2

Related Questions