内容插件的 TinyMCE Table 似乎已禁用

TinyMCE Table of Contents plugin seems disabled

我想做的是,在我的 TinyMce 5 edior 中添加一个 Table 的内容 插件。我正在使用 React,而且我的 TinyMCE 处于反应模式。当我尝试添加其他插件时,它们可以正常工作。当我尝试将 Table of contents 插件添加到编辑器时,除了内容的 table 之外,一切看起来都很好。它是不可点击的,我认为它被禁用了。我检查了 html 代码,该项目上有 aria-diasabled: true。顺便说一句,我是 React 新手。

问题截图如下:

https://i.stack.imgur.com/iRFwq.png

这是我的代码:

<Editor
                    initialValue="<p>This is the initial content of the editor</p>"
                    init={{
                      height: 500,
                      menubar: "insert file",
                      plugins: [
                        "advlist autolink lists link image charmap print preview anchor",
                        "searchreplace visualblocks code fullscreen",
                        "insertdatetime media table paste code help wordcount",
                        "toc fullpage",
                      ],
                      toolbar:
                        // eslint-disable-next-line no-multi-str
                        "undo redo | formatselect | bold italic backcolor | \
                        alignleft aligncenter alignright alignjustify | \
                        bullist numlist outdent indent | removeformat | help\
                        toc fullpage",
                    }}
                    onEditorChange={this.handleEditorChange}
                  />

有什么解决办法吗?

我相信你误解了那个插件的作用。根据文档页面:

The toc plugin will generate a basic Table of Contents and insert it into the editor at the current cursor position. Items for the table will be taken from the headers found in the content.

如果您的内容没有标题 (h1 --> h6),则没有可用于创建目录的数据。如果您的内容有这样的标题标签,菜单选项将可用,目录将根据编辑器中的内容创建。