add strike commands

This commit is contained in:
Philipp Kühn
2020-11-17 21:50:40 +01:00
parent f24e8f7ee9
commit 3ea2711aef
5 changed files with 18 additions and 6 deletions

View File

@@ -44,18 +44,30 @@ const Strike = Mark.create({
addCommands() {
return {
/**
* Set a strike mark
*/
setStrike: (): Command => ({ commands }) => {
return commands.addMark('strike')
},
/**
* Toggle a strike mark
*/
strike: (): Command => ({ commands }) => {
toggleStrike: (): Command => ({ commands }) => {
return commands.toggleMark('strike')
},
/**
* Set a strike mark
*/
unsetStrike: (): Command => ({ commands }) => {
return commands.addMark('strike')
},
}
},
addKeyboardShortcuts() {
return {
'Mod-d': () => this.editor.commands.strike(),
'Mod-d': () => this.editor.commands.toggleStrike(),
}
},