0

我正在尝试在和中使用TUI编辑ejs templatenodejs

我无法解决这个问题,也找不到任何相关数据。 在此处输入图像描述

我只是按照指南进行的。

  1. css CDN在头上。
  2. 创造<div id="editor"></div>
  3. <script> CDN在下面添加<div>
  4. 制作instance

问题是什么?html使用not也会出现同样的问题ejs。我要疯了。

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">

  <!-- Bootstrap -->
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>

  <!-- TUI editor -->
  <!-- <link rel="stylesheet" href="https://uicdn.toast.com/editor/latest/toastui-editor.css" /> -->
  <link rel="stylesheet" href="https://uicdn.toast.com/editor/latest/toastui-editor.min.css" />

  <!-- axios -->
  <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
</head>
<body>

  <div class="box write-box shadow">
    <div id="editor"></div>
    <!-- TUI editor -->
    <script src="https://uicdn.toast.com/editor/latest/toastui-editor-all.min.js"></script>
  </div>

  <!-- scripts -->
  <script>
    const editor = toastui.Editor({
      el: document.querySelector('#editor'),
    });
    

    editor.getMarkdown();
  </script>
  
  
  <script src="scripts/app.js"></script>
</body>
</html>
4

1 回答 1

1

好像忘记了new关键字:

const editor = new toastui.Editor({
  el: document.querySelector('#editor'),
});
于 2022-01-22T16:07:41.800 回答