使用 TinyMCE-react

Using TinyMCE-react

我正在使用 tinymce-react,我正在尝试加载 modern 主题和 lightgray 皮肤。

<Editor
  initialValue="<p>This is the initial content of the editor</p>"
  init={{
    theme_url: "/themes/modern/theme.min.js",
    skin_url: "/skins/lightgray",
    height: 120,
    menubar: false,
    skin: "lightgray",
    theme: "modern",
    mobile: {
      theme: "mobile",
      plugins: ["autosave", "lists", "autolink"]
    },
    plugins: [
      "advlist autolink lists link image charmap print preview anchor",
      "searchreplace visualblocks code fullscreen",
      "insertdatetime media table contextmenu paste code"
    ],
    toolbar: "bold underline italic | bullist numlist | alignleft aligncenter alignright alignjustify | link"
  }}
/>

我在文件 theme.min.js:1 中得到 theme.min.js:1 Uncaught module [b] returned undefined

我已将文件夹 pluginsthemesskins 复制到 /public 文件夹。

有什么想法吗?

谢谢

您正在尝试加载 TinyMCE 中不再存在的皮肤。 TinyMCE 5 中的默认皮肤称为 oxide 并且没有皮肤称为 lightgray.

在大多数情况下,如果您想使用默认皮肤,则无需在配置中声明皮肤。我会尝试删除配置中对皮肤的所有引用,如果 TinyMCE 无法自行找到其皮肤(这种情况很少见),则只添加回 skinskin_url 选项。

TinyMCE 中的 theme 设置也是如此。 TinyMCE 5 中的默认主题称为 silver。编辑器也应该能够自己找到并加载它。