add commands to extension manager
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Mark, markInputRule, markPasteRule } from '@tiptap/core'
|
||||
import { Mark, CommandSpec, markInputRule, markPasteRule } 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 Bold extends Mark {
|
||||
|
||||
name = 'bold'
|
||||
|
||||
created() {
|
||||
this.editor.registerCommand('bold', (next, { view }) => {
|
||||
toggleMark(this.schemaType)(view.state, view.dispatch)
|
||||
next()
|
||||
})
|
||||
}
|
||||
|
||||
schema(): MarkSpec {
|
||||
return {
|
||||
parseDOM: [
|
||||
@@ -39,6 +32,15 @@ export default class Bold extends Mark {
|
||||
}
|
||||
}
|
||||
|
||||
commands(): CommandSpec {
|
||||
return {
|
||||
bold: (next, { view }) => {
|
||||
toggleMark(this.schemaType)(view.state, view.dispatch)
|
||||
next()
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
keys() {
|
||||
return {
|
||||
'Mod-b': () => this.editor.bold(),
|
||||
|
||||
Reference in New Issue
Block a user