mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-28 15:49:23 +08:00
add typography extension
This commit is contained in:
parent
4ce0eef6c0
commit
97831ea8e5
@ -68,6 +68,7 @@
|
||||
|
||||
<script>
|
||||
import { Editor, EditorContent, defaultExtensions } from '@tiptap/vue-starter-kit'
|
||||
import Typography from '@tiptap/extension-typography'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
@ -82,7 +83,10 @@ export default {
|
||||
|
||||
mounted() {
|
||||
this.editor = new Editor({
|
||||
extensions: defaultExtensions(),
|
||||
extensions: [
|
||||
...defaultExtensions(),
|
||||
Typography(),
|
||||
],
|
||||
content: `
|
||||
<h2>
|
||||
Hi there,
|
||||
|
30
packages/extension-typography/index.ts
Normal file
30
packages/extension-typography/index.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import { createExtension } from '@tiptap/core'
|
||||
import {
|
||||
emDash,
|
||||
ellipsis,
|
||||
openDoubleQuote,
|
||||
closeDoubleQuote,
|
||||
openSingleQuote,
|
||||
closeSingleQuote,
|
||||
} from 'prosemirror-inputrules'
|
||||
|
||||
const Typography = createExtension({
|
||||
addInputRules() {
|
||||
return [
|
||||
emDash,
|
||||
ellipsis,
|
||||
openDoubleQuote,
|
||||
closeDoubleQuote,
|
||||
openSingleQuote,
|
||||
closeSingleQuote,
|
||||
]
|
||||
},
|
||||
})
|
||||
|
||||
export default Typography
|
||||
|
||||
declare module '@tiptap/core/src/Editor' {
|
||||
interface AllExtensions {
|
||||
Typography: typeof Typography,
|
||||
}
|
||||
}
|
21
packages/extension-typography/package.json
Normal file
21
packages/extension-typography/package.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "@tiptap/extension-typography",
|
||||
"version": "1.0.0",
|
||||
"source": "index.ts",
|
||||
"main": "dist/tiptap-extension-typography.js",
|
||||
"umd:main": "dist/tiptap-extension-typography.umd.js",
|
||||
"module": "dist/tiptap-extension-typography.mjs",
|
||||
"unpkg": "dist/tiptap-extension-typography.js",
|
||||
"jsdelivr": "dist/tiptap-extension-typography.js",
|
||||
"files": [
|
||||
"src",
|
||||
"dist"
|
||||
],
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "2.x"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/prosemirror-inputrules": "^1.0.3",
|
||||
"prosemirror-inputrules": "^1.1.3"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user