add bold commands

This commit is contained in:
Philipp Kühn
2020-11-17 21:47:39 +01:00
parent 0354f02842
commit 3349ebf081
13 changed files with 30 additions and 18 deletions

View File

@@ -42,18 +42,30 @@ const Bold = Mark.create({
addCommands() {
return {
/**
* Set a bold mark
*/
setBold: (): Command => ({ commands }) => {
return commands.addMark('bold')
},
/**
* Toggle a bold mark
*/
bold: (): Command => ({ commands }) => {
toggleBold: (): Command => ({ commands }) => {
return commands.toggleMark('bold')
},
/**
* Unset a bold mark
*/
unsetBold: (): Command => ({ commands }) => {
return commands.removeMark('bold')
},
}
},
addKeyboardShortcuts() {
return {
'Mod-b': () => this.editor.commands.bold(),
'Mod-b': () => this.editor.commands.toggleBold(),
}
},