feat: Add key bindings for uppercase letters for bold, italic and underline (#2478)

This way, key bindings 'Mod-B', 'Mod-I' and 'Mod-U' with active caps
lock have the same effect as their lowercase siblings.

Prosemirror examples did the same, see ProseMirror/prosemirror#895

Fixes: #2426

Signed-off-by: Jonas <jonas@freesources.org>
This commit is contained in:
Jonas
2022-02-03 14:41:36 +01:00
committed by GitHub
parent 2fe6e2135d
commit b9bd469645
3 changed files with 3 additions and 0 deletions

View File

@@ -79,6 +79,7 @@ export const Bold = Mark.create<BoldOptions>({
addKeyboardShortcuts() { addKeyboardShortcuts() {
return { return {
'Mod-b': () => this.editor.commands.toggleBold(), 'Mod-b': () => this.editor.commands.toggleBold(),
'Mod-B': () => this.editor.commands.toggleBold(),
} }
}, },

View File

@@ -78,6 +78,7 @@ export const Italic = Mark.create<ItalicOptions>({
addKeyboardShortcuts() { addKeyboardShortcuts() {
return { return {
'Mod-i': () => this.editor.commands.toggleItalic(), 'Mod-i': () => this.editor.commands.toggleItalic(),
'Mod-I': () => this.editor.commands.toggleItalic(),
} }
}, },

View File

@@ -66,6 +66,7 @@ export const Underline = Mark.create<UnderlineOptions>({
addKeyboardShortcuts() { addKeyboardShortcuts() {
return { return {
'Mod-u': () => this.editor.commands.toggleUnderline(), 'Mod-u': () => this.editor.commands.toggleUnderline(),
'Mod-U': () => this.editor.commands.toggleUnderline(),
} }
}, },
}) })