This commit is contained in:
dwelle
2025-11-18 20:48:07 +01:00
parent 3ee618497c
commit 39a8bcb3a4
4 changed files with 22 additions and 8 deletions

View File

@@ -1192,7 +1192,7 @@ const ExcalidrawWrapper = () => {
</div> </div>
); );
}} }}
scrollConstraints={constraints.enabled ? constraints : undefined} // scrollConstraints={constraints.enabled ? constraints : undefined}
onLinkOpen={(element, event) => { onLinkOpen={(element, event) => {
if (element.link && isElementLink(element.link)) { if (element.link && isElementLink(element.link)) {
event.preventDefault(); event.preventDefault();
@@ -1200,12 +1200,12 @@ const ExcalidrawWrapper = () => {
} }
}} }}
> >
{excalidrawAPI && !isTestEnv() && ( {/* {excalidrawAPI && !isTestEnv() && (
<ConstraintsSettings <ConstraintsSettings
excalidrawAPI={excalidrawAPI} excalidrawAPI={excalidrawAPI}
initialConstraints={constraints} initialConstraints={constraints}
/> />
)} )} */}
<AppMainMenu <AppMainMenu
onCollabDialogOpen={onCollabDialogOpen} onCollabDialogOpen={onCollabDialogOpen}
isCollaborating={isCollaborating} isCollaborating={isCollaborating}

View File

@@ -125,7 +125,10 @@ const ExcalidrawBase = (props: ExcalidrawProps) => {
renderTopLeftUI={renderTopLeftUI} renderTopLeftUI={renderTopLeftUI}
renderTopRightUI={renderTopRightUI} renderTopRightUI={renderTopRightUI}
langCode={langCode} langCode={langCode}
viewModeEnabled={viewModeEnabled ?? !!scrollConstraints} viewModeEnabled={
viewModeEnabled ??
(scrollConstraints != null ? !!scrollConstraints : undefined)
}
zenModeEnabled={zenModeEnabled} zenModeEnabled={zenModeEnabled}
gridModeEnabled={gridModeEnabled} gridModeEnabled={gridModeEnabled}
libraryReturnUrl={libraryReturnUrl} libraryReturnUrl={libraryReturnUrl}

View File

@@ -12537,6 +12537,7 @@ exports[`history > singleplayer undo/redo > should create new history entry on e
}, },
"previousSelectedElementIds": {}, "previousSelectedElementIds": {},
"resizingElement": null, "resizingElement": null,
"scrollConstraints": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": null, "searchMatches": null,
@@ -12746,6 +12747,7 @@ exports[`history > singleplayer undo/redo > should create new history entry on e
}, },
"previousSelectedElementIds": {}, "previousSelectedElementIds": {},
"resizingElement": null, "resizingElement": null,
"scrollConstraints": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": null, "searchMatches": null,
@@ -12958,6 +12960,7 @@ exports[`history > singleplayer undo/redo > should create new history entry on i
}, },
"previousSelectedElementIds": {}, "previousSelectedElementIds": {},
"resizingElement": null, "resizingElement": null,
"scrollConstraints": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": null, "searchMatches": null,
@@ -13258,6 +13261,7 @@ exports[`history > singleplayer undo/redo > should create new history entry on i
}, },
"previousSelectedElementIds": {}, "previousSelectedElementIds": {},
"resizingElement": null, "resizingElement": null,
"scrollConstraints": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": null, "searchMatches": null,
@@ -15599,6 +15603,7 @@ exports[`history > singleplayer undo/redo > should not modify anything on unrela
}, },
"previousSelectedElementIds": {}, "previousSelectedElementIds": {},
"resizingElement": null, "resizingElement": null,
"scrollConstraints": null,
"scrollX": 0, "scrollX": 0,
"scrollY": 0, "scrollY": 0,
"searchMatches": null, "searchMatches": null,

View File

@@ -100,12 +100,18 @@ describe("contextMenu element", () => {
]; ];
expect(contextMenu).not.toBeNull(); expect(contextMenu).not.toBeNull();
expect(contextMenuOptions?.length).toBe(expectedShortcutNames.length);
expectedShortcutNames.forEach((shortcutName) => { expectedShortcutNames.forEach((shortcutName) => {
expect( try {
contextMenu?.querySelector(`li[data-testid="${shortcutName}"]`), expect(
).not.toBeNull(); contextMenu?.querySelector(`li[data-testid="${shortcutName}"]`),
).not.toBeNull();
} catch (err) {
throw new Error(
`Failed to find context menu item with test id: ${shortcutName}`,
);
}
}); });
expect(contextMenuOptions?.length).toBe(expectedShortcutNames.length);
}); });
it("shows context menu for element", () => { it("shows context menu for element", () => {