diff --git a/src/components/Actions.tsx b/src/components/Actions.tsx index 54c87fc7..ae4b2ae0 100644 --- a/src/components/Actions.tsx +++ b/src/components/Actions.tsx @@ -1,7 +1,8 @@ import React from "react"; +import { AppState } from "../types"; import { ExcalidrawElement } from "../element/types"; import { ActionManager } from "../actions/manager"; -import { hasBackground, hasStroke, hasText } from "../scene"; +import { hasBackground, hasStroke, hasText, getTargetElement } from "../scene"; import { t } from "../i18n"; import { SHAPES } from "../shapes"; import { ToolButton } from "./ToolButton"; @@ -11,14 +12,18 @@ import Stack from "./Stack"; import useIsMobile from "../is-mobile"; export function SelectedShapeActions({ - targetElements, + appState, + elements, renderAction, elementType, }: { - targetElements: readonly ExcalidrawElement[]; + appState: AppState; + elements: readonly ExcalidrawElement[]; renderAction: ActionManager["renderAction"]; elementType: ExcalidrawElement["type"]; }) { + const targetElements = getTargetElement(elements, appState); + const isEditing = Boolean(appState.editingElement); const isMobile = useIsMobile(); return ( @@ -62,7 +67,7 @@ export function SelectedShapeActions({ {renderAction("bringForward")} - {!isMobile && ( + {!isMobile && !isEditing && targetElements.length > 0 && (
{t("labels.actions")}
diff --git a/src/components/LayerUI.tsx b/src/components/LayerUI.tsx index 61e6ca93..1e5818f9 100644 --- a/src/components/LayerUI.tsx +++ b/src/components/LayerUI.tsx @@ -1,6 +1,6 @@ import React from "react"; import { showSelectedShapeActions } from "../element"; -import { calculateScrollCenter, getTargetElement } from "../scene"; +import { calculateScrollCenter } from "../scene"; import { exportCanvas } from "../data"; import { AppState } from "../types"; @@ -137,7 +137,8 @@ export const LayerUI = React.memo( > diff --git a/src/components/MobileMenu.tsx b/src/components/MobileMenu.tsx index fbd56f69..4d85adda 100644 --- a/src/components/MobileMenu.tsx +++ b/src/components/MobileMenu.tsx @@ -9,7 +9,7 @@ import { ExcalidrawElement } from "../element/types"; import { FixedSideContainer } from "./FixedSideContainer"; import { Island } from "./Island"; import { HintViewer } from "./HintViewer"; -import { calculateScrollCenter, getTargetElement } from "../scene"; +import { calculateScrollCenter } from "../scene"; import { SelectedShapeActions, ShapesSwitcher } from "./Actions"; import { Section } from "./Section"; import { RoomDialog } from "./RoomDialog"; @@ -110,7 +110,8 @@ export function MobileMenu({ showSelectedShapeActions(appState, elements) ? (