feat: smart typography (#360)
* build(web, deps): add `@tiptap/extension-typography` * feat(editor): add typography extension * chore(editor): disable some typographic characters * chore(editor): disable superscript
This commit is contained in:
@@ -38,6 +38,7 @@
|
|||||||
"@tiptap/extension-link": "^2.22.2",
|
"@tiptap/extension-link": "^2.22.2",
|
||||||
"@tiptap/extension-mention": "^3.0.9",
|
"@tiptap/extension-mention": "^3.0.9",
|
||||||
"@tiptap/extension-placeholder": "^2.14.0",
|
"@tiptap/extension-placeholder": "^2.14.0",
|
||||||
|
"@tiptap/extension-typography": "^3.18.0",
|
||||||
"@tiptap/pm": "^2.14.0",
|
"@tiptap/pm": "^2.14.0",
|
||||||
"@tiptap/react": "^2.14.0",
|
"@tiptap/react": "^2.14.0",
|
||||||
"@tiptap/starter-kit": "^2.14.0",
|
"@tiptap/starter-kit": "^2.14.0",
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import {
|
|||||||
ReactRenderer,
|
ReactRenderer,
|
||||||
useEditor,
|
useEditor,
|
||||||
} from "@tiptap/react";
|
} from "@tiptap/react";
|
||||||
|
import Typography from "@tiptap/extension-typography";
|
||||||
import StarterKit from "@tiptap/starter-kit";
|
import StarterKit from "@tiptap/starter-kit";
|
||||||
import Suggestion from "@tiptap/suggestion";
|
import Suggestion from "@tiptap/suggestion";
|
||||||
import {
|
import {
|
||||||
@@ -514,6 +515,17 @@ export default function Editor({
|
|||||||
return `${options.suggestion.char}${node.attrs.label ?? node.attrs.id}`;
|
return `${options.suggestion.char}${node.attrs.label ?? node.attrs.id}`;
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
Typography.configure({
|
||||||
|
openDoubleQuote: false,
|
||||||
|
closeDoubleQuote: false,
|
||||||
|
openSingleQuote: false,
|
||||||
|
closeSingleQuote: false,
|
||||||
|
oneHalf: false,
|
||||||
|
oneQuarter: false,
|
||||||
|
threeQuarters: false,
|
||||||
|
superscriptTwo: false,
|
||||||
|
superscriptThree: false,
|
||||||
|
}),
|
||||||
...(enableYouTubeEmbed ? [YouTubeNode] : []),
|
...(enableYouTubeEmbed ? [YouTubeNode] : []),
|
||||||
],
|
],
|
||||||
content,
|
content,
|
||||||
|
|||||||
12
pnpm-lock.yaml
generated
12
pnpm-lock.yaml
generated
@@ -136,6 +136,9 @@ importers:
|
|||||||
'@tiptap/extension-placeholder':
|
'@tiptap/extension-placeholder':
|
||||||
specifier: ^2.14.0
|
specifier: ^2.14.0
|
||||||
version: 2.26.1(@tiptap/core@2.26.1(@tiptap/pm@2.26.1))(@tiptap/pm@2.26.1)
|
version: 2.26.1(@tiptap/core@2.26.1(@tiptap/pm@2.26.1))(@tiptap/pm@2.26.1)
|
||||||
|
'@tiptap/extension-typography':
|
||||||
|
specifier: ^3.18.0
|
||||||
|
version: 3.18.0(@tiptap/core@2.26.1(@tiptap/pm@2.26.1))
|
||||||
'@tiptap/pm':
|
'@tiptap/pm':
|
||||||
specifier: ^2.14.0
|
specifier: ^2.14.0
|
||||||
version: 2.26.1
|
version: 2.26.1
|
||||||
@@ -3779,6 +3782,11 @@ packages:
|
|||||||
peerDependencies:
|
peerDependencies:
|
||||||
'@tiptap/core': ^2.7.0
|
'@tiptap/core': ^2.7.0
|
||||||
|
|
||||||
|
'@tiptap/extension-typography@3.18.0':
|
||||||
|
resolution: {integrity: sha512-zTNGJjhJG3lObUhhTbDC1IOyi1DCiCd6i11xsnJDPy5BODYc7t7ZP6VMOWU0LIuMsK9kX02dXoNU7OarJgLpCg==}
|
||||||
|
peerDependencies:
|
||||||
|
'@tiptap/core': ^3.18.0
|
||||||
|
|
||||||
'@tiptap/pm@2.26.1':
|
'@tiptap/pm@2.26.1':
|
||||||
resolution: {integrity: sha512-8aF+mY/vSHbGFqyG663ds84b+vca5Lge3tHdTMTKazxCnhXR9dn2oQJMnZ78YZvdRbkPkMJJHti9h3K7u2UQvw==}
|
resolution: {integrity: sha512-8aF+mY/vSHbGFqyG663ds84b+vca5Lge3tHdTMTKazxCnhXR9dn2oQJMnZ78YZvdRbkPkMJJHti9h3K7u2UQvw==}
|
||||||
|
|
||||||
@@ -11919,6 +11927,10 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@tiptap/core': 2.26.1(@tiptap/pm@2.26.1)
|
'@tiptap/core': 2.26.1(@tiptap/pm@2.26.1)
|
||||||
|
|
||||||
|
'@tiptap/extension-typography@3.18.0(@tiptap/core@2.26.1(@tiptap/pm@2.26.1))':
|
||||||
|
dependencies:
|
||||||
|
'@tiptap/core': 2.26.1(@tiptap/pm@2.26.1)
|
||||||
|
|
||||||
'@tiptap/pm@2.26.1':
|
'@tiptap/pm@2.26.1':
|
||||||
dependencies:
|
dependencies:
|
||||||
prosemirror-changeset: 2.3.1
|
prosemirror-changeset: 2.3.1
|
||||||
|
|||||||
Reference in New Issue
Block a user