You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Editor.js工具在代码中无法显示,仅能使用段落功能怎么办?

Editor.js工具面板不显示的解决方法

你的代码里存在语法错误,末尾多余的闭合括号会导致EditorJS初始化失败,这就是工具面板不显示、只有段落功能的核心原因。

修正后的完整代码

import EditorJS from '@editorjs/editorjs'; 
import Header from '@editorjs/header'; 
import List from '@editorjs/list'; 

const editor = new EditorJS({ 
  /** 
   * Id of Element that should contain the Editor 
   */ 
  holder: 'editorjs', 

  /** 
   * Available Tools list. 
   * Pass Tool's class or Settings object for each Tool you want to use 
   */ 
  tools: { 
    header: {
      class: Header, 
      inlineToolbar: ['link'] 
    }, 
    list: { 
      class: List, 
      inlineToolbar: true 
    } 
  } 
});

额外检查项

  • 确认header和list工具已正确安装:执行npm install @editorjs/header @editorjs/list确保依赖安装完成
  • 检查页面中是否存在id为editorjs的DOM元素,比如:
    <div id="editorjs"></div>
    
  • 打开浏览器控制台(F12)查看是否有其他报错,比如模块导入失败、DOM节点找不到等问题

内容的提问来源于stack exchange,提问作者Isaac Shaw.

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.26 16:32:38