tiptap/packages/extension-typography/index.ts
2020-11-05 22:50:07 +01:00

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,
}
}