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 Italic extends Mark {
name = 'italic'
created() {
this.editor.registerCommand('italic', (next, { view }) => {
toggleMark(this.schemaType)(view.state, view.dispatch)
next()
})
}
schema(): MarkSpec {
return {
parseDOM: [
@@ -31,6 +24,15 @@ export default class Italic extends Mark {
}
}
commands(): CommandSpec {
return {
italic: (next, { view }) => {
toggleMark(this.schemaType)(view.state, view.dispatch)
next()
},
}
}
keys() {
return {
'Mod-i': () => this.editor.italic(),