tiptap-vuetify将按钮添加到工具栏

时间:2020-02-25 16:38:10

标签: vue.js vuejs2 vue-component

我使用tiptap-vuetify编辑器,然后尝试添加tables as native extension

我添加了本项目自述文件中描述的本机扩展名:

...

<tiptap-vuetify v-model="content" :extensions="extensions" :native-extensions="nativeExtensions">
</tiptap-vuetify>     

....

nativeExtensions: [
            new Table(),
            new TableCell(),
            new TableHeader(),
            new TableRow(),
        ],

在这一点上,我知道按钮不会自动添加到工具栏,但是我不知道如何手动添加按钮。 自述文件中的示例代码对我不起作用:

<tiptap-vuetify
  v-model="content"
  :extensions="extensions"
  :toolbar-attributes="{ color: 'yellow' }"
>
  <template #toolbar="{ buttons, commands, isActive }">
    <!--You can render the buttons as you wish (you can see in the source code how this is done).-->
    <pre>{{ buttons }}</pre>
  </template>
</tiptap-vuetify>

这会产生错误,因为从不使用commandsisActive。我尝试通过添加来自the table example的类toolbar的div来解决此问题,但这还是行不通的。

如何呈现本机扩展中的按钮,包括扩展中的所有其他标准按钮?

我对此很感兴趣,因为将来我想编写自己的扩展并将按钮打印到工具栏上。

感谢帮助!

0 个答案:

没有答案