1
0

sample.js 913 B

123456789101112131415161718192021222324
  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(
  3. 'just some text\n\nHello World\n\nSome more text',
  4. 'text/plain'
  5. );
  6. var modifiedModel = monaco.editor.createModel(
  7. 'just some Text\n\nHello World\n\nSome more changes',
  8. 'text/plain'
  9. );
  10. var diffEditor = monaco.editor.createDiffEditor(document.getElementById('container'));
  11. diffEditor.setModel({
  12. original: originalModel,
  13. modified: modifiedModel
  14. });
  15. var navi = monaco.editor.createDiffNavigator(diffEditor, {
  16. followsCaret: true, // resets the navigator state when the user selects something in the editor
  17. ignoreCharChanges: true // jump from line to line
  18. });
  19. window.setInterval(function () {
  20. navi.next();
  21. }, 2000);