sample.js 905 B

12345678910111213141516171819
  1. // The diff editor offers a navigator to jump between changes. Once the diff is computed the <em>next()</em> and <em>previous()</em> method allow navigation. By default setting the selection in the editor manually resets the navigation state.
  2. var originalModel = monaco.editor.createModel("just some text\n\nHello World\n\nSome more text", "text/plain");
  3. var modifiedModel = monaco.editor.createModel("just some Text\n\nHello World\n\nSome more changes", "text/plain");
  4. var diffEditor = monaco.editor.createDiffEditor(document.getElementById("container"));
  5. diffEditor.setModel({
  6. original: originalModel,
  7. modified: modifiedModel
  8. });
  9. var navi = monaco.editor.createDiffNavigator(diffEditor, {
  10. followsCaret: true, // resets the navigator state when the user selects something in the editor
  11. ignoreCharChanges: true // jump from line to line
  12. });
  13. window.setInterval(function() {
  14. navi.next();
  15. }, 2000);