index.txt 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Ace Editor Example</title>
  7. <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ace.js" type="text/javascript"></script>
  8. <style>
  9. #editor {
  10. height: 600px; /* 设置编辑器的高度 */
  11. width: 800px; /* 设置编辑器的宽度 */
  12. border: 1px solid #ddd; /* 可选边框样式 */
  13. }
  14. </style>
  15. </head>
  16. old 123655522
  17. <body>磊2111
  18. <h1>Ace Editor Example</h1>
  19. <div id="editor">console.log("Hello, World!");</div> <!-- 初始化内容 -->
  20. <script>
  21. // 创建 Ace 编辑器实例
  22. var editor = ace.edit("editor");
  23. // 设置语言
  24. editor.getSession().setMode("ace/mode/javascript");
  25. // 设置主题
  26. editor.setTheme("ace/theme/tomorrow");
  27. editor.setAutoScrollEditorIntoView(true);
  28. // 其他配置
  29. editor.setOptions({
  30. showPrintMargin: true // 不显示打印边距
  31. });
  32. </script>
  33. </body>
  34. </html>11