简体   繁体   中英

Uncaught TypeError: this.setMinHeight is not a function using TUI editor, ejs, node.js

I'm trying to use TUI editor in ejs template and nodejs .

I can't solve this problem and couldn't find any data about this. 在此处输入图像描述

I just followed the guide.

  1. add css CDN on head.
  2. create <div id="editor"></div>
  3. add <script> CDN under <div>
  4. make instance

What is the problem? Same problem happens using html not ejs . I'm going crazy.

<!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>

Seems you forgot the new keyword:

const editor = new toastui.Editor({
  el: document.querySelector('#editor'),
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM