Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

88
Vistas
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
Responde la pregunta
Encuentra empleos remotos