index.html 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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>AiEditor Demo</title>
  7. <script>
  8. let isDark = false;
  9. function changeTheme() {
  10. document.body.style.background = isDark ? "" : "#1a1b1e"
  11. document.querySelector("#title").style.color = isDark ? "" : "#eee"
  12. aiEditor.changeTheme();
  13. isDark = !isDark;
  14. }
  15. function changeLang() {
  16. const lang = localStorage.getItem("lang");
  17. if (!lang || lang === "zh") {
  18. aiEditor.changeLang("en");
  19. localStorage.setItem("lang", "en");
  20. } else {
  21. aiEditor.changeLang("zh");
  22. localStorage.setItem("lang", "zh");
  23. }
  24. }
  25. </script>
  26. <style>
  27. .aie-theme-light {
  28. --my-default-color: #fafafa;
  29. }
  30. .aie-theme-dark {
  31. --my-default-color: #333;
  32. }
  33. .aie-container div.default{
  34. background: var(--my-default-color);
  35. }
  36. </style>
  37. </head>
  38. <body>
  39. <div style="padding: 10px 20px;font-size: 30px" id="title">
  40. AiEditor,一个面向 AI 的下一代富文本编辑器。
  41. <a href="https://gitee.com/aieditor-team/aieditor" target="_blank">获取源码</a>
  42. <a href="https://aieditor.dev" target="_blank">访问官网</a>
  43. <button onclick="changeTheme()">切换主题</button>
  44. <button onclick="changeLang()">切换语言</button>
  45. </div>
  46. <div id="aiEditor" style="height: 450px; margin: 20px"></div>
  47. <script type="module" src="/src/main.ts"></script>
  48. </body>
  49. </html>