Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

87
Views
Monaco Editor executeEdits does not preserve undo stack

I used this piece of code in the playground of the monaco diff editor, basically tried to call executeEdits twice, and hoping each ctrl+z would undo one change. but a single ctrl+z just made it go to the initial state. where did I do wrong please?

var originalModel = monaco.editor.createModel("heLLo world!\nabc", "text/plain");
var modifiedModel = monaco.editor.createModel("hello orlando!\n\nbbb", "text/plain");

var diffEditor = monaco.editor.createDiffEditor(document.getElementById("container"));
diffEditor.setModel({
    original: originalModel,
    modified: modifiedModel
});
setTimeout(()=>{

var op = {range:modifiedModel.getFullModelRange(), text: "claire"};
diffEditor.getModifiedEditor().executeEdits(null, [op]);},2000)


setTimeout(()=>{
var op2 = {range:modifiedModel.getFullModelRange(), text: "Paul"};
diffEditor.getModifiedEditor().executeEdits(null, [op2]);},3000)
7 months ago ยท Juan Pablo Isaza
Answer question
Find remote jobs