In my angular 7 project I'm using monaco editor for the coding. If I do some change in the code and then press ctrl+z then it will undo the code, but when I do some change then I am changing the coding language after that if I press ctrl+z then it will not restore the previous code. So the issue is that after changing the coding language the previous code is not restored by pressing ctrl+z.
Please help me solve the above issue.
Use executeEdits
to apply changes while keeping the undo stack:
const myText = 'the replacement text';
// Select all text
const fullRange = editor.getModel().getFullModelRange();
// Apply the text over the range
editor.executeEdits(null, [{
text: myText,
range: fullRange
}]);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.