add AllExtensions interface

This commit is contained in:
Philipp Kühn
2020-10-22 22:40:40 +02:00
parent 79172753ef
commit 6746163dda
23 changed files with 231 additions and 180 deletions

View File

@@ -2,18 +2,10 @@ import {
Command, createMark, markInputRule, markPasteRule,
} from '@tiptap/core'
// type StrikeCommand = () => Command
// declare module '@tiptap/core/src/Editor' {
// interface Commands {
// strike: StrikeCommand,
// }
// }
export const inputRegex = /(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/gm
export const pasteRegex = /(?:^|\s)((?:~~)((?:[^~]+))(?:~~))/gm
export default createMark({
const Strike = createMark({
name: 'strike',
parseHTML() {
@@ -40,7 +32,7 @@ export default createMark({
addCommands() {
return {
strike: () => ({ commands }) => {
strike: (): Command => ({ commands }) => {
return commands.toggleMark('strike')
},
}
@@ -64,3 +56,11 @@ export default createMark({
]
},
})
export default Strike
declare module '@tiptap/core/src/Editor' {
interface AllExtensions {
Strike: typeof Strike,
}
}