docstring_tokens
stringlengths
18
16.9k
code_tokens
stringlengths
75
1.81M
html_url
stringlengths
74
116
file_name
stringlengths
3
311
keep keep keep keep replace keep keep keep keep keep
<mask> }); <mask> <mask> componentDidUpdate() { <mask> if (this.state.isCollaborating && !this.socket) { <mask> this.initializeSocketClient(); <mask> } <mask> const pointerViewportCoords: { <mask> [id: string]: { x: number; y: number }; <mask> } = {}; <mask> this.state.collaborators.forEach((user, socketID) => { </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove this.setState({ isCollaborating: true, }); </s> add const initialize = () => { this.socketInitialized = true; clearTimeout(initializationTimer); if (this.state.isLoading && !this.unmounted) { this.setState({ isLoading: false }); } }; // fallback in case you're not alone in the room but still don't receive // initial SCENE_UPDATE message const initializationTimer = setTimeout(initialize, 5000); </s> remove private initializeSocketClient = () => { </s> add private initializeSocketClient = (opts: { showLoadingState: boolean }) => { </s> remove case "MOUSE_LOCATION": </s> add } case "MOUSE_LOCATION": { </s> remove const searchParams = new URLSearchParams(window.location.search); const id = searchParams.get("id"); if (id) { // Backwards compatibility with legacy url format const scene = await loadScene(id); this.syncActionResult(scene); } const jsonMatch = window.location.hash.match( /^#json=([0-9]+),([a-zA-Z0-9_-]+)$/, ); if (jsonMatch) { const scene = await loadScene(jsonMatch[1], jsonMatch[2]); this.syncActionResult(scene); return; } const roomMatch = getCollaborationLinkData(window.location.href); if (roomMatch) { this.initializeSocketClient(); return; } const scene = await loadScene(null); this.syncActionResult(scene); </s> add this.initializeScene(); </s> remove this.socketInitialized = true; </s> add initialize(); </s> add }
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/components/App.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> {}, <mask> "Excalidraw", <mask> await generateCollaborationLink(), <mask> ); <mask> this.initializeSocketClient(); <mask> }; <mask> <mask> destroyRoom = () => { <mask> window.history.pushState({}, "Excalidraw", window.location.origin); <mask> this.destroySocketClient(); </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> add private onUnload = () => { this.destroySocketClient(); this.onBlur(); }; </s> remove const searchParams = new URLSearchParams(window.location.search); const id = searchParams.get("id"); if (id) { // Backwards compatibility with legacy url format const scene = await loadScene(id); this.syncActionResult(scene); } const jsonMatch = window.location.hash.match( /^#json=([0-9]+),([a-zA-Z0-9_-]+)$/, ); if (jsonMatch) { const scene = await loadScene(jsonMatch[1], jsonMatch[2]); this.syncActionResult(scene); return; } const roomMatch = getCollaborationLinkData(window.location.href); if (roomMatch) { this.initializeSocketClient(); return; } const scene = await loadScene(null); this.syncActionResult(scene); </s> add this.initializeScene(); </s> remove public state: AppState = getDefaultAppState(); </s> add </s> add } </s> remove private initializeSocketClient = () => { </s> add private initializeSocketClient = (opts: { showLoadingState: boolean }) => { </s> remove this.initializeSocketClient(); </s> add this.initializeSocketClient({ showLoadingState: true });
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/components/App.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> this.roomKey = null; <mask> } <mask> }; <mask> <mask> private initializeSocketClient = () => { <mask> if (this.socket) { <mask> return; <mask> } <mask> const roomMatch = getCollaborationLinkData(window.location.href); <mask> if (roomMatch) { </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove this.setState({ isCollaborating: true, }); </s> add const initialize = () => { this.socketInitialized = true; clearTimeout(initializationTimer); if (this.state.isLoading && !this.unmounted) { this.setState({ isLoading: false }); } }; // fallback in case you're not alone in the room but still don't receive // initial SCENE_UPDATE message const initializationTimer = setTimeout(initialize, 5000); </s> remove const searchParams = new URLSearchParams(window.location.search); const id = searchParams.get("id"); if (id) { // Backwards compatibility with legacy url format const scene = await loadScene(id); this.syncActionResult(scene); } const jsonMatch = window.location.hash.match( /^#json=([0-9]+),([a-zA-Z0-9_-]+)$/, ); if (jsonMatch) { const scene = await loadScene(jsonMatch[1], jsonMatch[2]); this.syncActionResult(scene); return; } const roomMatch = getCollaborationLinkData(window.location.href); if (roomMatch) { this.initializeSocketClient(); return; } const scene = await loadScene(null); this.syncActionResult(scene); </s> add this.initializeScene(); </s> remove this.socketInitialized = true; </s> add initialize(); </s> remove case "MOUSE_LOCATION": </s> add } case "MOUSE_LOCATION": { </s> add } </s> add private onUnload = () => { this.destroySocketClient(); this.onBlur(); };
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/components/App.tsx
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> return; <mask> } <mask> const roomMatch = getCollaborationLinkData(window.location.href); <mask> if (roomMatch) { <mask> this.setState({ <mask> isCollaborating: true, <mask> }); <mask> this.socket = socketIOClient(SOCKET_SERVER); <mask> this.roomID = roomMatch[1]; <mask> this.roomKey = roomMatch[2]; <mask> this.socket.on("init-room", () => { <mask> this.socket && this.socket.emit("join-room", this.roomID); </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove private initializeSocketClient = () => { </s> add private initializeSocketClient = (opts: { showLoadingState: boolean }) => { </s> remove const searchParams = new URLSearchParams(window.location.search); const id = searchParams.get("id"); if (id) { // Backwards compatibility with legacy url format const scene = await loadScene(id); this.syncActionResult(scene); } const jsonMatch = window.location.hash.match( /^#json=([0-9]+),([a-zA-Z0-9_-]+)$/, ); if (jsonMatch) { const scene = await loadScene(jsonMatch[1], jsonMatch[2]); this.syncActionResult(scene); return; } const roomMatch = getCollaborationLinkData(window.location.href); if (roomMatch) { this.initializeSocketClient(); return; } const scene = await loadScene(null); this.syncActionResult(scene); </s> add this.initializeScene(); </s> remove this.initializeSocketClient(); </s> add this.initializeSocketClient({ showLoadingState: true }); </s> add this.setState({ isCollaborating: true, isLoading: opts.showLoadingState ? true : this.state.isLoading, }); </s> remove this.socketInitialized = true; </s> add initialize(); </s> remove case "SCENE_UPDATE": </s> add case "SCENE_UPDATE": {
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/components/App.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> switch (decryptedData.type) { <mask> case "INVALID_RESPONSE": <mask> return; <mask> case "SCENE_UPDATE": <mask> const { elements: remoteElements } = decryptedData.payload; <mask> const restoredState = restore(remoteElements || [], null, { <mask> scrollToContent: true, <mask> }); <mask> // Perform reconciliation - in collaboration, if we encounter </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove this.setState({ isCollaborating: true, }); </s> add const initialize = () => { this.socketInitialized = true; clearTimeout(initializationTimer); if (this.state.isLoading && !this.unmounted) { this.setState({ isLoading: false }); } }; // fallback in case you're not alone in the room but still don't receive // initial SCENE_UPDATE message const initializationTimer = setTimeout(initialize, 5000); </s> remove case "MOUSE_LOCATION": </s> add } case "MOUSE_LOCATION": { </s> remove this.socketInitialized = true; </s> add initialize(); </s> remove const searchParams = new URLSearchParams(window.location.search); const id = searchParams.get("id"); if (id) { // Backwards compatibility with legacy url format const scene = await loadScene(id); this.syncActionResult(scene); } const jsonMatch = window.location.hash.match( /^#json=([0-9]+),([a-zA-Z0-9_-]+)$/, ); if (jsonMatch) { const scene = await loadScene(jsonMatch[1], jsonMatch[2]); this.syncActionResult(scene); return; } const roomMatch = getCollaborationLinkData(window.location.href); if (roomMatch) { this.initializeSocketClient(); return; } const scene = await loadScene(null); this.syncActionResult(scene); </s> add this.initializeScene(); </s> remove private initializeSocketClient = () => { </s> add private initializeSocketClient = (opts: { showLoadingState: boolean }) => { </s> remove this.initializeSocketClient(); </s> add this.initializeSocketClient({ showLoadingState: true });
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/components/App.tsx
keep replace keep keep replace
<mask> if (this.socketInitialized === false) { <mask> this.socketInitialized = true; <mask> } <mask> break; <mask> case "MOUSE_LOCATION": </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove this.setState({ isCollaborating: true, }); </s> add const initialize = () => { this.socketInitialized = true; clearTimeout(initializationTimer); if (this.state.isLoading && !this.unmounted) { this.setState({ isLoading: false }); } }; // fallback in case you're not alone in the room but still don't receive // initial SCENE_UPDATE message const initializationTimer = setTimeout(initialize, 5000); </s> remove this.socketInitialized = true; </s> add initialize(); </s> remove case "SCENE_UPDATE": </s> add case "SCENE_UPDATE": { </s> add } </s> remove const searchParams = new URLSearchParams(window.location.search); const id = searchParams.get("id"); if (id) { // Backwards compatibility with legacy url format const scene = await loadScene(id); this.syncActionResult(scene); } const jsonMatch = window.location.hash.match( /^#json=([0-9]+),([a-zA-Z0-9_-]+)$/, ); if (jsonMatch) { const scene = await loadScene(jsonMatch[1], jsonMatch[2]); this.syncActionResult(scene); return; } const roomMatch = getCollaborationLinkData(window.location.href); if (roomMatch) { this.initializeSocketClient(); return; } const scene = await loadScene(null); this.syncActionResult(scene); </s> add this.initializeScene();
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/components/App.tsx
keep keep keep add keep keep keep keep keep
<mask> state.collaborators.set(socketID, user); <mask> return state; <mask> }); <mask> break; <mask> } <mask> }, <mask> ); <mask> this.socket.on("first-in-room", () => { <mask> if (this.socket) { </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove this.socketInitialized = true; </s> add initialize(); </s> remove case "MOUSE_LOCATION": </s> add } case "MOUSE_LOCATION": { </s> remove private initializeSocketClient = () => { </s> add private initializeSocketClient = (opts: { showLoadingState: boolean }) => { </s> remove this.initializeSocketClient(); </s> add this.initializeSocketClient({ showLoadingState: false }); </s> remove this.setState({ isCollaborating: true, }); </s> add const initialize = () => { this.socketInitialized = true; clearTimeout(initializationTimer); if (this.state.isLoading && !this.unmounted) { this.setState({ isLoading: false }); } }; // fallback in case you're not alone in the room but still don't receive // initial SCENE_UPDATE message const initializationTimer = setTimeout(initialize, 5000); </s> remove this.initializeSocketClient(); </s> add this.initializeSocketClient({ showLoadingState: true });
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/components/App.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> this.socket.on("first-in-room", () => { <mask> if (this.socket) { <mask> this.socket.off("first-in-room"); <mask> } <mask> this.socketInitialized = true; <mask> }); <mask> this.socket.on("room-user-change", (clients: string[]) => { <mask> this.setState((state) => { <mask> const collaborators: typeof state.collaborators = new Map(); <mask> for (const socketID of clients) { </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove case "MOUSE_LOCATION": </s> add } case "MOUSE_LOCATION": { </s> add } </s> remove private initializeSocketClient = () => { </s> add private initializeSocketClient = (opts: { showLoadingState: boolean }) => { </s> remove this.setState({ isCollaborating: true, }); </s> add const initialize = () => { this.socketInitialized = true; clearTimeout(initializationTimer); if (this.state.isLoading && !this.unmounted) { this.setState({ isLoading: false }); } }; // fallback in case you're not alone in the room but still don't receive // initial SCENE_UPDATE message const initializationTimer = setTimeout(initialize, 5000); </s> remove this.socketInitialized = true; </s> add initialize(); </s> remove this.initializeSocketClient(); </s> add this.initializeSocketClient({ showLoadingState: true });
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/components/App.tsx
keep keep add keep keep keep keep
<mask> this.socket.on("new-user", async (socketID: string) => { <mask> this.broadcastSceneUpdate(); <mask> }); <mask> } <mask> }; <mask> <mask> private broadcastMouseLocation = (payload: { </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> add private onUnload = () => { this.destroySocketClient(); this.onBlur(); }; </s> remove private initializeSocketClient = () => { </s> add private initializeSocketClient = (opts: { showLoadingState: boolean }) => { </s> remove private onUnload = withBatchedUpdates(() => { </s> add private onBlur = withBatchedUpdates(() => { </s> remove public state: AppState = getDefaultAppState(); </s> add </s> remove this.initializeSocketClient(); </s> add this.initializeSocketClient({ showLoadingState: true }); </s> remove this.setState({ isCollaborating: true, }); </s> add const initialize = () => { this.socketInitialized = true; clearTimeout(initializationTimer); if (this.state.isLoading && !this.unmounted) { this.setState({ isLoading: false }); } }; // fallback in case you're not alone in the room but still don't receive // initial SCENE_UPDATE message const initializationTimer = setTimeout(initialize, 5000);
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/components/App.tsx
keep keep keep keep replace replace keep keep keep keep keep
<mask> private onSceneUpdated = () => { <mask> this.setState({}); <mask> }; <mask> <mask> public state: AppState = getDefaultAppState(); <mask> <mask> private updateCurrentCursorPosition = withBatchedUpdates( <mask> (event: MouseEvent) => { <mask> cursorX = event.x; <mask> cursorY = event.y; <mask> }, </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> add private onUnload = () => { this.destroySocketClient(); this.onBlur(); }; </s> add public state: AppState = { ...getDefaultAppState(), isLoading: true, }; </s> remove private initializeSocketClient = () => { </s> add private initializeSocketClient = (opts: { showLoadingState: boolean }) => { </s> remove private onUnload = withBatchedUpdates(() => { </s> add private onBlur = withBatchedUpdates(() => { </s> add this.setState({ isCollaborating: true, isLoading: opts.showLoadingState ? true : this.state.isLoading, }); </s> remove this.setState({ isCollaborating: true, }); </s> add const initialize = () => { this.socketInitialized = true; clearTimeout(initializationTimer); if (this.state.isLoading && !this.unmounted) { this.setState({ isLoading: false }); } }; // fallback in case you're not alone in the room but still don't receive // initial SCENE_UPDATE message const initializationTimer = setTimeout(initialize, 5000);
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/components/App.tsx
keep keep add keep keep keep keep keep
<mask> import { ZoomActions, SelectedShapeActions, ShapesSwitcher } from "./Actions"; <mask> import { Section } from "./Section"; <mask> import { RoomDialog } from "./RoomDialog"; <mask> <mask> interface LayerUIProps { <mask> actionManager: ActionManager; <mask> appState: AppState; <mask> canvas: HTMLCanvasElement | null; </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> add import { LoadingMessage } from "./LoadingMessage"; </s> remove private initializeSocketClient = () => { </s> add private initializeSocketClient = (opts: { showLoadingState: boolean }) => { </s> remove case "MOUSE_LOCATION": </s> add } case "MOUSE_LOCATION": { </s> add } </s> remove this.initializeSocketClient(); </s> add this.initializeSocketClient({ showLoadingState: true }); </s> add public state: AppState = { ...getDefaultAppState(), isLoading: true, };
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/components/LayerUI.tsx
keep keep keep add keep keep keep keep
<mask> onLockToggle={onLockToggle} <mask> /> <mask> ) : ( <mask> <> <mask> <FixedSideContainer side="top"> <mask> <HintViewer appState={appState} elements={elements} /> <mask> <div className="App-menu App-menu_top"> <mask> <Stack.Col gap={4}> </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> add {appState.isLoading && <LoadingMessage />} </s> add this.setState({ isCollaborating: true, isLoading: opts.showLoadingState ? true : this.state.isLoading, }); </s> add this.setState({ isLoading: true }); </s> remove .catch((error) => console.error(error)); </s> add .catch((error) => { console.error(error); this.setState({ isLoading: false }); }); </s> remove appState, </s> add appState: { ...(appState || this.state), isLoading: false, }, </s> add "isLoading": false,
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/components/LayerUI.tsx
keep keep keep add keep keep keep keep keep keep
<mask> import { Section } from "./Section"; <mask> import { RoomDialog } from "./RoomDialog"; <mask> import { SCROLLBAR_WIDTH, SCROLLBAR_MARGIN } from "../scene/scrollbars"; <mask> import { LockIcon } from "./LockIcon"; <mask> <mask> type MobileMenuProps = { <mask> appState: AppState; <mask> actionManager: ActionManager; <mask> exportButton: React.ReactNode; <mask> setAppState: any; </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> add import { LoadingMessage } from "./LoadingMessage"; </s> remove case "MOUSE_LOCATION": </s> add } case "MOUSE_LOCATION": { </s> remove private initializeSocketClient = () => { </s> add private initializeSocketClient = (opts: { showLoadingState: boolean }) => { </s> remove this.initializeSocketClient(); </s> add this.initializeSocketClient({ showLoadingState: true }); </s> add } </s> remove const searchParams = new URLSearchParams(window.location.search); const id = searchParams.get("id"); if (id) { // Backwards compatibility with legacy url format const scene = await loadScene(id); this.syncActionResult(scene); } const jsonMatch = window.location.hash.match( /^#json=([0-9]+),([a-zA-Z0-9_-]+)$/, ); if (jsonMatch) { const scene = await loadScene(jsonMatch[1], jsonMatch[2]); this.syncActionResult(scene); return; } const roomMatch = getCollaborationLinkData(window.location.href); if (roomMatch) { this.initializeSocketClient(); return; } const scene = await loadScene(null); this.syncActionResult(scene); </s> add this.initializeScene();
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/components/MobileMenu.tsx
keep keep add keep keep keep keep
<mask> }: MobileMenuProps) { <mask> return ( <mask> <> <mask> <FixedSideContainer side="top"> <mask> <Section heading="shapes"> <mask> {(heading) => ( <mask> <Stack.Col gap={4} align="center"> </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> add {appState.isLoading && <LoadingMessage />} </s> add } </s> add isLoading: false, </s> add isLoading, </s> add private onUnload = () => { this.destroySocketClient(); this.onBlur(); }; </s> remove this.socketInitialized = true; </s> add initialize();
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/components/MobileMenu.tsx
keep keep keep add keep keep keep keep keep keep
<mask> "elementLocked": false, <mask> "elementType": "selection", <mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "mouse", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", <mask> "openMenu": null, <mask> "resizingElement": null, </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false,
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> `; <mask> <mask> exports[`regression tests alt-drag duplicates an element: [end of test] number of elements 1`] = `2`; <mask> <mask> exports[`regression tests alt-drag duplicates an element: [end of test] number of renders 1`] = `8`; <mask> <mask> exports[`regression tests arrow keys: [end of test] appState 1`] = ` <mask> Object { <mask> "collaborators": Map {}, <mask> "currentItemBackgroundColor": "transparent", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove exports[`regression tests arrow keys: [end of test] number of renders 1`] = `11`; </s> add exports[`regression tests arrow keys: [end of test] number of renders 1`] = `12`; </s> remove exports[`regression tests pinch-to-zoom works: [end of test] number of renders 1`] = `7`; </s> add exports[`regression tests pinch-to-zoom works: [end of test] number of renders 1`] = `8`; </s> remove exports[`regression tests click on an element and drag it: [end of test] number of renders 1`] = `11`; </s> add exports[`regression tests click on an element and drag it: [end of test] number of renders 1`] = `12`; </s> remove exports[`regression tests hotkey 5 selects arrow tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 5 selects arrow tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey a selects arrow tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey a selects arrow tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests click to select a shape: [end of test] number of renders 1`] = `11`; </s> add exports[`regression tests click to select a shape: [end of test] number of renders 1`] = `12`;
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep add keep keep keep keep keep
<mask> "elementType": "selection", <mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "mouse", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", <mask> "openMenu": null, </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false,
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> `; <mask> <mask> exports[`regression tests arrow keys: [end of test] number of elements 1`] = `1`; <mask> <mask> exports[`regression tests arrow keys: [end of test] number of renders 1`] = `11`; <mask> <mask> exports[`regression tests change the properties of a shape: [end of test] appState 1`] = ` <mask> Object { <mask> "collaborators": Map {}, <mask> "currentItemBackgroundColor": "#fa5252", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove exports[`regression tests change the properties of a shape: [end of test] number of renders 1`] = `9`; </s> add exports[`regression tests change the properties of a shape: [end of test] number of renders 1`] = `10`; </s> remove exports[`regression tests hotkey a selects arrow tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey a selects arrow tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests alt-drag duplicates an element: [end of test] number of renders 1`] = `8`; </s> add exports[`regression tests alt-drag duplicates an element: [end of test] number of renders 1`] = `9`; </s> remove exports[`regression tests click to select a shape: [end of test] number of renders 1`] = `11`; </s> add exports[`regression tests click to select a shape: [end of test] number of renders 1`] = `12`; </s> remove exports[`regression tests hotkey 5 selects arrow tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 5 selects arrow tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 6 selects line tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 6 selects line tool: [end of test] number of renders 1`] = `6`;
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep add keep keep keep keep
<mask> "elementType": "selection", <mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "mouse", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false,
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> `; <mask> <mask> exports[`regression tests change the properties of a shape: [end of test] number of elements 1`] = `1`; <mask> <mask> exports[`regression tests change the properties of a shape: [end of test] number of renders 1`] = `9`; <mask> <mask> exports[`regression tests click on an element and drag it: [dragged] appState 1`] = ` <mask> Object { <mask> "collaborators": Map {}, <mask> "currentItemBackgroundColor": "transparent", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove exports[`regression tests click on an element and drag it: [end of test] number of renders 1`] = `11`; </s> add exports[`regression tests click on an element and drag it: [end of test] number of renders 1`] = `12`; </s> remove exports[`regression tests click on an element and drag it: [dragged] number of renders 1`] = `8`; </s> add exports[`regression tests click on an element and drag it: [dragged] number of renders 1`] = `9`; </s> remove exports[`regression tests arrow keys: [end of test] number of renders 1`] = `11`; </s> add exports[`regression tests arrow keys: [end of test] number of renders 1`] = `12`; </s> remove exports[`regression tests click to select a shape: [end of test] number of renders 1`] = `11`; </s> add exports[`regression tests click to select a shape: [end of test] number of renders 1`] = `12`; </s> remove exports[`regression tests click-drag to select a group: [end of test] number of renders 1`] = `16`; </s> add exports[`regression tests click-drag to select a group: [end of test] number of renders 1`] = `17`; </s> remove exports[`regression tests draw every type of shape: [end of test] number of renders 1`] = `33`; </s> add exports[`regression tests draw every type of shape: [end of test] number of renders 1`] = `34`;
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep add keep keep keep keep keep keep
<mask> "elementLocked": false, <mask> "elementType": "selection", <mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "mouse", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", <mask> "openMenu": null, <mask> "resizingElement": null, </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> `; <mask> <mask> exports[`regression tests click on an element and drag it: [dragged] number of elements 1`] = `1`; <mask> <mask> exports[`regression tests click on an element and drag it: [dragged] number of renders 1`] = `8`; <mask> <mask> exports[`regression tests click on an element and drag it: [end of test] appState 1`] = ` <mask> Object { <mask> "collaborators": Map {}, <mask> "currentItemBackgroundColor": "transparent", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove exports[`regression tests click on an element and drag it: [end of test] number of renders 1`] = `11`; </s> add exports[`regression tests click on an element and drag it: [end of test] number of renders 1`] = `12`; </s> remove exports[`regression tests change the properties of a shape: [end of test] number of renders 1`] = `9`; </s> add exports[`regression tests change the properties of a shape: [end of test] number of renders 1`] = `10`; </s> remove exports[`regression tests click to select a shape: [end of test] number of renders 1`] = `11`; </s> add exports[`regression tests click to select a shape: [end of test] number of renders 1`] = `12`; </s> remove exports[`regression tests alt-drag duplicates an element: [end of test] number of renders 1`] = `8`; </s> add exports[`regression tests alt-drag duplicates an element: [end of test] number of renders 1`] = `9`; </s> remove exports[`regression tests pinch-to-zoom works: [end of test] number of renders 1`] = `7`; </s> add exports[`regression tests pinch-to-zoom works: [end of test] number of renders 1`] = `8`; </s> remove exports[`regression tests resize an element, trying every resize handle: [end of test] number of renders 1`] = `53`; </s> add exports[`regression tests resize an element, trying every resize handle: [end of test] number of renders 1`] = `54`;
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep add keep keep keep keep
<mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "mouse", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false,
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> `; <mask> <mask> exports[`regression tests click on an element and drag it: [end of test] number of elements 1`] = `1`; <mask> <mask> exports[`regression tests click on an element and drag it: [end of test] number of renders 1`] = `11`; <mask> <mask> exports[`regression tests click to select a shape: [end of test] appState 1`] = ` <mask> Object { <mask> "collaborators": Map {}, <mask> "currentItemBackgroundColor": "transparent", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove exports[`regression tests click on an element and drag it: [dragged] number of renders 1`] = `8`; </s> add exports[`regression tests click on an element and drag it: [dragged] number of renders 1`] = `9`; </s> remove exports[`regression tests change the properties of a shape: [end of test] number of renders 1`] = `9`; </s> add exports[`regression tests change the properties of a shape: [end of test] number of renders 1`] = `10`; </s> remove exports[`regression tests click to select a shape: [end of test] number of renders 1`] = `11`; </s> add exports[`regression tests click to select a shape: [end of test] number of renders 1`] = `12`; </s> remove exports[`regression tests click-drag to select a group: [end of test] number of renders 1`] = `16`; </s> add exports[`regression tests click-drag to select a group: [end of test] number of renders 1`] = `17`; </s> remove exports[`regression tests arrow keys: [end of test] number of renders 1`] = `11`; </s> add exports[`regression tests arrow keys: [end of test] number of renders 1`] = `12`; </s> remove exports[`regression tests alt-drag duplicates an element: [end of test] number of renders 1`] = `8`; </s> add exports[`regression tests alt-drag duplicates an element: [end of test] number of renders 1`] = `9`;
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep add keep keep keep keep keep
<mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "mouse", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", <mask> "openMenu": null, </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false,
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> `; <mask> <mask> exports[`regression tests click to select a shape: [end of test] number of elements 1`] = `2`; <mask> <mask> exports[`regression tests click to select a shape: [end of test] number of renders 1`] = `11`; <mask> <mask> exports[`regression tests click-drag to select a group: [end of test] appState 1`] = ` <mask> Object { <mask> "collaborators": Map {}, <mask> "currentItemBackgroundColor": "transparent", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove exports[`regression tests click-drag to select a group: [end of test] number of renders 1`] = `16`; </s> add exports[`regression tests click-drag to select a group: [end of test] number of renders 1`] = `17`; </s> remove exports[`regression tests click on an element and drag it: [end of test] number of renders 1`] = `11`; </s> add exports[`regression tests click on an element and drag it: [end of test] number of renders 1`] = `12`; </s> remove exports[`regression tests change the properties of a shape: [end of test] number of renders 1`] = `9`; </s> add exports[`regression tests change the properties of a shape: [end of test] number of renders 1`] = `10`; </s> remove exports[`regression tests arrow keys: [end of test] number of renders 1`] = `11`; </s> add exports[`regression tests arrow keys: [end of test] number of renders 1`] = `12`; </s> remove exports[`regression tests hotkey a selects arrow tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey a selects arrow tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests draw every type of shape: [end of test] number of renders 1`] = `33`; </s> add exports[`regression tests draw every type of shape: [end of test] number of renders 1`] = `34`;
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep add keep keep keep keep
<mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "mouse", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> `; <mask> <mask> exports[`regression tests click-drag to select a group: [end of test] number of elements 1`] = `3`; <mask> <mask> exports[`regression tests click-drag to select a group: [end of test] number of renders 1`] = `16`; <mask> <mask> exports[`regression tests draw every type of shape: [end of test] appState 1`] = ` <mask> Object { <mask> "collaborators": Map {}, <mask> "currentItemBackgroundColor": "transparent", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove exports[`regression tests click to select a shape: [end of test] number of renders 1`] = `11`; </s> add exports[`regression tests click to select a shape: [end of test] number of renders 1`] = `12`; </s> remove exports[`regression tests draw every type of shape: [end of test] number of renders 1`] = `33`; </s> add exports[`regression tests draw every type of shape: [end of test] number of renders 1`] = `34`; </s> remove exports[`regression tests click on an element and drag it: [end of test] number of renders 1`] = `11`; </s> add exports[`regression tests click on an element and drag it: [end of test] number of renders 1`] = `12`; </s> remove exports[`regression tests change the properties of a shape: [end of test] number of renders 1`] = `9`; </s> add exports[`regression tests change the properties of a shape: [end of test] number of renders 1`] = `10`; </s> remove exports[`regression tests arrow keys: [end of test] number of renders 1`] = `11`; </s> add exports[`regression tests arrow keys: [end of test] number of renders 1`] = `12`; </s> remove exports[`regression tests hotkey a selects arrow tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey a selects arrow tool: [end of test] number of renders 1`] = `6`;
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep add keep keep keep keep keep
<mask> "elementLocked": false, <mask> "elementType": "selection", <mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "mouse", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", <mask> "openMenu": null, </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false,
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> `; <mask> <mask> exports[`regression tests draw every type of shape: [end of test] number of elements 1`] = `5`; <mask> <mask> exports[`regression tests draw every type of shape: [end of test] number of renders 1`] = `33`; <mask> <mask> exports[`regression tests hotkey 2 selects rectangle tool: [end of test] appState 1`] = ` <mask> Object { <mask> "collaborators": Map {}, <mask> "currentItemBackgroundColor": "transparent", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove exports[`regression tests hotkey 2 selects rectangle tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 2 selects rectangle tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests click-drag to select a group: [end of test] number of renders 1`] = `16`; </s> add exports[`regression tests click-drag to select a group: [end of test] number of renders 1`] = `17`; </s> remove exports[`regression tests hotkey r selects rectangle tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey r selects rectangle tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey l selects line tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey l selects line tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 3 selects diamond tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 3 selects diamond tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 4 selects ellipse tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 4 selects ellipse tool: [end of test] number of renders 1`] = `6`;
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep add keep keep keep keep keep
<mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "mouse", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", <mask> "openMenu": null, </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> `; <mask> <mask> exports[`regression tests hotkey 2 selects rectangle tool: [end of test] number of elements 1`] = `1`; <mask> <mask> exports[`regression tests hotkey 2 selects rectangle tool: [end of test] number of renders 1`] = `5`; <mask> <mask> exports[`regression tests hotkey 3 selects diamond tool: [end of test] appState 1`] = ` <mask> Object { <mask> "collaborators": Map {}, <mask> "currentItemBackgroundColor": "transparent", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove exports[`regression tests hotkey 3 selects diamond tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 3 selects diamond tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey r selects rectangle tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey r selects rectangle tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey l selects line tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey l selects line tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey d selects diamond tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey d selects diamond tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey a selects arrow tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey a selects arrow tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 4 selects ellipse tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 4 selects ellipse tool: [end of test] number of renders 1`] = `6`;
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep add keep keep keep keep keep
<mask> "elementLocked": false, <mask> "elementType": "selection", <mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "mouse", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", <mask> "openMenu": null, </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> `; <mask> <mask> exports[`regression tests hotkey 3 selects diamond tool: [end of test] number of elements 1`] = `1`; <mask> <mask> exports[`regression tests hotkey 3 selects diamond tool: [end of test] number of renders 1`] = `5`; <mask> <mask> exports[`regression tests hotkey 4 selects ellipse tool: [end of test] appState 1`] = ` <mask> Object { <mask> "collaborators": Map {}, <mask> "currentItemBackgroundColor": "transparent", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove exports[`regression tests hotkey d selects diamond tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey d selects diamond tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 2 selects rectangle tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 2 selects rectangle tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 4 selects ellipse tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 4 selects ellipse tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey a selects arrow tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey a selects arrow tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey e selects ellipse tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey e selects ellipse tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 5 selects arrow tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 5 selects arrow tool: [end of test] number of renders 1`] = `6`;
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep add keep keep keep keep keep keep
<mask> "elementLocked": false, <mask> "elementType": "selection", <mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "mouse", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", <mask> "openMenu": null, <mask> "resizingElement": null, </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> `; <mask> <mask> exports[`regression tests hotkey 4 selects ellipse tool: [end of test] number of elements 1`] = `1`; <mask> <mask> exports[`regression tests hotkey 4 selects ellipse tool: [end of test] number of renders 1`] = `5`; <mask> <mask> exports[`regression tests hotkey 5 selects arrow tool: [end of test] appState 1`] = ` <mask> Object { <mask> "collaborators": Map {}, <mask> "currentItemBackgroundColor": "transparent", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove exports[`regression tests hotkey 3 selects diamond tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 3 selects diamond tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 5 selects arrow tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 5 selects arrow tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey e selects ellipse tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey e selects ellipse tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey d selects diamond tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey d selects diamond tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey a selects arrow tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey a selects arrow tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 6 selects line tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 6 selects line tool: [end of test] number of renders 1`] = `6`;
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep add keep keep keep keep keep
<mask> "elementLocked": false, <mask> "elementType": "selection", <mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "mouse", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", <mask> "openMenu": null, </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> `; <mask> <mask> exports[`regression tests hotkey 5 selects arrow tool: [end of test] number of elements 1`] = `1`; <mask> <mask> exports[`regression tests hotkey 5 selects arrow tool: [end of test] number of renders 1`] = `5`; <mask> <mask> exports[`regression tests hotkey 6 selects line tool: [end of test] appState 1`] = ` <mask> Object { <mask> "collaborators": Map {}, <mask> "currentItemBackgroundColor": "transparent", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove exports[`regression tests hotkey 6 selects line tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 6 selects line tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 4 selects ellipse tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 4 selects ellipse tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey a selects arrow tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey a selects arrow tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey l selects line tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey l selects line tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey e selects ellipse tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey e selects ellipse tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey d selects diamond tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey d selects diamond tool: [end of test] number of renders 1`] = `6`;
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep add keep keep keep keep keep keep
<mask> "elementType": "selection", <mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "mouse", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", <mask> "openMenu": null, <mask> "resizingElement": null, </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false,
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> `; <mask> <mask> exports[`regression tests hotkey 6 selects line tool: [end of test] number of elements 1`] = `1`; <mask> <mask> exports[`regression tests hotkey 6 selects line tool: [end of test] number of renders 1`] = `5`; <mask> <mask> exports[`regression tests hotkey a selects arrow tool: [end of test] appState 1`] = ` <mask> Object { <mask> "collaborators": Map {}, <mask> "currentItemBackgroundColor": "transparent", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove exports[`regression tests hotkey 5 selects arrow tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 5 selects arrow tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey l selects line tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey l selects line tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey a selects arrow tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey a selects arrow tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey e selects ellipse tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey e selects ellipse tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 4 selects ellipse tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 4 selects ellipse tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey d selects diamond tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey d selects diamond tool: [end of test] number of renders 1`] = `6`;
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep add keep keep keep keep keep
<mask> "elementType": "selection", <mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "mouse", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", <mask> "openMenu": null, </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> `; <mask> <mask> exports[`regression tests hotkey a selects arrow tool: [end of test] number of elements 1`] = `1`; <mask> <mask> exports[`regression tests hotkey a selects arrow tool: [end of test] number of renders 1`] = `5`; <mask> <mask> exports[`regression tests hotkey d selects diamond tool: [end of test] appState 1`] = ` <mask> Object { <mask> "collaborators": Map {}, <mask> "currentItemBackgroundColor": "transparent", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove exports[`regression tests hotkey d selects diamond tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey d selects diamond tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 6 selects line tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 6 selects line tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 5 selects arrow tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 5 selects arrow tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 3 selects diamond tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 3 selects diamond tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 4 selects ellipse tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 4 selects ellipse tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 2 selects rectangle tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 2 selects rectangle tool: [end of test] number of renders 1`] = `6`;
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep add keep keep keep keep keep keep
<mask> "elementLocked": false, <mask> "elementType": "selection", <mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "mouse", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", <mask> "openMenu": null, <mask> "resizingElement": null, </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> `; <mask> <mask> exports[`regression tests hotkey d selects diamond tool: [end of test] number of elements 1`] = `1`; <mask> <mask> exports[`regression tests hotkey d selects diamond tool: [end of test] number of renders 1`] = `5`; <mask> <mask> exports[`regression tests hotkey e selects ellipse tool: [end of test] appState 1`] = ` <mask> Object { <mask> "collaborators": Map {}, <mask> "currentItemBackgroundColor": "transparent", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove exports[`regression tests hotkey 3 selects diamond tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 3 selects diamond tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey a selects arrow tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey a selects arrow tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey e selects ellipse tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey e selects ellipse tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 2 selects rectangle tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 2 selects rectangle tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 4 selects ellipse tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 4 selects ellipse tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 5 selects arrow tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 5 selects arrow tool: [end of test] number of renders 1`] = `6`;
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep add keep keep keep keep keep keep
<mask> "elementLocked": false, <mask> "elementType": "selection", <mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "mouse", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", <mask> "openMenu": null, <mask> "resizingElement": null, </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> `; <mask> <mask> exports[`regression tests hotkey e selects ellipse tool: [end of test] number of elements 1`] = `1`; <mask> <mask> exports[`regression tests hotkey e selects ellipse tool: [end of test] number of renders 1`] = `5`; <mask> <mask> exports[`regression tests hotkey l selects line tool: [end of test] appState 1`] = ` <mask> Object { <mask> "collaborators": Map {}, <mask> "currentItemBackgroundColor": "transparent", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove exports[`regression tests hotkey d selects diamond tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey d selects diamond tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey l selects line tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey l selects line tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 4 selects ellipse tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 4 selects ellipse tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 3 selects diamond tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 3 selects diamond tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 6 selects line tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 6 selects line tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 5 selects arrow tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 5 selects arrow tool: [end of test] number of renders 1`] = `6`;
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep add keep keep keep keep keep keep
<mask> "elementType": "selection", <mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "mouse", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", <mask> "openMenu": null, <mask> "resizingElement": null, </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> `; <mask> <mask> exports[`regression tests hotkey l selects line tool: [end of test] number of elements 1`] = `1`; <mask> <mask> exports[`regression tests hotkey l selects line tool: [end of test] number of renders 1`] = `5`; <mask> <mask> exports[`regression tests hotkey r selects rectangle tool: [end of test] appState 1`] = ` <mask> Object { <mask> "collaborators": Map {}, <mask> "currentItemBackgroundColor": "transparent", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove exports[`regression tests hotkey e selects ellipse tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey e selects ellipse tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 6 selects line tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 6 selects line tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey r selects rectangle tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey r selects rectangle tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 5 selects arrow tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 5 selects arrow tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 2 selects rectangle tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 2 selects rectangle tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey d selects diamond tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey d selects diamond tool: [end of test] number of renders 1`] = `6`;
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep add keep keep keep keep
<mask> "elementLocked": false, <mask> "elementType": "selection", <mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "mouse", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false,
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> `; <mask> <mask> exports[`regression tests hotkey r selects rectangle tool: [end of test] number of elements 1`] = `1`; <mask> <mask> exports[`regression tests hotkey r selects rectangle tool: [end of test] number of renders 1`] = `5`; <mask> <mask> exports[`regression tests pinch-to-zoom works: [end of test] appState 1`] = ` <mask> Object { <mask> "collaborators": Map {}, <mask> "currentItemBackgroundColor": "transparent", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove exports[`regression tests hotkey l selects line tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey l selects line tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 2 selects rectangle tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 2 selects rectangle tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey d selects diamond tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey d selects diamond tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 3 selects diamond tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 3 selects diamond tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 4 selects ellipse tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 4 selects ellipse tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests hotkey 5 selects arrow tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey 5 selects arrow tool: [end of test] number of renders 1`] = `6`;
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep add keep keep keep keep keep keep
<mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "touch", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", <mask> "openMenu": null, <mask> "resizingElement": null, </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false,
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> `; <mask> <mask> exports[`regression tests pinch-to-zoom works: [end of test] number of elements 1`] = `0`; <mask> <mask> exports[`regression tests pinch-to-zoom works: [end of test] number of renders 1`] = `7`; <mask> <mask> exports[`regression tests resize an element, trying every resize handle: [end of test] appState 1`] = ` <mask> Object { <mask> "collaborators": Map {}, <mask> "currentItemBackgroundColor": "transparent", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove exports[`regression tests resize an element, trying every resize handle: [end of test] number of renders 1`] = `53`; </s> add exports[`regression tests resize an element, trying every resize handle: [end of test] number of renders 1`] = `54`; </s> remove exports[`regression tests hotkey r selects rectangle tool: [end of test] number of renders 1`] = `5`; </s> add exports[`regression tests hotkey r selects rectangle tool: [end of test] number of renders 1`] = `6`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle se (-5, -5)] number of renders 1`] = `44`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle se (-5, -5)] number of renders 1`] = `45`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle ne (+5, +5)] number of renders 1`] = `26`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle ne (+5, +5)] number of renders 1`] = `27`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle se (+5, +5)] number of renders 1`] = `50`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle se (+5, +5)] number of renders 1`] = `51`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle nw (-5, -5)] number of renders 1`] = `8`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle nw (-5, -5)] number of renders 1`] = `9`;
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep add keep keep keep keep keep keep
<mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "mouse", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", <mask> "openMenu": null, <mask> "resizingElement": null, </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false, </s> add "isLoading": false,
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> `; <mask> <mask> exports[`regression tests resize an element, trying every resize handle: [end of test] number of elements 1`] = `1`; <mask> <mask> exports[`regression tests resize an element, trying every resize handle: [end of test] number of renders 1`] = `53`; <mask> <mask> exports[`regression tests resize an element, trying every resize handle: [resize handle ne (+5, +5)] appState 1`] = ` <mask> Object { <mask> "collaborators": Map {}, <mask> "currentItemBackgroundColor": "transparent", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle ne (+5, +5)] number of renders 1`] = `26`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle ne (+5, +5)] number of renders 1`] = `27`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle ne (-5, -5)] number of renders 1`] = `20`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle ne (-5, -5)] number of renders 1`] = `21`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle se (+5, +5)] number of renders 1`] = `50`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle se (+5, +5)] number of renders 1`] = `51`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle nw (+5, +5)] number of renders 1`] = `14`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle nw (+5, +5)] number of renders 1`] = `15`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle nw (-5, -5)] number of renders 1`] = `8`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle nw (-5, -5)] number of renders 1`] = `9`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle se (-5, -5)] number of renders 1`] = `44`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle se (-5, -5)] number of renders 1`] = `45`;
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep add keep keep keep keep keep keep
<mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "mouse", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", <mask> "openMenu": null, <mask> "resizingElement": null, </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> `; <mask> <mask> exports[`regression tests resize an element, trying every resize handle: [resize handle ne (+5, +5)] number of elements 1`] = `1`; <mask> <mask> exports[`regression tests resize an element, trying every resize handle: [resize handle ne (+5, +5)] number of renders 1`] = `26`; <mask> <mask> exports[`regression tests resize an element, trying every resize handle: [resize handle ne (-5, -5)] appState 1`] = ` <mask> Object { <mask> "collaborators": Map {}, <mask> "currentItemBackgroundColor": "transparent", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle ne (-5, -5)] number of renders 1`] = `20`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle ne (-5, -5)] number of renders 1`] = `21`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle se (+5, +5)] number of renders 1`] = `50`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle se (+5, +5)] number of renders 1`] = `51`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle nw (+5, +5)] number of renders 1`] = `14`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle nw (+5, +5)] number of renders 1`] = `15`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle nw (-5, -5)] number of renders 1`] = `8`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle nw (-5, -5)] number of renders 1`] = `9`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle se (-5, -5)] number of renders 1`] = `44`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle se (-5, -5)] number of renders 1`] = `45`; </s> remove exports[`regression tests resize an element, trying every resize handle: [end of test] number of renders 1`] = `53`; </s> add exports[`regression tests resize an element, trying every resize handle: [end of test] number of renders 1`] = `54`;
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep add keep keep keep keep keep
<mask> "elementLocked": false, <mask> "elementType": "selection", <mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "mouse", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", <mask> "openMenu": null, </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> `; <mask> <mask> exports[`regression tests resize an element, trying every resize handle: [resize handle ne (-5, -5)] number of elements 1`] = `1`; <mask> <mask> exports[`regression tests resize an element, trying every resize handle: [resize handle ne (-5, -5)] number of renders 1`] = `20`; <mask> <mask> exports[`regression tests resize an element, trying every resize handle: [resize handle nw (+5, +5)] appState 1`] = ` <mask> Object { <mask> "collaborators": Map {}, <mask> "currentItemBackgroundColor": "transparent", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle ne (+5, +5)] number of renders 1`] = `26`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle ne (+5, +5)] number of renders 1`] = `27`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle nw (-5, -5)] number of renders 1`] = `8`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle nw (-5, -5)] number of renders 1`] = `9`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle nw (+5, +5)] number of renders 1`] = `14`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle nw (+5, +5)] number of renders 1`] = `15`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle se (-5, -5)] number of renders 1`] = `44`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle se (-5, -5)] number of renders 1`] = `45`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle se (+5, +5)] number of renders 1`] = `50`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle se (+5, +5)] number of renders 1`] = `51`; </s> remove exports[`regression tests resize an element, trying every resize handle: [end of test] number of renders 1`] = `53`; </s> add exports[`regression tests resize an element, trying every resize handle: [end of test] number of renders 1`] = `54`;
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep add keep keep keep keep
<mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "mouse", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> `; <mask> <mask> exports[`regression tests resize an element, trying every resize handle: [resize handle nw (+5, +5)] number of elements 1`] = `1`; <mask> <mask> exports[`regression tests resize an element, trying every resize handle: [resize handle nw (+5, +5)] number of renders 1`] = `14`; <mask> <mask> exports[`regression tests resize an element, trying every resize handle: [resize handle nw (-5, -5)] appState 1`] = ` <mask> Object { <mask> "collaborators": Map {}, <mask> "currentItemBackgroundColor": "transparent", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle nw (-5, -5)] number of renders 1`] = `8`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle nw (-5, -5)] number of renders 1`] = `9`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle ne (-5, -5)] number of renders 1`] = `20`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle ne (-5, -5)] number of renders 1`] = `21`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle se (+5, +5)] number of renders 1`] = `50`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle se (+5, +5)] number of renders 1`] = `51`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle ne (+5, +5)] number of renders 1`] = `26`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle ne (+5, +5)] number of renders 1`] = `27`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle se (-5, -5)] number of renders 1`] = `44`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle se (-5, -5)] number of renders 1`] = `45`; </s> remove exports[`regression tests resize an element, trying every resize handle: [end of test] number of renders 1`] = `53`; </s> add exports[`regression tests resize an element, trying every resize handle: [end of test] number of renders 1`] = `54`;
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep add keep keep keep keep keep keep
<mask> "elementType": "selection", <mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "mouse", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", <mask> "openMenu": null, <mask> "resizingElement": null, </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> `; <mask> <mask> exports[`regression tests resize an element, trying every resize handle: [resize handle nw (-5, -5)] number of elements 1`] = `1`; <mask> <mask> exports[`regression tests resize an element, trying every resize handle: [resize handle nw (-5, -5)] number of renders 1`] = `8`; <mask> <mask> exports[`regression tests resize an element, trying every resize handle: [resize handle se (+5, +5)] appState 1`] = ` <mask> Object { <mask> "collaborators": Map {}, <mask> "currentItemBackgroundColor": "transparent", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle nw (+5, +5)] number of renders 1`] = `14`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle nw (+5, +5)] number of renders 1`] = `15`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle ne (-5, -5)] number of renders 1`] = `20`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle ne (-5, -5)] number of renders 1`] = `21`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle se (-5, -5)] number of renders 1`] = `44`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle se (-5, -5)] number of renders 1`] = `45`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle se (+5, +5)] number of renders 1`] = `50`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle se (+5, +5)] number of renders 1`] = `51`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle ne (+5, +5)] number of renders 1`] = `26`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle ne (+5, +5)] number of renders 1`] = `27`; </s> remove exports[`regression tests resize an element, trying every resize handle: [end of test] number of renders 1`] = `53`; </s> add exports[`regression tests resize an element, trying every resize handle: [end of test] number of renders 1`] = `54`;
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep add keep keep keep keep keep keep
<mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "mouse", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", <mask> "openMenu": null, <mask> "resizingElement": null, </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> `; <mask> <mask> exports[`regression tests resize an element, trying every resize handle: [resize handle se (+5, +5)] number of elements 1`] = `1`; <mask> <mask> exports[`regression tests resize an element, trying every resize handle: [resize handle se (+5, +5)] number of renders 1`] = `50`; <mask> <mask> exports[`regression tests resize an element, trying every resize handle: [resize handle se (-5, -5)] appState 1`] = ` <mask> Object { <mask> "collaborators": Map {}, <mask> "currentItemBackgroundColor": "transparent", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle se (-5, -5)] number of renders 1`] = `44`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle se (-5, -5)] number of renders 1`] = `45`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle nw (-5, -5)] number of renders 1`] = `8`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle nw (-5, -5)] number of renders 1`] = `9`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle nw (+5, +5)] number of renders 1`] = `14`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle nw (+5, +5)] number of renders 1`] = `15`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle ne (+5, +5)] number of renders 1`] = `26`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle ne (+5, +5)] number of renders 1`] = `27`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle ne (-5, -5)] number of renders 1`] = `20`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle ne (-5, -5)] number of renders 1`] = `21`; </s> remove exports[`regression tests resize an element, trying every resize handle: [end of test] number of renders 1`] = `53`; </s> add exports[`regression tests resize an element, trying every resize handle: [end of test] number of renders 1`] = `54`;
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep add keep keep keep keep keep
<mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "mouse", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", <mask> "openMenu": null, </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> `; <mask> <mask> exports[`regression tests resize an element, trying every resize handle: [resize handle se (-5, -5)] number of elements 1`] = `1`; <mask> <mask> exports[`regression tests resize an element, trying every resize handle: [resize handle se (-5, -5)] number of renders 1`] = `44`; <mask> <mask> exports[`regression tests resize an element, trying every resize handle: [resize handle sw (+5, +5)] appState 1`] = ` <mask> Object { <mask> "collaborators": Map {}, <mask> "currentItemBackgroundColor": "transparent", </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle se (+5, +5)] number of renders 1`] = `50`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle se (+5, +5)] number of renders 1`] = `51`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle nw (-5, -5)] number of renders 1`] = `8`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle nw (-5, -5)] number of renders 1`] = `9`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle ne (-5, -5)] number of renders 1`] = `20`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle ne (-5, -5)] number of renders 1`] = `21`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle nw (+5, +5)] number of renders 1`] = `14`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle nw (+5, +5)] number of renders 1`] = `15`; </s> remove exports[`regression tests resize an element, trying every resize handle: [resize handle ne (+5, +5)] number of renders 1`] = `26`; </s> add exports[`regression tests resize an element, trying every resize handle: [resize handle ne (+5, +5)] number of renders 1`] = `27`; </s> remove exports[`regression tests resize an element, trying every resize handle: [end of test] number of renders 1`] = `53`; </s> add exports[`regression tests resize an element, trying every resize handle: [end of test] number of renders 1`] = `54`;
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep add keep keep keep keep keep keep
<mask> "exportBackground": true, <mask> "isCollaborating": false, <mask> "isResizing": false, <mask> "lastPointerDownWith": "mouse", <mask> "multiElement": null, <mask> "name": "excalidraw-201933152653", <mask> "openMenu": null, <mask> "resizingElement": null, </s> Add loading state (#1027) * add loading state * update snapshots * add border radius * fix comment breaking build jsx
https://github.com/excalidraw/excalidraw/commit/cac2dda5ac4b8e2bd73742cd37bf3bb67eaa83c9
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep replace replace replace replace replace replace keep keep keep replace replace replace replace keep keep keep keep
<mask> }); <mask> } else if (ret.type === MIME_TYPES.excalidrawlib) { <mask> this.library <mask> .importLibrary(file) <mask> .then(() => { <mask> this.setState({ <mask> isLoading: false, <mask> }); <mask> }) <mask> .catch((error) => { <mask> console.error(error); <mask> this.setState({ <mask> isLoading: false, <mask> errorMessage: t("errors.importLibraryError"), <mask> }); <mask> }); <mask> } <mask> } catch (error: any) { <mask> this.setState({ isLoading: false, errorMessage: error.message }); </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> add } catch (error: any) { if (error?.name === "AbortError") { console.warn(error); return; } setAppState({ errorMessage: t("errors.importLibraryError") }); } </s> remove excalidrawRef.current.updateScene(contents.data); </s> add if (contents.type === MIME_TYPES.excalidraw) { excalidrawAPI.updateScene(contents.data); } else if (contents.type === MIME_TYPES.excalidrawlib) { excalidrawAPI.updateLibrary({ libraryItems: contents.data.libraryItems, openLibraryMenu: true, }); } </s> remove onClick={() => { importLibraryFromJSON(library) .catch(muteFSAbortError) .catch((error) => { console.error(error); setAppState({ errorMessage: t("errors.importLibraryError") }); </s> add onClick={async () => { try { await fileOpen({ description: "Excalidraw library files", // ToDo: Be over-permissive until https://bugs.webkit.org/show_bug.cgi?id=34442 // gets resolved. Else, iOS users cannot open `.excalidraw` files. /* extensions: [".json", ".excalidrawlib"], */ </s> add const [pointerData, setPointerData] = useState(null); </s> add const [excalidrawAPI, setExcalidrawAPI] = useState(null); useHandleLibrary({ excalidrawAPI });
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/components/App.tsx
keep keep replace keep keep keep keep keep
<mask> import { chunk } from "lodash"; <mask> import React, { useCallback, useState } from "react"; <mask> import { importLibraryFromJSON, saveLibraryAsJSON } from "../data/json"; <mask> import Library from "../data/library"; <mask> import { ExcalidrawElement, NonDeleted } from "../element/types"; <mask> import { t } from "../i18n"; <mask> import { <mask> AppState, </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> remove import { AppState, BinaryFiles, LibraryItems, LibraryItems_v1 } from "../types"; </s> add import { AppState, BinaryFiles, LibraryItems, LibraryItems_anyVersion, } from "../types"; </s> add import { AbortError } from "../errors"; import { t } from "../i18n"; import { useEffect, useRef } from "react"; import { URL_HASH_KEYS, URL_QUERY_KEYS, APP_NAME, EVENT } from "../constants"; </s> remove import { APP_NAME, EVENT, TITLE_TIMEOUT, URL_HASH_KEYS, VERSION_TIMEOUT, } from "../constants"; </s> add import { APP_NAME, EVENT, TITLE_TIMEOUT, VERSION_TIMEOUT } from "../constants"; </s> remove import { LibraryItems, LibraryItem } from "../types"; </s> add import { LibraryItems, LibraryItem, ExcalidrawImperativeAPI, LibraryItemsSource, } from "../types"; </s> remove import { ImportedDataState } from "./types"; </s> add </s> add import { parseLibraryTokensFromUrl, useHandleLibrary } from "../data/library";
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/components/LibraryMenuItems.tsx
keep add keep keep keep keep
<mask> import { VERSIONS } from "../constants"; <mask> import Spinner from "./Spinner"; <mask> <mask> const LibraryMenuItems = ({ <mask> isLoading, <mask> libraryItems, </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> remove import { AppState, BinaryFiles, LibraryItems, LibraryItems_v1 } from "../types"; </s> add import { AppState, BinaryFiles, LibraryItems, LibraryItems_anyVersion, } from "../types"; </s> remove import { APP_NAME, EVENT, TITLE_TIMEOUT, URL_HASH_KEYS, VERSION_TIMEOUT, } from "../constants"; </s> add import { APP_NAME, EVENT, TITLE_TIMEOUT, VERSION_TIMEOUT } from "../constants"; </s> add import { AbortError } from "../errors"; import { t } from "../i18n"; import { useEffect, useRef } from "react"; import { URL_HASH_KEYS, URL_QUERY_KEYS, APP_NAME, EVENT } from "../constants"; </s> remove import { ImportedDataState } from "./types"; </s> add </s> add import { parseLibraryTokensFromUrl, useHandleLibrary } from "../data/library"; </s> remove import { LibraryItems, LibraryItem } from "../types"; </s> add import { LibraryItems, LibraryItem, ExcalidrawImperativeAPI, LibraryItemsSource, } from "../types";
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/components/LibraryMenuItems.tsx
keep keep keep keep replace replace replace replace replace replace keep keep keep keep keep
<mask> type="button" <mask> title={t("buttons.load")} <mask> aria-label={t("buttons.load")} <mask> icon={load} <mask> onClick={() => { <mask> importLibraryFromJSON(library) <mask> .catch(muteFSAbortError) <mask> .catch((error) => { <mask> console.error(error); <mask> setAppState({ errorMessage: t("errors.importLibraryError") }); <mask> }); <mask> }} <mask> className="library-actions--load" <mask> /> <mask> )} </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> add } catch (error: any) { if (error?.name === "AbortError") { console.warn(error); return; } setAppState({ errorMessage: t("errors.importLibraryError") }); } </s> remove this.setState({ isLoading: false, errorMessage: t("errors.importLibraryError"), }); </s> add this.setState({ errorMessage: t("errors.importLibraryError") }); </s> remove this.library .importLibrary(file) .then(() => { this.setState({ isLoading: false, }); </s> add await this.library .updateLibrary({ libraryItems: file, merge: true, openLibraryMenu: true, </s> remove excalidrawRef.current.resetScene(); </s> add excalidrawAPI.resetScene(); </s> remove excalidrawRef.current.updateScene({ </s> add excalidrawAPI.updateLibrary({ </s> remove ref={excalidrawRef} </s> add ref={(api) => setExcalidrawAPI(api)}
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/components/LibraryMenuItems.tsx
keep add keep keep keep keep
<mask> */ <mask> }); <mask> }} <mask> className="library-actions--load" <mask> /> <mask> )} </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> remove onClick={() => { importLibraryFromJSON(library) .catch(muteFSAbortError) .catch((error) => { console.error(error); setAppState({ errorMessage: t("errors.importLibraryError") }); </s> add onClick={async () => { try { await fileOpen({ description: "Excalidraw library files", // ToDo: Be over-permissive until https://bugs.webkit.org/show_bug.cgi?id=34442 // gets resolved. Else, iOS users cannot open `.excalidraw` files. /* extensions: [".json", ".excalidrawlib"], */ </s> remove excalidrawRef.current.setCustomType("comment"); </s> add excalidrawAPI.setActiveTool({ type: "custom", customType: "comment", }); </s> remove excalidrawRef.current.updateScene({ </s> add excalidrawAPI.updateScene({ </s> remove export type LibraryItems_v1 = readonly LibraryItem_v1[]; </s> add type LibraryItems_v1 = readonly LibraryItem_v1[]; </s> remove files: excalidrawRef.current.getFiles(), </s> add files: excalidrawAPI.getFiles(), </s> remove data.scene.libraryItems = getLibraryItemsFromStorage(); </s> add
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/components/LibraryMenuItems.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> ImportedDataState, <mask> ExportedLibraryData, <mask> ImportedLibraryData, <mask> } from "./types"; <mask> import Library from "./library"; <mask> <mask> /** <mask> * Strips out files which are only referenced by deleted elements <mask> */ <mask> const filterOutDeletedFiles = ( </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> remove import { ImportedDataState } from "./types"; </s> add </s> remove import { importLibraryFromJSON, saveLibraryAsJSON } from "../data/json"; </s> add import { saveLibraryAsJSON } from "../data/json"; </s> remove import { LibraryItems, LibraryItem } from "../types"; </s> add import { LibraryItems, LibraryItem, ExcalidrawImperativeAPI, LibraryItemsSource, } from "../types"; </s> add import { fileOpen } from "../data/filesystem"; </s> add import { parseLibraryTokensFromUrl, useHandleLibrary } from "../data/library"; </s> add import { AbortError } from "../errors"; import { t } from "../i18n"; import { useEffect, useRef } from "react"; import { URL_HASH_KEYS, URL_QUERY_KEYS, APP_NAME, EVENT } from "../constants";
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/data/json.ts
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace
<mask> description: "Excalidraw library file", <mask> }, <mask> ); <mask> }; <mask> <mask> export const importLibraryFromJSON = async (library: Library) => { <mask> const blob = await fileOpen({ <mask> description: "Excalidraw library files", <mask> // ToDo: Be over-permissive until https://bugs.webkit.org/show_bug.cgi?id=34442 <mask> // gets resolved. Else, iOS users cannot open `.excalidraw` files. <mask> /* <mask> extensions: [".json", ".excalidrawlib"], <mask> */ <mask> }); <mask> await library.importLibrary(blob); <mask> }; </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> remove onClick={() => { importLibraryFromJSON(library) .catch(muteFSAbortError) .catch((error) => { console.error(error); setAppState({ errorMessage: t("errors.importLibraryError") }); </s> add onClick={async () => { try { await fileOpen({ description: "Excalidraw library files", // ToDo: Be over-permissive until https://bugs.webkit.org/show_bug.cgi?id=34442 // gets resolved. Else, iOS users cannot open `.excalidraw` files. /* extensions: [".json", ".excalidrawlib"], */ </s> remove excalidrawRef.current.updateScene(contents.data); </s> add if (contents.type === MIME_TYPES.excalidraw) { excalidrawAPI.updateScene(contents.data); } else if (contents.type === MIME_TYPES.excalidrawlib) { excalidrawAPI.updateLibrary({ libraryItems: contents.data.libraryItems, openLibraryMenu: true, }); } </s> remove const onHashChange = (event: HashChangeEvent) => { </s> add const onHashChange = async (event: HashChangeEvent) => { </s> remove data.scene.libraryItems = getLibraryItemsFromStorage(); </s> add </s> add if (!excalidrawAPI) { return; } </s> remove const hash = new URLSearchParams(window.location.hash.slice(1)); const libraryUrl = hash.get(URL_HASH_KEYS.addLibrary); if (libraryUrl) { // If hash changed and it contains library url, import it and replace // the url to its previous state (important in case of collaboration // and similar). // Using history API won't trigger another hashchange. window.history.replaceState({}, "", event.oldURL); excalidrawAPI.importLibrary(libraryUrl, hash.get("token")); } else { </s> add const libraryUrlTokens = parseLibraryTokensFromUrl(); if (!libraryUrlTokens) {
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/data/json.ts
keep replace keep keep replace keep keep
<mask> import { loadLibraryFromBlob } from "./blob"; <mask> import { LibraryItems, LibraryItem } from "../types"; <mask> import { restoreLibraryItems } from "./restore"; <mask> import type App from "../components/App"; <mask> import { ImportedDataState } from "./types"; <mask> import { atom } from "jotai"; <mask> import { jotaiStore } from "../jotai"; </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> add import { AbortError } from "../errors"; import { t } from "../i18n"; import { useEffect, useRef } from "react"; import { URL_HASH_KEYS, URL_QUERY_KEYS, APP_NAME, EVENT } from "../constants"; </s> remove import { AppState, BinaryFiles, LibraryItems, LibraryItems_v1 } from "../types"; </s> add import { AppState, BinaryFiles, LibraryItems, LibraryItems_anyVersion, } from "../types"; </s> remove import { importLibraryFromJSON, saveLibraryAsJSON } from "../data/json"; </s> add import { saveLibraryAsJSON } from "../data/json"; </s> remove import { APP_NAME, EVENT, TITLE_TIMEOUT, URL_HASH_KEYS, VERSION_TIMEOUT, } from "../constants"; </s> add import { APP_NAME, EVENT, TITLE_TIMEOUT, VERSION_TIMEOUT } from "../constants"; </s> add import { fileOpen } from "../data/filesystem";
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/data/library.ts
keep keep keep add keep keep keep keep keep keep
<mask> import { restoreLibraryItems } from "./restore"; <mask> import type App from "../components/App"; <mask> import { atom } from "jotai"; <mask> import { jotaiStore } from "../jotai"; <mask> <mask> export const libraryItemsAtom = atom<{ <mask> status: "loading" | "loaded"; <mask> isInitialized: boolean; <mask> libraryItems: LibraryItems; <mask> }>({ status: "loaded", isInitialized: true, libraryItems: [] }); </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> remove import { ImportedDataState } from "./types"; </s> add </s> remove import { LibraryItems, LibraryItem } from "../types"; </s> add import { LibraryItems, LibraryItem, ExcalidrawImperativeAPI, LibraryItemsSource, } from "../types"; </s> remove import { AppState, BinaryFiles, LibraryItems, LibraryItems_v1 } from "../types"; </s> add import { AppState, BinaryFiles, LibraryItems, LibraryItems_anyVersion, } from "../types"; </s> remove import { importLibraryFromJSON, saveLibraryAsJSON } from "../data/json"; </s> add import { saveLibraryAsJSON } from "../data/json"; </s> remove import { APP_NAME, EVENT, TITLE_TIMEOUT, URL_HASH_KEYS, VERSION_TIMEOUT, } from "../constants"; </s> add import { APP_NAME, EVENT, TITLE_TIMEOUT, VERSION_TIMEOUT } from "../constants"; </s> add import { fileOpen } from "../data/filesystem";
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/data/library.ts
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> resetLibrary = () => { <mask> return this.setLibrary([]); <mask> }; <mask> <mask> /** <mask> * imports library (from blob or libraryItems), merging with current library <mask> * (attempting to remove duplicates) <mask> */ <mask> importLibrary( <mask> library: <mask> | Blob <mask> | Required<ImportedDataState>["libraryItems"] <mask> | Promise<Required<ImportedDataState>["libraryItems"]>, <mask> defaultStatus: LibraryItem["status"] = "unpublished", <mask> ): Promise<LibraryItems> { <mask> return this.setLibrary( <mask> () => <mask> new Promise<LibraryItems>(async (resolve, reject) => { <mask> try { <mask> let libraryItems: LibraryItems; <mask> if (library instanceof Blob) { <mask> libraryItems = await loadLibraryFromBlob(library, defaultStatus); <mask> } else { <mask> libraryItems = restoreLibraryItems(await library, defaultStatus); <mask> } <mask> <mask> resolve(mergeLibraryItems(this.lastLibraryItems, libraryItems)); <mask> } catch (error) { <mask> reject(error); <mask> } <mask> }), <mask> ); <mask> } <mask> <mask> /** <mask> * @returns latest cloned libraryItems. Awaits all in-progress updates first. <mask> */ <mask> getLatestLibrary = (): Promise<LibraryItems> => { <mask> return new Promise(async (resolve) => { </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> remove const onHashChange = () => { const hash = new URLSearchParams(window.location.hash.slice(1)); const libraryUrl = hash.get("addLibrary"); if (libraryUrl) { excalidrawRef.current.importLibrary(libraryUrl, hash.get("token")); } }; window.addEventListener("hashchange", onHashChange, false); return () => { window.removeEventListener("hashchange", onHashChange); }; }, []); </s> add </s> remove excalidrawRef.current.updateScene(contents.data); </s> add if (contents.type === MIME_TYPES.excalidraw) { excalidrawAPI.updateScene(contents.data); } else if (contents.type === MIME_TYPES.excalidrawlib) { excalidrawAPI.updateLibrary({ libraryItems: contents.data.libraryItems, openLibraryMenu: true, }); } </s> remove const appState = excalidrawRef.current.getAppState(); </s> add const appState = excalidrawAPI.getAppState(); </s> add if (!excalidrawAPI) { return; } </s> remove excalidrawRef.current.getAppState(), </s> add excalidrawAPI.getAppState(), </s> remove excalidrawRef.current.getAppState(), </s> add excalidrawAPI.getAppState(),
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/data/library.ts
keep replace keep keep keep keep keep
<mask> import { ExcalidrawElement } from "../element/types"; <mask> import { AppState, BinaryFiles, LibraryItems, LibraryItems_v1 } from "../types"; <mask> import type { cleanAppStateForExport } from "../appState"; <mask> import { VERSIONS } from "../constants"; <mask> <mask> export interface ExportedDataState { <mask> type: string; </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> remove import { LibraryItems, LibraryItem } from "../types"; </s> add import { LibraryItems, LibraryItem, ExcalidrawImperativeAPI, LibraryItemsSource, } from "../types"; </s> remove import { ImportedDataState } from "./types"; </s> add </s> remove import { importLibraryFromJSON, saveLibraryAsJSON } from "../data/json"; </s> add import { saveLibraryAsJSON } from "../data/json"; </s> remove import { APP_NAME, EVENT, TITLE_TIMEOUT, URL_HASH_KEYS, VERSION_TIMEOUT, } from "../constants"; </s> add import { APP_NAME, EVENT, TITLE_TIMEOUT, VERSION_TIMEOUT } from "../constants"; </s> add import { fileOpen } from "../data/filesystem"; </s> add import { AbortError } from "../errors"; import { t } from "../i18n"; import { useEffect, useRef } from "react"; import { URL_HASH_KEYS, URL_QUERY_KEYS, APP_NAME, EVENT } from "../constants";
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/data/types.ts
keep keep keep keep replace keep keep keep keep keep
<mask> source?: string; <mask> elements?: readonly ExcalidrawElement[] | null; <mask> appState?: Readonly<Partial<AppState>> | null; <mask> scrollToContent?: boolean; <mask> libraryItems?: LibraryItems | LibraryItems_v1; <mask> files?: BinaryFiles; <mask> } <mask> <mask> export interface ExportedLibraryData { <mask> type: string; </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> remove libraryItems?: LibraryItems | LibraryItems_v1; </s> add </s> add export type LibraryItems_anyVersion = LibraryItems | LibraryItems_v1; export type LibraryItemsSource = | (( currentLibraryItems: LibraryItems, ) => | Blob | LibraryItems_anyVersion | Promise<LibraryItems_anyVersion | Blob>) | Blob | LibraryItems_anyVersion | Promise<LibraryItems_anyVersion | Blob>; </s> remove export type LibraryItems_v1 = readonly LibraryItem_v1[]; </s> add type LibraryItems_v1 = readonly LibraryItem_v1[]; </s> remove import { AppState, BinaryFiles, LibraryItems, LibraryItems_v1 } from "../types"; </s> add import { AppState, BinaryFiles, LibraryItems, LibraryItems_anyVersion, } from "../types"; </s> add import { AbortError } from "../errors"; import { t } from "../i18n"; import { useEffect, useRef } from "react"; import { URL_HASH_KEYS, URL_QUERY_KEYS, APP_NAME, EVENT } from "../constants"; </s> remove import { ImportedDataState } from "./types"; </s> add
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/data/types.ts
keep keep keep keep replace replace replace replace replace replace replace keep keep keep keep keep
<mask> import { trackEvent } from "../analytics"; <mask> import { getDefaultAppState } from "../appState"; <mask> import { ErrorDialog } from "../components/ErrorDialog"; <mask> import { TopErrorBoundary } from "../components/TopErrorBoundary"; <mask> import { <mask> APP_NAME, <mask> EVENT, <mask> TITLE_TIMEOUT, <mask> URL_HASH_KEYS, <mask> VERSION_TIMEOUT, <mask> } from "../constants"; <mask> import { loadFromBlob } from "../data/blob"; <mask> import { <mask> ExcalidrawElement, <mask> FileId, <mask> NonDeletedExcalidrawElement, </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> remove import { importLibraryFromJSON, saveLibraryAsJSON } from "../data/json"; </s> add import { saveLibraryAsJSON } from "../data/json"; </s> add import { AbortError } from "../errors"; import { t } from "../i18n"; import { useEffect, useRef } from "react"; import { URL_HASH_KEYS, URL_QUERY_KEYS, APP_NAME, EVENT } from "../constants"; </s> remove import { AppState, BinaryFiles, LibraryItems, LibraryItems_v1 } from "../types"; </s> add import { AppState, BinaryFiles, LibraryItems, LibraryItems_anyVersion, } from "../types"; </s> remove import { LibraryItems, LibraryItem } from "../types"; </s> add import { LibraryItems, LibraryItem, ExcalidrawImperativeAPI, LibraryItemsSource, } from "../types"; </s> remove import { ImportedDataState } from "./types"; </s> add </s> add import { fileOpen } from "../data/filesystem";
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/excalidraw-app/index.tsx
keep add keep keep keep keep
<mask> import { isBrowserStorageStateNewer } from "./data/tabSync"; <mask> import clsx from "clsx"; <mask> <mask> const languageDetector = new LanguageDetector(); <mask> languageDetector.init({ <mask> languageUtils: { </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> remove import { ImportedDataState } from "./types"; </s> add </s> add import { fileOpen } from "../data/filesystem"; </s> add import { AbortError } from "../errors"; import { t } from "../i18n"; import { useEffect, useRef } from "react"; import { URL_HASH_KEYS, URL_QUERY_KEYS, APP_NAME, EVENT } from "../constants"; </s> remove import { LibraryItems, LibraryItem } from "../types"; </s> add import { LibraryItems, LibraryItem, ExcalidrawImperativeAPI, LibraryItemsSource, } from "../types"; </s> remove import { importLibraryFromJSON, saveLibraryAsJSON } from "../data/json"; </s> add import { saveLibraryAsJSON } from "../data/json"; </s> remove import { APP_NAME, EVENT, TITLE_TIMEOUT, URL_HASH_KEYS, VERSION_TIMEOUT, } from "../constants"; </s> add import { APP_NAME, EVENT, TITLE_TIMEOUT, VERSION_TIMEOUT } from "../constants";
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/excalidraw-app/index.tsx
keep add keep keep keep keep keep
<mask> const collabAPI = useContext(CollabContext)?.api; <mask> <mask> useEffect(() => { <mask> if (!collabAPI || !excalidrawAPI) { <mask> return; <mask> } <mask> </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> add const [excalidrawAPI, setExcalidrawAPI] = useState(null); useHandleLibrary({ excalidrawAPI }); </s> add if (!excalidrawAPI) { return; } </s> remove const hash = new URLSearchParams(window.location.hash.slice(1)); const libraryUrl = hash.get(URL_HASH_KEYS.addLibrary); if (libraryUrl) { // If hash changed and it contains library url, import it and replace // the url to its previous state (important in case of collaboration // and similar). // Using history API won't trigger another hashchange. window.history.replaceState({}, "", event.oldURL); excalidrawAPI.importLibrary(libraryUrl, hash.get("token")); } else { </s> add const libraryUrlTokens = parseLibraryTokensFromUrl(); if (!libraryUrlTokens) { </s> remove excalidrawRef.current.updateScene(contents.data); </s> add if (contents.type === MIME_TYPES.excalidraw) { excalidrawAPI.updateScene(contents.data); } else if (contents.type === MIME_TYPES.excalidrawlib) { excalidrawAPI.updateLibrary({ libraryItems: contents.data.libraryItems, openLibraryMenu: true, }); } </s> remove const onHashChange = () => { const hash = new URLSearchParams(window.location.hash.slice(1)); const libraryUrl = hash.get("addLibrary"); if (libraryUrl) { excalidrawRef.current.importLibrary(libraryUrl, hash.get("token")); } }; window.addEventListener("hashchange", onHashChange, false); return () => { window.removeEventListener("hashchange", onHashChange); }; }, []); </s> add </s> add } catch (error: any) { if (error?.name === "AbortError") { console.warn(error); return; } setAppState({ errorMessage: t("errors.importLibraryError") }); }
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/excalidraw-app/index.tsx
keep keep keep keep replace replace keep keep keep keep keep
<mask> // session) <mask> LocalData.fileStorage.clearObsoleteFiles({ currentFileIds: fileIds }); <mask> } <mask> } <mask> <mask> data.scene.libraryItems = getLibraryItemsFromStorage(); <mask> }; <mask> <mask> initializeScene({ collabAPI }).then((data) => { <mask> loadImages(data, /* isInitialLoad */ true); <mask> initialStatePromiseRef.current.promise.resolve(data.scene); </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> remove const onHashChange = (event: HashChangeEvent) => { </s> add const onHashChange = async (event: HashChangeEvent) => { </s> remove const hash = new URLSearchParams(window.location.hash.slice(1)); const libraryUrl = hash.get(URL_HASH_KEYS.addLibrary); if (libraryUrl) { // If hash changed and it contains library url, import it and replace // the url to its previous state (important in case of collaboration // and similar). // Using history API won't trigger another hashchange. window.history.replaceState({}, "", event.oldURL); excalidrawAPI.importLibrary(libraryUrl, hash.get("token")); } else { </s> add const libraryUrlTokens = parseLibraryTokensFromUrl(); if (!libraryUrlTokens) { </s> remove export const importLibraryFromJSON = async (library: Library) => { const blob = await fileOpen({ description: "Excalidraw library files", // ToDo: Be over-permissive until https://bugs.webkit.org/show_bug.cgi?id=34442 // gets resolved. Else, iOS users cannot open `.excalidraw` files. /* extensions: [".json", ".excalidrawlib"], */ }); await library.importLibrary(blob); }; </s> add </s> add useHandleLibrary({ excalidrawAPI, getInitialLibraryItems: getLibraryItemsFromStorage, }); </s> remove onClick={() => { importLibraryFromJSON(library) .catch(muteFSAbortError) .catch((error) => { console.error(error); setAppState({ errorMessage: t("errors.importLibraryError") }); </s> add onClick={async () => { try { await fileOpen({ description: "Excalidraw library files", // ToDo: Be over-permissive until https://bugs.webkit.org/show_bug.cgi?id=34442 // gets resolved. Else, iOS users cannot open `.excalidraw` files. /* extensions: [".json", ".excalidrawlib"], */ </s> remove /** * imports library (from blob or libraryItems), merging with current library * (attempting to remove duplicates) */ importLibrary( library: | Blob | Required<ImportedDataState>["libraryItems"] | Promise<Required<ImportedDataState>["libraryItems"]>, defaultStatus: LibraryItem["status"] = "unpublished", ): Promise<LibraryItems> { return this.setLibrary( () => new Promise<LibraryItems>(async (resolve, reject) => { try { let libraryItems: LibraryItems; if (library instanceof Blob) { libraryItems = await loadLibraryFromBlob(library, defaultStatus); } else { libraryItems = restoreLibraryItems(await library, defaultStatus); } resolve(mergeLibraryItems(this.lastLibraryItems, libraryItems)); } catch (error) { reject(error); } }), ); } </s> add
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/excalidraw-app/index.tsx
keep keep keep keep replace keep replace replace replace replace replace replace replace replace replace replace keep keep
<mask> loadImages(data, /* isInitialLoad */ true); <mask> initialStatePromiseRef.current.promise.resolve(data.scene); <mask> }); <mask> <mask> const onHashChange = (event: HashChangeEvent) => { <mask> event.preventDefault(); <mask> const hash = new URLSearchParams(window.location.hash.slice(1)); <mask> const libraryUrl = hash.get(URL_HASH_KEYS.addLibrary); <mask> if (libraryUrl) { <mask> // If hash changed and it contains library url, import it and replace <mask> // the url to its previous state (important in case of collaboration <mask> // and similar). <mask> // Using history API won't trigger another hashchange. <mask> window.history.replaceState({}, "", event.oldURL); <mask> excalidrawAPI.importLibrary(libraryUrl, hash.get("token")); <mask> } else { <mask> initializeScene({ collabAPI }).then((data) => { <mask> loadImages(data); </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> remove data.scene.libraryItems = getLibraryItemsFromStorage(); </s> add </s> remove const onHashChange = () => { const hash = new URLSearchParams(window.location.hash.slice(1)); const libraryUrl = hash.get("addLibrary"); if (libraryUrl) { excalidrawRef.current.importLibrary(libraryUrl, hash.get("token")); } }; window.addEventListener("hashchange", onHashChange, false); return () => { window.removeEventListener("hashchange", onHashChange); }; }, []); </s> add </s> remove export const importLibraryFromJSON = async (library: Library) => { const blob = await fileOpen({ description: "Excalidraw library files", // ToDo: Be over-permissive until https://bugs.webkit.org/show_bug.cgi?id=34442 // gets resolved. Else, iOS users cannot open `.excalidraw` files. /* extensions: [".json", ".excalidrawlib"], */ }); await library.importLibrary(blob); }; </s> add </s> remove onClick={() => { importLibraryFromJSON(library) .catch(muteFSAbortError) .catch((error) => { console.error(error); setAppState({ errorMessage: t("errors.importLibraryError") }); </s> add onClick={async () => { try { await fileOpen({ description: "Excalidraw library files", // ToDo: Be over-permissive until https://bugs.webkit.org/show_bug.cgi?id=34442 // gets resolved. Else, iOS users cannot open `.excalidraw` files. /* extensions: [".json", ".excalidrawlib"], */ </s> remove excalidrawRef.current.updateScene(contents.data); </s> add if (contents.type === MIME_TYPES.excalidraw) { excalidrawAPI.updateScene(contents.data); } else if (contents.type === MIME_TYPES.excalidrawlib) { excalidrawAPI.updateLibrary({ libraryItems: contents.data.libraryItems, openLibraryMenu: true, }); }
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/excalidraw-app/index.tsx
keep keep keep add keep keep keep keep
<mask> } <mask> setLangCode(langCode); <mask> excalidrawAPI.updateScene({ <mask> ...localDataState, <mask> libraryItems: getLibraryItemsFromStorage(), <mask> }); <mask> collabAPI.setUsername(username || ""); <mask> } </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> remove excalidrawRef.current.updateScene({ </s> add excalidrawAPI.updateScene({ </s> add useHandleLibrary({ excalidrawAPI, getInitialLibraryItems: getLibraryItemsFromStorage, }); </s> remove excalidrawRef.current.updateScene({ collaborators }); </s> add excalidrawAPI.updateScene({ collaborators }); </s> add import { AbortError } from "../errors"; import { t } from "../i18n"; import { useEffect, useRef } from "react"; import { URL_HASH_KEYS, URL_QUERY_KEYS, APP_NAME, EVENT } from "../constants"; </s> remove this.library .importLibrary(file) .then(() => { this.setState({ isLoading: false, }); </s> add await this.library .updateLibrary({ libraryItems: file, merge: true, openLibraryMenu: true, </s> remove excalidrawRef.current.updateScene(contents.data); </s> add if (contents.type === MIME_TYPES.excalidraw) { excalidrawAPI.updateScene(contents.data); } else if (contents.type === MIME_TYPES.excalidrawlib) { excalidrawAPI.updateLibrary({ libraryItems: contents.data.libraryItems, openLibraryMenu: true, }); }
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/excalidraw-app/index.tsx
keep keep add keep keep keep keep keep keep
<mask> exportToBlob, <mask> exportToClipboard, <mask> Excalidraw, <mask> MIME_TYPES, <mask> } = window.ExcalidrawLib; <mask> <mask> const COMMENT_SVG = ( <mask> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"> <mask> <path d="M256 32C114.6 32 .0272 125.1 .0272 240c0 47.63 19.91 91.25 52.91 126.2c-14.88 39.5-45.87 72.88-46.37 73.25c-6.625 7-8.375 17.25-4.625 26C5.818 474.2 14.38 480 24 480c61.5 0 109.1-25.75 139.1-46.25C191.1 442.8 223.3 448 256 448c141.4 0 255.1-93.13 255.1-208S397.4 32 256 32zM256.1 400c-26.75 0-53.12-4.125-78.38-12.12l-22.75-7.125l-19.5 13.75c-14.25 10.12-33.88 21.38-57.5 29c7.375-12.12 14.37-25.75 19.88-40.25l10.62-28l-20.62-21.87C69.82 314.1 48.07 282.2 48.07 240c0-88.25 93.25-160 208-160s208 71.75 208 160S370.8 400 256.1 400z" /> </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> remove const appState = excalidrawRef.current.getAppState(); </s> add const appState = excalidrawAPI.getAppState(); </s> remove excalidrawRef.current.getAppState(), </s> add excalidrawAPI.getAppState(), </s> remove const onHashChange = () => { const hash = new URLSearchParams(window.location.hash.slice(1)); const libraryUrl = hash.get("addLibrary"); if (libraryUrl) { excalidrawRef.current.importLibrary(libraryUrl, hash.get("token")); } }; window.addEventListener("hashchange", onHashChange, false); return () => { window.removeEventListener("hashchange", onHashChange); }; }, []); </s> add </s> add }, [excalidrawAPI]); </s> remove import Library from "./library"; </s> add </s> remove const appstate = excalidrawRef.current.getAppState(); </s> add const appstate = excalidrawAPI.getAppState();
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/packages/excalidraw/example/App.js
keep keep keep keep replace keep keep keep keep keep
<mask> ); <mask> }; <mask> <mask> export default function App() { <mask> const excalidrawRef = useRef(null); <mask> const appRef = useRef(null); <mask> <mask> const [viewModeEnabled, setViewModeEnabled] = useState(false); <mask> const [zenModeEnabled, setZenModeEnabled] = useState(false); <mask> const [gridModeEnabled, setGridModeEnabled] = useState(false); </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> remove const appstate = excalidrawRef.current.getAppState(); </s> add const appstate = excalidrawAPI.getAppState(); </s> remove const appState = excalidrawRef.current.getAppState(); </s> add const appState = excalidrawAPI.getAppState(); </s> remove const appState = excalidrawRef.current.getAppState(); </s> add const appState = excalidrawAPI.getAppState(); </s> remove excalidrawRef.current.updateScene(sceneData); </s> add excalidrawAPI.updateScene(sceneData); </s> remove excalidrawRef.current.getAppState(), </s> add excalidrawAPI.getAppState(), </s> remove const onHashChange = () => { const hash = new URLSearchParams(window.location.hash.slice(1)); const libraryUrl = hash.get("addLibrary"); if (libraryUrl) { excalidrawRef.current.importLibrary(libraryUrl, hash.get("token")); } }; window.addEventListener("hashchange", onHashChange, false); return () => { window.removeEventListener("hashchange", onHashChange); }; }, []); </s> add
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/packages/excalidraw/example/App.js
keep keep keep add keep keep keep keep keep
<mask> const initialStatePromiseRef = useRef({ promise: null }); <mask> if (!initialStatePromiseRef.current.promise) { <mask> initialStatePromiseRef.current.promise = resolvablePromise(); <mask> } <mask> useEffect(() => { <mask> if (!excalidrawAPI) { <mask> return; <mask> } <mask> const fetchData = async () => { </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> add if (!excalidrawAPI) { return; } </s> add useHandleLibrary({ excalidrawAPI, getInitialLibraryItems: getLibraryItemsFromStorage, }); </s> remove excalidrawRef.current.updateScene(contents.data); </s> add if (contents.type === MIME_TYPES.excalidraw) { excalidrawAPI.updateScene(contents.data); } else if (contents.type === MIME_TYPES.excalidrawlib) { excalidrawAPI.updateLibrary({ libraryItems: contents.data.libraryItems, openLibraryMenu: true, }); } </s> remove const onHashChange = () => { const hash = new URLSearchParams(window.location.hash.slice(1)); const libraryUrl = hash.get("addLibrary"); if (libraryUrl) { excalidrawRef.current.importLibrary(libraryUrl, hash.get("token")); } }; window.addEventListener("hashchange", onHashChange, false); return () => { window.removeEventListener("hashchange", onHashChange); }; }, []); </s> add </s> remove const appState = excalidrawRef.current.getAppState(); </s> add const appState = excalidrawAPI.getAppState(); </s> remove const onHashChange = (event: HashChangeEvent) => { </s> add const onHashChange = async (event: HashChangeEvent) => {
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/packages/excalidraw/example/App.js
keep keep add keep keep keep keep
<mask> useHandleLibrary({ excalidrawAPI }); <mask> <mask> useEffect(() => { <mask> const fetchData = async () => { <mask> const res = await fetch("/rocket.jpeg"); <mask> const imageData = await res.blob(); <mask> const reader = new FileReader(); </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> add const [excalidrawAPI, setExcalidrawAPI] = useState(null); useHandleLibrary({ excalidrawAPI }); </s> remove excalidrawRef.current.updateScene(contents.data); </s> add if (contents.type === MIME_TYPES.excalidraw) { excalidrawAPI.updateScene(contents.data); } else if (contents.type === MIME_TYPES.excalidrawlib) { excalidrawAPI.updateLibrary({ libraryItems: contents.data.libraryItems, openLibraryMenu: true, }); } </s> add useHandleLibrary({ excalidrawAPI, getInitialLibraryItems: getLibraryItemsFromStorage, }); </s> remove const onHashChange = () => { const hash = new URLSearchParams(window.location.hash.slice(1)); const libraryUrl = hash.get("addLibrary"); if (libraryUrl) { excalidrawRef.current.importLibrary(libraryUrl, hash.get("token")); } }; window.addEventListener("hashchange", onHashChange, false); return () => { window.removeEventListener("hashchange", onHashChange); }; }, []); </s> add </s> remove const onHashChange = (event: HashChangeEvent) => { </s> add const onHashChange = async (event: HashChangeEvent) => { </s> remove const appState = excalidrawRef.current.getAppState(); </s> add const appState = excalidrawAPI.getAppState();
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/packages/excalidraw/example/App.js
keep keep keep keep replace keep keep keep keep keep
<mask> }, <mask> ]; <mask> <mask> initialStatePromiseRef.current.promise.resolve(InitialData); <mask> excalidrawRef.current.addFiles(imagesArray); <mask> }; <mask> }; <mask> fetchData(); <mask> <mask> const onHashChange = () => { </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> remove const onHashChange = () => { const hash = new URLSearchParams(window.location.hash.slice(1)); const libraryUrl = hash.get("addLibrary"); if (libraryUrl) { excalidrawRef.current.importLibrary(libraryUrl, hash.get("token")); } }; window.addEventListener("hashchange", onHashChange, false); return () => { window.removeEventListener("hashchange", onHashChange); }; }, []); </s> add </s> add }, [excalidrawAPI]); </s> remove const appState = excalidrawRef.current.getAppState(); </s> add const appState = excalidrawAPI.getAppState(); </s> remove excalidrawRef.current.updateScene(sceneData); </s> add excalidrawAPI.updateScene(sceneData); </s> remove const appState = excalidrawRef.current.getAppState(); </s> add const appState = excalidrawAPI.getAppState(); </s> remove const onHashChange = (event: HashChangeEvent) => { </s> add const onHashChange = async (event: HashChangeEvent) => {
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/packages/excalidraw/example/App.js
keep add keep keep keep keep keep
<mask> }; <mask> fetchData(); <mask> <mask> const renderFooter = () => { <mask> return ( <mask> <> <mask> {" "} </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> remove const onHashChange = () => { const hash = new URLSearchParams(window.location.hash.slice(1)); const libraryUrl = hash.get("addLibrary"); if (libraryUrl) { excalidrawRef.current.importLibrary(libraryUrl, hash.get("token")); } }; window.addEventListener("hashchange", onHashChange, false); return () => { window.removeEventListener("hashchange", onHashChange); }; }, []); </s> add </s> remove const appState = excalidrawRef.current.getAppState(); </s> add const appState = excalidrawAPI.getAppState(); </s> remove excalidrawRef.current.addFiles(imagesArray); </s> add excalidrawAPI.addFiles(imagesArray); </s> remove excalidrawRef.current.getAppState(), </s> add excalidrawAPI.getAppState(), </s> remove excalidrawRef.current.setActiveTool({ </s> add excalidrawAPI.setActiveTool({ </s> remove excalidrawRef.current.getAppState(), </s> add excalidrawAPI.getAppState(),
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/packages/excalidraw/example/App.js
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> }; <mask> }; <mask> fetchData(); <mask> <mask> const onHashChange = () => { <mask> const hash = new URLSearchParams(window.location.hash.slice(1)); <mask> const libraryUrl = hash.get("addLibrary"); <mask> if (libraryUrl) { <mask> excalidrawRef.current.importLibrary(libraryUrl, hash.get("token")); <mask> } <mask> }; <mask> window.addEventListener("hashchange", onHashChange, false); <mask> return () => { <mask> window.removeEventListener("hashchange", onHashChange); <mask> }; <mask> }, []); <mask> const renderFooter = () => { <mask> return ( <mask> <> <mask> {" "} <mask> <button </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> add }, [excalidrawAPI]); </s> remove const appState = excalidrawRef.current.getAppState(); </s> add const appState = excalidrawAPI.getAppState(); </s> remove excalidrawRef.current.addFiles(imagesArray); </s> add excalidrawAPI.addFiles(imagesArray); </s> remove const onHashChange = (event: HashChangeEvent) => { </s> add const onHashChange = async (event: HashChangeEvent) => { </s> remove const hash = new URLSearchParams(window.location.hash.slice(1)); const libraryUrl = hash.get(URL_HASH_KEYS.addLibrary); if (libraryUrl) { // If hash changed and it contains library url, import it and replace // the url to its previous state (important in case of collaboration // and similar). // Using history API won't trigger another hashchange. window.history.replaceState({}, "", event.oldURL); excalidrawAPI.importLibrary(libraryUrl, hash.get("token")); } else { </s> add const libraryUrlTokens = parseLibraryTokensFromUrl(); if (!libraryUrlTokens) { </s> remove excalidrawRef.current.updateScene(contents.data); </s> add if (contents.type === MIME_TYPES.excalidraw) { excalidrawAPI.updateScene(contents.data); } else if (contents.type === MIME_TYPES.excalidrawlib) { excalidrawAPI.updateLibrary({ libraryItems: contents.data.libraryItems, openLibraryMenu: true, }); }
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/packages/excalidraw/example/App.js
keep keep keep keep replace keep keep keep keep keep
<mask> {" "} <mask> <button <mask> className="custom-element" <mask> onClick={() => <mask> excalidrawRef.current.setActiveTool({ <mask> type: "custom", <mask> customType: "comment", <mask> }) <mask> } <mask> > </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> remove excalidrawRef.current.setCustomType("comment"); </s> add excalidrawAPI.setActiveTool({ type: "custom", customType: "comment", }); </s> remove excalidrawRef.current.resetScene(); </s> add excalidrawAPI.resetScene(); </s> add }, [excalidrawAPI]); </s> remove const onHashChange = () => { const hash = new URLSearchParams(window.location.hash.slice(1)); const libraryUrl = hash.get("addLibrary"); if (libraryUrl) { excalidrawRef.current.importLibrary(libraryUrl, hash.get("token")); } }; window.addEventListener("hashchange", onHashChange, false); return () => { window.removeEventListener("hashchange", onHashChange); }; }, []); </s> add </s> remove excalidrawRef.current.setActiveTool({ type: "selection" }); </s> add excalidrawAPI.setActiveTool({ type: "selection" }); </s> remove excalidrawRef.current.updateScene({ </s> add excalidrawAPI.updateLibrary({
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/packages/excalidraw/example/App.js
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> const loadSceneOrLibrary = async () => { <mask> const file = await fileOpen({ description: "Excalidraw or library file" }); <mask> const contents = await loadSceneOrLibraryFromBlob(file, null, null); <mask> excalidrawRef.current.updateScene(contents.data); <mask> }; <mask> <mask> const updateScene = () => { <mask> const sceneData = { <mask> elements: [ </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> remove export const importLibraryFromJSON = async (library: Library) => { const blob = await fileOpen({ description: "Excalidraw library files", // ToDo: Be over-permissive until https://bugs.webkit.org/show_bug.cgi?id=34442 // gets resolved. Else, iOS users cannot open `.excalidraw` files. /* extensions: [".json", ".excalidrawlib"], */ }); await library.importLibrary(blob); }; </s> add </s> add if (!excalidrawAPI) { return; } </s> remove elements: excalidrawRef.current.getSceneElements(), </s> add elements: excalidrawAPI.getSceneElements(), </s> remove elements: excalidrawRef.current.getSceneElements(), </s> add elements: excalidrawAPI.getSceneElements(), </s> add const [excalidrawAPI, setExcalidrawAPI] = useState(null); useHandleLibrary({ excalidrawAPI }); </s> remove const onHashChange = () => { const hash = new URLSearchParams(window.location.hash.slice(1)); const libraryUrl = hash.get("addLibrary"); if (libraryUrl) { excalidrawRef.current.importLibrary(libraryUrl, hash.get("token")); } }; window.addEventListener("hashchange", onHashChange, false); return () => { window.removeEventListener("hashchange", onHashChange); }; }, []); </s> add
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/packages/excalidraw/example/App.js
keep keep keep keep replace keep keep keep keep keep
<mask> appState: { <mask> viewBackgroundColor: "#edf2ff", <mask> }, <mask> }; <mask> excalidrawRef.current.updateScene(sceneData); <mask> }; <mask> <mask> const onLinkOpen = useCallback((element, event) => { <mask> const link = element.link; <mask> const { nativeEvent } = event.detail; </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> remove const onHashChange = () => { const hash = new URLSearchParams(window.location.hash.slice(1)); const libraryUrl = hash.get("addLibrary"); if (libraryUrl) { excalidrawRef.current.importLibrary(libraryUrl, hash.get("token")); } }; window.addEventListener("hashchange", onHashChange, false); return () => { window.removeEventListener("hashchange", onHashChange); }; }, []); </s> add </s> remove const appState = excalidrawRef.current.getAppState(); </s> add const appState = excalidrawAPI.getAppState(); </s> remove const appState = excalidrawRef.current.getAppState(); </s> add const appState = excalidrawAPI.getAppState(); </s> add const [pointerData, setPointerData] = useState(null); </s> remove excalidrawRef.current.updateScene(contents.data); </s> add if (contents.type === MIME_TYPES.excalidraw) { excalidrawAPI.updateScene(contents.data); } else if (contents.type === MIME_TYPES.excalidrawlib) { excalidrawAPI.updateLibrary({ libraryItems: contents.data.libraryItems, openLibraryMenu: true, }); } </s> remove const appstate = excalidrawRef.current.getAppState(); </s> add const appstate = excalidrawAPI.getAppState();
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/packages/excalidraw/example/App.js
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> }, []); <mask> <mask> const onCopy = async (type) => { <mask> await exportToClipboard({ <mask> elements: excalidrawRef.current.getSceneElements(), <mask> appState: excalidrawRef.current.getAppState(), <mask> files: excalidrawRef.current.getFiles(), <mask> type, <mask> }); <mask> window.alert(`Copied to clipboard as ${type} sucessfully`); <mask> }; <mask> </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> add const [pointerData, setPointerData] = useState(null); </s> remove elements: excalidrawRef.current.getSceneElements(), </s> add elements: excalidrawAPI.getSceneElements(), </s> remove elements: excalidrawRef.current.getSceneElements(), </s> add elements: excalidrawAPI.getSceneElements(), </s> remove elements: excalidrawRef.current.getSceneElements(), </s> add elements: excalidrawAPI.getSceneElements(), </s> remove files: excalidrawRef.current.getFiles(), </s> add files: excalidrawAPI.getFiles(), </s> remove files: excalidrawRef.current.getFiles(), </s> add files: excalidrawAPI.getFiles(),
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/packages/excalidraw/example/App.js
keep keep add keep keep keep keep keep keep
<mask> window.alert(`Copied to clipboard as ${type} sucessfully`); <mask> }; <mask> <mask> const onPointerDown = (activeTool, pointerDownState) => { <mask> if (activeTool.type === "custom" && activeTool.customType === "comment") { <mask> const { x, y } = pointerDownState.origin; <mask> setComment({ x, y, value: "" }); <mask> } <mask> }; </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> remove elements: excalidrawRef.current.getSceneElements(), appState: excalidrawRef.current.getAppState(), files: excalidrawRef.current.getFiles(), </s> add elements: excalidrawAPI.getSceneElements(), appState: excalidrawAPI.getAppState(), files: excalidrawAPI.getFiles(), </s> remove excalidrawRef.current.updateScene(contents.data); </s> add if (contents.type === MIME_TYPES.excalidraw) { excalidrawAPI.updateScene(contents.data); } else if (contents.type === MIME_TYPES.excalidrawlib) { excalidrawAPI.updateLibrary({ libraryItems: contents.data.libraryItems, openLibraryMenu: true, }); } </s> remove const appState = excalidrawRef.current.getAppState(); </s> add const appState = excalidrawAPI.getAppState(); </s> remove const appState = excalidrawRef.current.getAppState(); </s> add const appState = excalidrawAPI.getAppState(); </s> remove excalidrawRef.current.getAppState(), </s> add excalidrawAPI.getAppState(), </s> remove const appstate = excalidrawRef.current.getAppState(); </s> add const appstate = excalidrawAPI.getAppState();
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/packages/excalidraw/example/App.js
keep keep keep keep replace keep keep keep keep keep
<mask> const commentIconsElements = <mask> appRef.current.querySelectorAll(".comment-icon"); <mask> commentIconsElements.forEach((ele) => { <mask> const id = ele.id; <mask> const appstate = excalidrawRef.current.getAppState(); <mask> const { x, y } = sceneCoordsToViewportCoords( <mask> { sceneX: commentIcons[id].x, sceneY: commentIcons[id].y }, <mask> appstate, <mask> ); <mask> ele.style.left = `${ </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> remove const appState = excalidrawRef.current.getAppState(); </s> add const appState = excalidrawAPI.getAppState(); </s> remove excalidrawRef.current.getAppState(), </s> add excalidrawAPI.getAppState(), </s> remove const appState = excalidrawRef.current.getAppState(); </s> add const appState = excalidrawAPI.getAppState(); </s> remove excalidrawRef.current.getAppState(), </s> add excalidrawAPI.getAppState(), </s> add const [pointerData, setPointerData] = useState(null); </s> remove excalidrawRef.current.updateScene(sceneData); </s> add excalidrawAPI.updateScene(sceneData);
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/packages/excalidraw/example/App.js
keep keep keep keep replace keep keep keep keep keep
<mask> const onPointerMoveFromPointerDownHandler = (pointerDownState) => { <mask> return withBatchedUpdatesThrottled((event) => { <mask> const { x, y } = viewportCoordsToSceneCoords( <mask> { clientX: event.clientX, clientY: event.clientY }, <mask> excalidrawRef.current.getAppState(), <mask> ); <mask> const distance = distance2d( <mask> pointerDownState.x, <mask> pointerDownState.y, <mask> event.clientX, </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> remove excalidrawRef.current.setActiveTool({ type: "selection" }); </s> add excalidrawAPI.setActiveTool({ type: "selection" }); </s> remove const appState = excalidrawRef.current.getAppState(); </s> add const appState = excalidrawAPI.getAppState(); </s> remove excalidrawRef.current.getAppState(), </s> add excalidrawAPI.getAppState(), </s> remove const appstate = excalidrawRef.current.getAppState(); </s> add const appstate = excalidrawAPI.getAppState(); </s> remove const appState = excalidrawRef.current.getAppState(); </s> add const appState = excalidrawAPI.getAppState(); </s> remove const onHashChange = () => { const hash = new URLSearchParams(window.location.hash.slice(1)); const libraryUrl = hash.get("addLibrary"); if (libraryUrl) { excalidrawRef.current.importLibrary(libraryUrl, hash.get("token")); } }; window.addEventListener("hashchange", onHashChange, false); return () => { window.removeEventListener("hashchange", onHashChange); }; }, []); </s> add
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/packages/excalidraw/example/App.js
keep keep keep keep replace keep keep keep keep keep
<mask> const onPointerUpFromPointerDownHandler = (pointerDownState) => { <mask> return withBatchedUpdates((event) => { <mask> window.removeEventListener(EVENT.POINTER_MOVE, pointerDownState.onMove); <mask> window.removeEventListener(EVENT.POINTER_UP, pointerDownState.onUp); <mask> excalidrawRef.current.setActiveTool({ type: "selection" }); <mask> const distance = distance2d( <mask> pointerDownState.x, <mask> pointerDownState.y, <mask> event.clientX, <mask> event.clientY, </s> feat: factor out url library init & switch to `updateLibrary` API (#5115) Co-authored-by: Aakansha Doshi <[email protected]> </s> remove excalidrawRef.current.getAppState(), </s> add excalidrawAPI.getAppState(), </s> remove const appState = excalidrawRef.current.getAppState(); </s> add const appState = excalidrawAPI.getAppState(); </s> remove const onHashChange = () => { const hash = new URLSearchParams(window.location.hash.slice(1)); const libraryUrl = hash.get("addLibrary"); if (libraryUrl) { excalidrawRef.current.importLibrary(libraryUrl, hash.get("token")); } }; window.addEventListener("hashchange", onHashChange, false); return () => { window.removeEventListener("hashchange", onHashChange); }; }, []); </s> add </s> remove excalidrawRef.current.getAppState(), </s> add excalidrawAPI.getAppState(), </s> add if (!excalidrawAPI) { return; } </s> add }, [excalidrawAPI]);
https://github.com/excalidraw/excalidraw/commit/cad6097d604d891e94e397af6bec0d2f3d2eed9b
src/packages/excalidraw/example/App.js