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'
// export type CodeCommand = () => Command
// declare module '@tiptap/core/src/Editor' {
// interface Commands {
// code: CodeCommand,
// }
// }
export const inputRegex = /(?:^|\s)((?:`)((?:[^`]+))(?:`))$/gm
export const pasteRegex = /(?:^|\s)((?:`)((?:[^`]+))(?:`))/gm
export default createMark({
const Code = createMark({
name: 'code',
excludes: '_',
@@ -30,7 +22,7 @@ export default createMark({
addCommands() {
return {
code: () => ({ commands }) => {
code: (): Command => ({ commands }) => {
return commands.toggleMark('code')
},
}
@@ -54,3 +46,11 @@ export default createMark({
]
},
})
export default Code
declare module '@tiptap/core/src/Editor' {
interface AllExtensions {
Code: typeof Code,
}
}