index.html 2.1 KB

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