mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-08 12:27:59 +08:00
37 lines
713 B
TypeScript
37 lines
713 B
TypeScript
import { createExtension } from '@tiptap/core'
|
|
import {
|
|
emDash,
|
|
ellipsis,
|
|
openDoubleQuote,
|
|
closeDoubleQuote,
|
|
openSingleQuote,
|
|
closeSingleQuote,
|
|
InputRule,
|
|
} from 'prosemirror-inputrules'
|
|
|
|
export const leftwardsArrow = new InputRule(/<-$/, '←')
|
|
export const rightwardsArrow = new InputRule(/->$/, '→')
|
|
|
|
const Typography = createExtension({
|
|
addInputRules() {
|
|
return [
|
|
emDash,
|
|
ellipsis,
|
|
openDoubleQuote,
|
|
closeDoubleQuote,
|
|
openSingleQuote,
|
|
closeSingleQuote,
|
|
leftwardsArrow,
|
|
rightwardsArrow,
|
|
]
|
|
},
|
|
})
|
|
|
|
export default Typography
|
|
|
|
declare module '@tiptap/core/src/Editor' {
|
|
interface AllExtensions {
|
|
Typography: typeof Typography,
|
|
}
|
|
}
|