1

我在 nuxt js 中使用tiptap vuetify 编辑器。

但它没有text-align属性!

我的组件编辑器:

<template>
    <tiptap-vuetify
      :value="value"
      :extensions="extensions"
      class="Editor"
      min-height="350"
      @input="$emit('input', arguments[0])"
    >
    </tiptap-vuetify>
</template>

<script>
    import {
      TiptapVuetify,
      Heading,
      Bold,
      Italic,
      Strike,
      Underline,
      Code,
      Image,
      Paragraph,
      BulletList,
      OrderedList,
      ListItem,
      Link,
      Blockquote,
      HardBreak,
      HorizontalRule,
      History,
      Table,
      TableCell,
      TableHeader,
      TableRow,
    } from "tiptap-vuetify";
    import FileSelector from "~/Components/FileSelector";
    import { Extension }  from "tiptap";
    
    export default {
      name: "editor",
      components: { TiptapVuetify, FileSelector },
      props: {
        value: {
          type: String,
          default: "<p>description...</p>",
        },
      },
      data: () => ({
        extensions: [
          History,
          Blockquote,
          Link,
          Underline,
          Strike,
          Italic,
          ListItem,
          BulletList,
          [
            Image,
            {
              options: {
                imageSourcesOverride: true,
                imageSources: [{ component: FileSelector, name: "upload image" }],
              },
            },
          ],
          OrderedList,
          [
            Heading,
            {
              options: {
                levels: [1, 2, 3],
              },
            },
          ],
          Bold,
          Code,
          HorizontalRule,
          [
            Table,
            {
              options: {
                resizable: true,
              },
            },
          ],
          TableCell,
          TableHeader,
          TableRow,
          Paragraph,
          HardBreak,
        ],
      }),
    };
</script>

如何为编辑器添加文本对齐?手动添加,或者作为扩展,还是通过 JavaScript?我只想textalign。还是我应该使用其他编辑器?

4

1 回答 1

0

您是否尝试过从tiptap 安装和导入TextAlign 扩展: https ://tiptap.dev/api/extensions/text-align ?

npm install '@tiptap/extension-text-align'
于 2022-02-03T14:43:11.110 回答