add bold commands
This commit is contained in:
@@ -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(),
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user