fix more commands

This commit is contained in:
Philipp Kühn
2020-09-22 09:08:08 +02:00
parent 655d721914
commit dcac67c61a
25 changed files with 167 additions and 182 deletions

View File

@@ -1,8 +1,10 @@
import { Mark, markInputRule, markPasteRule } from '@tiptap/core'
import { Command, Mark, markInputRule, markPasteRule } from '@tiptap/core'
export type CodeCommand = () => Command
declare module '@tiptap/core/src/Editor' {
interface Editor {
code(): Editor,
code: CodeCommand,
}
}
@@ -18,12 +20,11 @@ export default new Mark()
],
toDOM: () => ['code', 0],
}))
// .commands(({ editor, name }) => ({
// code: next => () => {
// editor.toggleMark(name)
// next()
// },
// }))
.commands(({ name }) => ({
code: () => ({ commands }) => {
return commands.toggleMark(name)
},
}))
.keys(({ editor }) => ({
'Mod-`': () => editor.code()
}))