fix: small tweaks to shortcut hints (#10214)

This commit is contained in:
David Luzar
2025-10-20 16:57:40 +02:00
committed by GitHub
parent 8013eb5e16
commit 4e0441eeb4
2 changed files with 14 additions and 16 deletions

View File

@@ -150,11 +150,9 @@ const getHints = ({
!appState.editingTextElement && !appState.editingTextElement &&
!appState.selectedLinearElement?.isEditing !appState.selectedLinearElement?.isEditing
) { ) {
return [ return t("hints.deepBoxSelect", {
t("hints.deepBoxSelect", { shortcut: getTaggedShortcutKey("CtrlOrCmd"),
shortcut: getTaggedShortcutKey("CtrlOrCmd"), });
}),
];
} }
if (isGridModeEnabled(app) && appState.selectedElementsAreBeingDragged) { if (isGridModeEnabled(app) && appState.selectedElementsAreBeingDragged) {
@@ -164,11 +162,10 @@ const getHints = ({
} }
if (!selectedElements.length && !isMobile) { if (!selectedElements.length && !isMobile) {
return [ return t("hints.canvasPanning", {
t("hints.canvasPanning", { shortcut_1: getTaggedShortcutKey(t("keys.mmb")),
shortcut: getTaggedShortcutKey("Space"), shortcut_2: getTaggedShortcutKey("Space"),
}), });
];
} }
if (selectedElements.length === 1) { if (selectedElements.length === 1) {
@@ -202,7 +199,7 @@ const getHints = ({
shortcut: getTaggedShortcutKey("Enter"), shortcut: getTaggedShortcutKey("Enter"),
}); });
const createFlowchart = t("hints.createFlowchart", { const createFlowchart = t("hints.createFlowchart", {
shortcut: getTaggedShortcutKey("CtrlOrCmd"), shortcut: getTaggedShortcutKey(["CtrlOrCmd", "↑↓"]),
}); });
if (isFlowchartNodeElement(selectedElements[0])) { if (isFlowchartNodeElement(selectedElements[0])) {
if ( if (
@@ -243,7 +240,7 @@ export const HintViewer = ({
} }
const hint = Array.isArray(hints) const hint = Array.isArray(hints)
? hints.map((hint) => hint.replace(/\. ?$/, "")).join(". ") ? hints.map((hint) => hint.replace(/\. ?$/, "")).join(", ")
: hints; : hints;
const hintJSX = hint.split(/(<kbd>[^<]+<\/kbd>)/g).map((part, index) => { const hintJSX = hint.split(/(<kbd>[^<]+<\/kbd>)/g).map((part, index) => {

View File

@@ -338,7 +338,7 @@
}, },
"hints": { "hints": {
"dismissSearch": "{{shortcut}} to dismiss search", "dismissSearch": "{{shortcut}} to dismiss search",
"canvasPanning": "To move canvas, hold mouse wheel or {{shortcut}} while dragging, or use the hand tool", "canvasPanning": "To move canvas, hold {{shortcut_1}} or {{shortcut_2}} while dragging, or use the hand tool",
"linearElement": "Click to start multiple points, drag for single line", "linearElement": "Click to start multiple points, drag for single line",
"arrowTool": "Click to start multiple points, drag for single line. Press {{shortcut}} again to change arrow type.", "arrowTool": "Click to start multiple points, drag for single line. Press {{shortcut}} again to change arrow type.",
"freeDraw": "Click and drag, release when you're finished", "freeDraw": "Click and drag, release when you're finished",
@@ -356,8 +356,8 @@
"lineEditor_pointSelected": "Press {{shortcut_1}} to remove point(s),\n{{shortcut_2}} to duplicate, or drag to move", "lineEditor_pointSelected": "Press {{shortcut_1}} to remove point(s),\n{{shortcut_2}} to duplicate, or drag to move",
"lineEditor_nothingSelected": "Select a point to edit (hold {{shortcut_1}} to select multiple),\nor hold {{shortcut_2}} and click to add new points", "lineEditor_nothingSelected": "Select a point to edit (hold {{shortcut_1}} to select multiple),\nor hold {{shortcut_2}} and click to add new points",
"publishLibrary": "Publish your own library", "publishLibrary": "Publish your own library",
"bindTextToElement": "Press {{shortcut}} to add text", "bindTextToElement": "{{shortcut}} to add text",
"createFlowchart": "Hold {{shortcut}} and Arrow key to create a flowchart", "createFlowchart": "{{shortcut}} to create a flowchart",
"deepBoxSelect": "Hold {{shortcut}} to deep select, and to prevent dragging", "deepBoxSelect": "Hold {{shortcut}} to deep select, and to prevent dragging",
"eraserRevert": "Hold {{shortcut}} to revert the elements marked for deletion", "eraserRevert": "Hold {{shortcut}} to revert the elements marked for deletion",
"firefox_clipboard_write": "This feature can likely be enabled by setting the \"dom.events.asyncClipboard.clipboardItem\" flag to \"true\". To change the browser flags in Firefox, visit the \"about:config\" page.", "firefox_clipboard_write": "This feature can likely be enabled by setting the \"dom.events.asyncClipboard.clipboardItem\" flag to \"true\". To change the browser flags in Firefox, visit the \"about:config\" page.",
@@ -658,6 +658,7 @@
"enter": "Enter", "enter": "Enter",
"shift": "Shift", "shift": "Shift",
"spacebar": "Space", "spacebar": "Space",
"delete": "Delete" "delete": "Delete",
"mmb": "Scroll wheel"
} }
} }