add commands to extension manager

This commit is contained in:
Philipp Kühn
2020-04-02 14:34:07 +02:00
parent 748131637c
commit c27ebe8473
8 changed files with 62 additions and 39 deletions

View File

@@ -1,4 +1,4 @@
import { Mark, markInputRule, markPasteRule } from '@tiptap/core'
import { Mark, markInputRule, markPasteRule, CommandSpec } from '@tiptap/core'
import { toggleMark } from 'prosemirror-commands'
import { MarkSpec } from 'prosemirror-model'
import VerEx from 'verbal-expressions'
@@ -13,13 +13,6 @@ export default class Code extends Mark {
name = 'code'
created() {
this.editor.registerCommand('code', (next, { view }) => {
toggleMark(this.schemaType)(view.state, view.dispatch)
next()
})
}
schema(): MarkSpec {
return {
excludes: '_',
@@ -30,6 +23,15 @@ export default class Code extends Mark {
}
}
commands(): CommandSpec {
return {
code: (next, { view }) => {
toggleMark(this.schemaType)(view.state, view.dispatch)
next()
},
}
}
keys() {
return {
'Mod-`': () => this.editor.code(),