add commands to extension manager
This commit is contained in:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user