Repository navigation
Description
Follow-up to #3998 (fixed by #4681). That PR made the menu bar and command palette reflect custom keybindings live; this issue tracks the one remaining surface — muya's inline format toolbar — which was intentionally left out of #4681.
Description
The inline format toolbar (the floating Bold / Italic / Underline / … bar that appears when you select text in the editor) shows keyboard-shortcut hints in its button tooltips (e.g. ⌘+B). These hints are hardcoded in the muya engine and are not synced with the user's custom keybindings, so after you change a format shortcut in Preferences → Keybindings, the toolbar tooltip keeps showing the old default while the menu bar / command palette already show the new value.
There is also a related behavior nuance: muya handles these format shortcuts internally with a hardcoded key map (FORMAT_SHORTCUTS in inlineFormatToolbar/index.ts). After rebinding a format command, the desktop unregisters the old accelerator, so the old key combo falls through to muya's internal handler and still applies the format — i.e. the old shortcut keeps working alongside the newly-assigned one.
Technical root cause
packages/muya/src/ui/inlineFormatToolbar/config.ts—COMMAND_KEY + 'B'etc. are hardcoded and rendered as the tooltiptitle(index.ts→_createIconItem). Decoupled from desktopkeybindings.json; hand-aligned to the default bindings (see 选中文字时的弹出选项快捷键和快捷键设置中的不统一 #3630).packages/muya/src/ui/inlineFormatToolbar/index.ts—FORMAT_SHORTCUTS/FORMAT_SHORTCUTS_SHIFThardcoded internal handler.
Possible fix direction (kept out of #4681 because it spans the self-contained @muyajs/core engine, whose design keeps the engine unaware of the desktop key map): give InlineFormatToolbar an optional shortcut-map option that falls back to the current hardcoded defaults (so standalone muya / examples are unaffected); the desktop builds the map from the current keybindings and passes/updates it on change. The same map can drive the internal handler so the behavior follows suit.
Steps to Reproduce
- Open Preferences → Keybindings.
- Change a format shortcut — e.g. rebind
format.strong(Bold) to a custom combo — and save. - In the editor, select some text so the inline format toolbar appears.
- Hover the Bold button and read the shortcut hint in its tooltip.
- (Behavior) Press the old default combo (e.g.
⌘B) on a selection.
Expected Behavior
- The tooltip shows the user's custom shortcut, matching the menu bar and command palette.
- Only the currently-bound shortcut applies the format.
Actual Behavior
- The tooltip still shows the hardcoded default (e.g.
⌘+B). - The old default combo still applies the format via muya's internal handler.
Screenshots / Logs
None.
Operating System
All platforms (macOS / Windows / Linux).
MarkText Version
develop (0.20.0-dev) — applies to the @muyajs/core editor engine.
OS Version
N/A (platform-independent).
Reproducibility
- I can reliably reproduce this issue
Activity
Jocs commentedon Sep 30, 2026
#2999
Jocs commentedon Oct 7, 2026
Dup with #2999