GhostyCHEN / wangEditor-plugin-advanced-table

3 stars 0 forks source link

从凌晨1点研究到5点,用不了,睡觉了 #2

Open zhang-yu-kun opened 5 months ago

zhang-yu-kun commented 5 months ago
import "@wangeditor/editor/dist/css/style.css"; // 引入 css
import React, { useState, useEffect } from "react";
import { Editor, Toolbar } from "@wangeditor/editor-for-react";

import { Boot } from "@wangeditor/editor";
import { menu1Conf } from "./ButtonMenu";
import pluginAdvanceTable from "plugin-advanced-table";

function MyEditor() {
  const module1 = {
    menus: [menu1Conf],
    editorPlugin: pluginAdvanceTable,
  };
  useEffect(() => {
    Boot.registerModule(module1);
  }, []);

  const [editor, setEditor] = useState(null); // JS 语法

  // 编辑器内容
  const [html, setHtml] = useState("<p>hello</p>");

  const toolbarConfig = {
    insertKeys: {
      index: 0,
      keys: ["menu1"],
    },
  };
  const editorConfig = {
    // JS 语法

    placeholder: "请输入内容...",
  };

  // 及时销毁 editor ,重要!
  useEffect(() => {
    return () => {
      if (editor == null) return;
      editor.destroy();
      setEditor(null);
    };
  }, [editor]);

引用的方式应该没错,工具栏中的都是正常,但是这个插件没办法使用 文档看了很多遍,没有说插件需要配置,只说需要注册

GhostyCHEN commented 5 months ago

这个插件我还在研究,算是刚刚开始吧