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 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(),
|
||||
|
||||
Reference in New Issue
Block a user