fix: Add multiElement-edit finalize action to Desktop (currently only visible in Mobile view) (#4764)

* add finalize action to Desktop UI

* Update LayerUI.tsx

* add size to panel component

* finzalize button style

* add finalize button

* changed isMobile to DeviceInfo, added isTouchScreen

* cleanup

* rename deviceInfo to deviceType

* rename deviceInfo to deviceType

* added updateObject

* Update App.tsx
This commit is contained in:
zsviczian 2022-03-16 15:59:30 +01:00 committed by GitHub
parent 1cfb4dfd8b
commit 192debd829
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 138 additions and 61 deletions

View file

@ -6,7 +6,6 @@ import { exportCanvas } from "../data";
import { isTextElement, showSelectedShapeActions } from "../element";
import { NonDeletedExcalidrawElement } from "../element/types";
import { Language, t } from "../i18n";
import { useIsMobile } from "../components/App";
import { calculateScrollCenter, getSelectedElements } from "../scene";
import { ExportType } from "../scene/types";
import { AppProps, AppState, ExcalidrawProps, BinaryFiles } from "../types";
@ -37,6 +36,7 @@ import { LibraryMenu } from "./LibraryMenu";
import "./LayerUI.scss";
import "./Toolbar.scss";
import { PenModeButton } from "./PenModeButton";
import { useDeviceType } from "../components/App";
interface LayerUIProps {
actionManager: ActionManager;
@ -95,7 +95,7 @@ const LayerUI = ({
id,
onImageAction,
}: LayerUIProps) => {
const isMobile = useIsMobile();
const deviceType = useDeviceType();
const renderJSONExportDialog = () => {
if (!UIOptions.canvasActions.export) {
@ -338,7 +338,7 @@ const LayerUI = ({
<HintViewer
appState={appState}
elements={elements}
isMobile={isMobile}
isMobile={deviceType.isMobile}
/>
{heading}
<Stack.Row gap={1}>
@ -389,7 +389,7 @@ const LayerUI = ({
</Tooltip>
))}
</UserList>
{renderTopRightUI?.(isMobile, appState)}
{renderTopRightUI?.(deviceType.isMobile, appState)}
</div>
</div>
</FixedSideContainer>
@ -440,6 +440,18 @@ const LayerUI = ({
</div>
</>
)}
{!viewModeEnabled &&
appState.multiElement &&
deviceType.isTouchScreen && (
<div
className={clsx("finalize-button zen-mode-transition", {
"layer-ui__wrapper__footer-left--transition-left":
zenModeEnabled,
})}
>
{actionManager.renderAction("finalize", { size: "small" })}
</div>
)}
</Section>
</Stack.Col>
</div>
@ -507,7 +519,7 @@ const LayerUI = ({
</>
);
return isMobile ? (
return deviceType.isMobile ? (
<>
{dialogs}
<MobileMenu