add italic commands

This commit is contained in:
Philipp Kühn
2020-11-17 21:49:23 +01:00
parent 3349ebf081
commit f24e8f7ee9
9 changed files with 22 additions and 10 deletions

View File

@@ -44,18 +44,30 @@ const Italic = Mark.create({
addCommands() {
return {
/**
* Set a italic mark
*/
setItalic: (): Command => ({ commands }) => {
return commands.addMark('italic')
},
/**
* Toggle an italic mark
*/
italic: (): Command => ({ commands }) => {
toggleItalic: (): Command => ({ commands }) => {
return commands.toggleMark('italic')
},
/**
* Set a italic mark
*/
unsetItalic: (): Command => ({ commands }) => {
return commands.addMark('italic')
},
}
},
addKeyboardShortcuts() {
return {
'Mod-i': () => this.editor.commands.italic(),
'Mod-i': () => this.editor.commands.toggleItalic(),
}
},