creating-the-diffeditor-inline-diff-example.html 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <!DOCTYPE html>
  2. <!-- THIS IS A GENERATED FILE VIA `npm run simpleserver` -->
  3. <html>
  4. <head>
  5. <base href="..">
  6. <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  7. </head>
  8. <body>
  9. <style>
  10. /*----------------------------------------SAMPLE CSS START*/
  11. /*----------------------------------------SAMPLE CSS END*/
  12. </style>
  13. <a class="loading-opts" href="playground.generated/index.html">[&lt;&lt; BACK]</a> <br/>
  14. THIS IS A GENERATED FILE VIA `npm run simpleserver`
  15. <div id="bar" style="margin-bottom: 6px;"></div>
  16. <div style="clear:both"></div>
  17. <div id="outer-container" style="width:800px;height:450px;border: 1px solid grey">
  18. <!-- ----------------------------------------SAMPLE HTML START-->
  19. <div id="container" style="height: 100%"></div>
  20. <!-- ----------------------------------------SAMPLE HTML END-->
  21. </div>
  22. <div style="clear:both"></div>
  23. <script src="../../metadata.js"></script>
  24. <script src="dev-setup.js"></script>
  25. <script>
  26. loadEditor(function() {
  27. /*----------------------------------------SAMPLE JS START*/
  28. var originalModel = monaco.editor.createModel(
  29. 'This line is removed on the right.\njust some text\nabcd\nefgh\nSome more text',
  30. 'text/plain'
  31. );
  32. var modifiedModel = monaco.editor.createModel(
  33. 'just some text\nabcz\nzzzzefgh\nSome more text\nThis line is removed on the left.',
  34. 'text/plain'
  35. );
  36. var diffEditor = monaco.editor.createDiffEditor(document.getElementById('container'), {
  37. // You can optionally disable the resizing
  38. enableSplitViewResizing: false,
  39. // Render the diff inline
  40. renderSideBySide: false
  41. });
  42. diffEditor.setModel({
  43. original: originalModel,
  44. modified: modifiedModel
  45. });
  46. /*----------------------------------------SAMPLE JS END*/
  47. });
  48. </script>
  49. </body>
  50. </html>