tiptap 中文文档

Tiptap Typography 特殊符号

Tiptap Typography 排版你可以理解成输入某些字符后转换成特殊的字符,比如输入(c)会自动转换成©

Install 安装

npm install @tiptap/extension-typography

Rules 规则

types 应用到哪个mark标记上。

NameDescription
emDashConverts double dashes -- to an emdash .
ellipsisConverts three dots ... to an ellipsis character
openDoubleQuoteSmart” opening double quotes.
closeDoubleQuote“Smart closing double quotes.
openSingleQuoteSmart’ opening single quotes.
closeSingleQuote‘Smart closing single quotes.
leftArrowConverts <‐ to an arrow .
rightArrowConverts ‐> to an arrow .
copyrightConverts (c) to a copyright sign ©.
registeredTrademarkConverts (r) to registered trademark sign ®.
trademarkConverts (tm) to registered trademark sign .
servicemarkConverts (sm) to registered trademark sign .
oneHalfConverts 1/2 to one half ½.
oneQuarterConverts 1/4 to one quarter ¼.
threeQuartersConverts 3/4 to three quarters ¾.
plusMinusConverts +/- to plus/minus sign ±.
notEqualConverts != to a not equal sign .
laquoConverts << to left-pointing double angle quotation mark «.
raquoConverts >> to right-pointing double angle quotation mark ».
multiplicationConverts 2 * 3 or 2x3 to a multiplcation sign 2×3.
superscriptTwoConverts ^2 a superscript two ².
superscriptThreeConverts ^3 a superscript three ³.

源代码

typography 源代码

在线例子

vue 在线例子

typography 例子

  • Vue 例子

  • React 例子

<template>
  <editor-content :editor="editor" />
</template>
<script>
import Document from '@tiptap/extension-document'
import Paragraph from '@tiptap/extension-paragraph'
import Text from '@tiptap/extension-text'
import Typography from '@tiptap/extension-typography'
import { Editor, EditorContent } from '@tiptap/vue-3'

export default {
  components: {
    EditorContent,
  },
  data() {
    return {
      editor: null,
    }
  },
  mounted() {
    this.editor = new Editor({
      extensions: [
        Document,
        Paragraph,
        Text,
        Typography,
      ],
      content: `
        <p>“I have been suffering from Typomania all my life, a sickness that is incurable but not lethal.”</p>
        <p>— Erik Spiekermann, December 2008</p>
      `,
    })
  },
  beforeUnmount() {
    this.editor.destroy()
  },
}
</script>
import Document from '@tiptap/extension-document'
import Paragraph from '@tiptap/extension-paragraph'
import Text from '@tiptap/extension-text'
import Typography from '@tiptap/extension-typography'
import { EditorContent, useEditor } from '@tiptap/react'
import React from 'react'

export default () => {
  const editor = useEditor({
    extensions: [Document, Paragraph, Text, Typography],
    content: `
        <p>“I have been suffering from Typomania all my life, a sickness that is incurable but not lethal.”</p>
        <p>— Erik Spiekermann, December 2008</p>
      `,
  })
  return <EditorContent editor={editor} />
}
Catalog
快速入门 Guide 向导 API 列表 tiptap 方法 tiptap 属性 titap 配置 commands 命令 nodes 节点 marks 标记 extensions 扩展 Color 颜色扩展 Bubble Menu 气泡菜单 CharacterCount 文字统计 Collaboration 实时协作 CollaborationCursor 协作光标 Dropcursor 拖动光标 Floating Menu 浮动菜单 Focus 焦点扩展 FontFamily 字体 Gapcursor 空光标 History 历史记录 Placeholder 占位符 StarterKit 核心扩展 TextAlign 对齐方式 Typography 特殊符号