From 89b34957fc50768b3f9264e741ea7d88a617b7fc Mon Sep 17 00:00:00 2001 From: Roman Malytskyy Date: Thu, 17 Oct 2024 00:02:20 +0200 Subject: [PATCH] dont show keyboard related hints when on mobile - they are misleading --- packages/excalidraw/components/HintViewer.tsx | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/packages/excalidraw/components/HintViewer.tsx b/packages/excalidraw/components/HintViewer.tsx index 934ff9005..ea32e03fa 100644 --- a/packages/excalidraw/components/HintViewer.tsx +++ b/packages/excalidraw/components/HintViewer.tsx @@ -43,10 +43,14 @@ const getHints = ({ return null; } - if (isEraserActive(appState)) { + if (isEraserActive(appState) && + !isMobile) { return t("hints.eraserRevert"); } - if (activeTool.type === "arrow" || activeTool.type === "line") { + if ( + (activeTool.type === "arrow" || activeTool.type === "line") && + !isMobile + ) { if (multiMode) { return t("hints.linearElementMulti"); } @@ -56,7 +60,7 @@ const getHints = ({ return t("hints.linearElement"); } - if (activeTool.type === "freedraw") { + if (activeTool.type === "freedraw" && !isMobile) { return t("hints.freeDraw"); } @@ -64,11 +68,15 @@ const getHints = ({ return t("hints.text"); } - if (activeTool.type === "embeddable") { + if (activeTool.type === "embeddable" && !isMobile) { return t("hints.embeddable"); } - if (appState.activeTool.type === "image" && appState.pendingImageElementId) { + if ( + appState.activeTool.type === "image" && + appState.pendingImageElementId && + !isMobile + ) { return t("hints.placeImage"); } @@ -92,11 +100,15 @@ const getHints = ({ return t("hints.rotate"); } - if (selectedElements.length === 1 && isTextElement(selectedElements[0])) { + if ( + selectedElements.length === 1 && + isTextElement(selectedElements[0]) && + !isMobile + ) { return t("hints.text_selected"); } - if (appState.editingTextElement) { + if (appState.editingTextElement && !isMobile) { return t("hints.text_editing"); } @@ -105,7 +117,8 @@ const getHints = ({ appState.selectionElement && !selectedElements.length && !appState.editingTextElement && - !appState.editingLinearElement + !appState.editingLinearElement && + !isMobile ) { return t("hints.deepBoxSelect"); } @@ -119,7 +132,7 @@ const getHints = ({ } if (selectedElements.length === 1) { - if (isLinearElement(selectedElements[0])) { + if (isLinearElement(selectedElements[0]) && !isMobile) { if (appState.editingLinearElement) { return appState.editingLinearElement.selectedPointsIndices ? t("hints.lineEditor_pointSelected") @@ -130,7 +143,8 @@ const getHints = ({ if ( !appState.newElement && !appState.selectedElementsAreBeingDragged && - isTextBindableContainer(selectedElements[0]) + isTextBindableContainer(selectedElements[0]) && + !isMobile ) { if (isFlowchartNodeElement(selectedElements[0])) { if (