Merge pull request #331 from heyman/fix-toggle-comment-keybinds

Fix key bindings for toggleComment and toggleBlockComment
This commit is contained in:
Jonatan Heyman 2025-04-25 15:29:24 +02:00 committed by GitHub
commit 38a3e3f46e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 0 deletions

View File

@ -8,6 +8,7 @@ Here are the most notable changes in each release. For a more detailed list of c
- Fix issue where the second command in the command palette, instead of the first command, was selected when the palette is opened. - Fix issue where the second command in the command palette, instead of the first command, was selected when the palette is opened.
- Change name/label of some commands in the command palette, and make commands searchable using their key names as well. - Change name/label of some commands in the command palette, and make commands searchable using their key names as well.
- Fix key bindings for toggleComment and toggleBlockComment commands that were previously working.
## 2.2.0 ## 2.2.0

View File

@ -9,6 +9,7 @@ import {
simplifySelection, simplifySelection,
splitLine, splitLine,
insertNewlineAndIndent, insertNewlineAndIndent,
toggleComment, toggleBlockComment, toggleLineComment,
} from "@codemirror/commands" } from "@codemirror/commands"
import { foldCode, unfoldCode } from "@codemirror/language" import { foldCode, unfoldCode } from "@codemirror/language"
import { selectNextOccurrence } from "@codemirror/search" import { selectNextOccurrence } from "@codemirror/search"
@ -140,6 +141,9 @@ const HEYNOTE_COMMANDS = {
transposeChars: cmdLessContext(transposeChars, "Edit", "Transpose characters"), transposeChars: cmdLessContext(transposeChars, "Edit", "Transpose characters"),
insertNewlineAndIndent: cmdLessContext(insertNewlineAndIndent, "Edit", "Insert newline and indent"), insertNewlineAndIndent: cmdLessContext(insertNewlineAndIndent, "Edit", "Insert newline and indent"),
insertNewlineContinueMarkup: cmdLessContext(insertNewlineContinueMarkup, "Markdown", "Insert newline and continue todo lists/block quotes"), insertNewlineContinueMarkup: cmdLessContext(insertNewlineContinueMarkup, "Markdown", "Insert newline and continue todo lists/block quotes"),
toggleComment: cmdLessContext(toggleComment, "Edit", "Toggle comment"),
toggleBlockComment: cmdLessContext(toggleBlockComment, "Edit", "Toggle block comment"),
toggleLineComment: cmdLessContext(toggleLineComment, "Edit", "Toggle line comment"),
} }
// selection mark-mode:ify all cursor/select commands from CodeMirror // selection mark-mode:ify all cursor/select commands from CodeMirror

View File

@ -87,6 +87,9 @@ export const DEFAULT_KEYMAP = [
cmd("Alt-Shift-f", "formatBlockContent"), cmd("Alt-Shift-f", "formatBlockContent"),
cmd("Mod-/", "toggleComment"),
cmd("Alt-Shift-a", "toggleBlockComment"),
// search // search
//cmd("Mod-f", "openSearchPanel"), //cmd("Mod-f", "openSearchPanel"),
//cmd("F3", "findNext"), //cmd("F3", "findNext"),