Print is off where it is not built; no blocked command runs from the palette (D-08)

This commit is contained in:
ZacharyZhang-NY committed 2026-10-10 02:17:18 -04:00
1 parent 58e55cf35a
commit 92b515cbf8
5 files changed
+81 -14

No files matched your search

+7 -1
View File
@@ -131,6 +131,9 @@ fn label(command: &Command, cx: &App) -> SharedString {
/// Why `id` cannot run; a document lifts the no-document block.
pub fn blocked(id: &str, document: bool, cx: &App) -> Option<SharedString> {
if id == PRINT.id && !ely_platform::print::BUILT {
return Some(i18n::text(cx, "command.blocked.unbuilt", &[]));
}
let command = RENAMING.iter().find(|command| command.id == id)?;
let key = command.blocked.filter(|_| !document)?;
Some(i18n::text(cx, key, &[]))
@@ -187,6 +190,10 @@ pub fn menus(
}
pub fn bind_keys(cx: &mut App) {
// Without a print panel, Print stays off the keyboard.
if ely_platform::print::BUILT {
cx.bind_keys([KeyBinding::new(PRINT.keys, Print, Some(CONTEXT))]);
}
cx.bind_keys([
KeyBinding::new(NEW.keys, New, Some(CONTEXT)),
KeyBinding::new(OPEN.keys, Open, Some(CONTEXT)),
@@ -194,7 +201,6 @@ pub fn bind_keys(cx: &mut App) {
KeyBinding::new(SAVE_AS.keys, SaveAs, Some(CONTEXT)),
KeyBinding::new(RENAME.keys, Rename, Some(CONTEXT)),
KeyBinding::new(EXPORT.keys, Export, Some(CONTEXT)),
KeyBinding::new(PRINT.keys, Print, Some(CONTEXT)),
KeyBinding::new("secondary-w", CloseTab, Some(CONTEXT)),
KeyBinding::new(TOGGLE_PALETTE, ToggleCommandPalette, Some(CONTEXT)),
KeyBinding::new("secondary-q", Quit, None),