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> CollabContext, <mask> CollabContextConsumer, <mask> } from "./collab/CollabWrapper"; <mask> import { LanguageList } from "./components/LanguageList"; <mask> import { exportToBackend, getCollaborationLinkData, loadScene } from "./data"; <mask> import { <mask> getLibraryItemsFromStorage, <mask> importFromLocalStorage, <mask> importUsernameFromLocalStorage, <mask> } from "./data/localStorage"; </s> feat: collab component state handling rewrite & fixes (#5046) </s> remove CollabContext, CollabContextConsumer, } from "./collab/CollabWrapper"; </s> add collabAPIAtom, collabDialogShownAtom, isCollaboratingAtom, } from "./collab/Collab"; </s> remove import CollabWrapper, { </s> add import Collab, { </s> remove import { restoreAppState, RestoredDataState } from "../data/restore"; </s> add import { restore, restoreAppState, RestoredDataState } from "../data/restore"; </s> remove import { useCallback, useContext, useEffect, useRef, useState } from "react"; </s> add import { useCallback, useEffect, useRef, useState } from "react"; </s> add import { Provider, useAtom } from "jotai"; import { jotaiStore, useAtomWithInitialValue } from "../jotai"; import { reconcileElements } from "./collab/reconciliation"; </s> remove import CollabWrapper from "./CollabWrapper"; </s> add import { TCollabClass } from "./Collab";
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/excalidraw-app/index.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> importFromLocalStorage, <mask> importUsernameFromLocalStorage, <mask> } from "./data/localStorage"; <mask> import CustomStats from "./CustomStats"; <mask> import { restoreAppState, RestoredDataState } from "../data/restore"; <mask> import { Tooltip } from "../components/Tooltip"; <mask> import { shield } from "../components/icons"; <mask> <mask> import "./index.scss"; <mask> import { ExportToExcalidrawPlus } from "./components/ExportToExcalidrawPlus"; </s> feat: collab component state handling rewrite & fixes (#5046) </s> remove import { exportToBackend, getCollaborationLinkData, loadScene } from "./data"; </s> add import { exportToBackend, getCollaborationLinkData, isCollaborationLink, loadScene, } from "./data"; </s> remove CollabContext, CollabContextConsumer, } from "./collab/CollabWrapper"; </s> add collabAPIAtom, collabDialogShownAtom, isCollaboratingAtom, } from "./collab/Collab"; </s> remove import { useCallback, useContext, useEffect, useRef, useState } from "react"; </s> add import { useCallback, useEffect, useRef, useState } from "react"; </s> add import { Provider, useAtom } from "jotai"; import { jotaiStore, useAtomWithInitialValue } from "../jotai"; import { reconcileElements } from "./collab/reconciliation"; </s> remove import CollabWrapper from "./CollabWrapper"; </s> add import { TCollabClass } from "./Collab"; </s> remove import CollabWrapper, { </s> add import Collab, {
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/excalidraw-app/index.tsx
keep add keep keep keep keep keep
<mask> import { isBrowserStorageStateNewer } from "./data/tabSync"; <mask> import clsx from "clsx"; <mask> import { parseLibraryTokensFromUrl, useHandleLibrary } from "../data/library"; <mask> <mask> const isExcalidrawPlusSignedUser = document.cookie.includes( <mask> COOKIES.AUTH_STATE_COOKIE, <mask> ); </s> feat: collab component state handling rewrite & fixes (#5046) </s> remove import { useCallback, useContext, useEffect, useRef, useState } from "react"; </s> add import { useCallback, useEffect, useRef, useState } from "react"; </s> remove import { restoreAppState, RestoredDataState } from "../data/restore"; </s> add import { restore, restoreAppState, RestoredDataState } from "../data/restore"; </s> remove import { unstable_createStore } from "jotai"; </s> add import { unstable_createStore, useAtom, WritableAtom } from "jotai"; import { useLayoutEffect } from "react"; </s> add import { trackEvent } from "../../analytics"; import { getFrame } from "../../utils"; </s> remove import CollabWrapper from "./CollabWrapper"; </s> add import { TCollabClass } from "./Collab"; </s> remove import { exportToBackend, getCollaborationLinkData, loadScene } from "./data"; </s> add import { exportToBackend, getCollaborationLinkData, isCollaborationLink, loadScene, } from "./data";
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/excalidraw-app/index.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> <mask> if (roomLinkData) { <mask> return { <mask> scene: await opts.collabAPI.initializeSocketClient(roomLinkData), <mask> isExternalScene: true, <mask> id: roomLinkData.roomId, <mask> key: roomLinkData.roomKey, <mask> }; <mask> } else if (scene) { </s> feat: collab component state handling rewrite & fixes (#5046) </s> remove appState: restoreAppState(data.scene.appState, null), </s> add ...restore(data.scene, null, null), commitToHistory: true, </s> add if ( collabAPI.isCollaborating() && !isCollaborationLink(window.location.href) ) { collabAPI.stopCollaboration(false); } excalidrawAPI.updateScene({ appState: { isLoading: true } }); </s> remove const match = hash.match(/^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/); </s> add const match = hash.match(RE_COLLAB_LINK); </s> remove constructor(collab: CollabWrapper) { </s> add constructor(collab: TCollabClass) { </s> remove window.collab.openPortal(); </s> add window.collab.startCollaboration(null); </s> add const RE_COLLAB_LINK = /^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/; export const isCollaborationLink = (link: string) => { const hash = new URL(link).hash; return RE_COLLAB_LINK.test(hash); };
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/excalidraw-app/index.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> const [excalidrawAPI, excalidrawRefCallback] = <mask> useCallbackRefState<ExcalidrawImperativeAPI>(); <mask> <mask> const collabAPI = useContext(CollabContext)?.api; <mask> <mask> useHandleLibrary({ <mask> excalidrawAPI, <mask> getInitialLibraryItems: getLibraryItemsFromStorage, <mask> }); </s> feat: collab component state handling rewrite & fixes (#5046) </s> remove initializeScene({ collabAPI }).then((data) => { </s> add initializeScene({ collabAPI }).then(async (data) => { </s> add if ( collabAPI.isCollaborating() && !isCollaborationLink(window.location.href) ) { collabAPI.stopCollaboration(false); } excalidrawAPI.updateScene({ appState: { isLoading: true } }); </s> remove initialStatePromiseRef.current.promise.resolve(data.scene); </s> add initialStatePromiseRef.current.promise.resolve({ ...data.scene, // at this point the state may have already been updated (e.g. when // collaborating, we may have received updates from other clients) appState: restoreAppState( data.scene?.appState, excalidrawAPI.getAppState(), ), elements: reconcileElements( data.scene?.elements || [], excalidrawAPI.getSceneElementsIncludingDeleted(), excalidrawAPI.getAppState(), ), }); </s> add const RE_COLLAB_LINK = /^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/; export const isCollaborationLink = (link: string) => { const hash = new URL(link).hash; return RE_COLLAB_LINK.test(hash); }; </s> remove const match = hash.match(/^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/); </s> add const match = hash.match(RE_COLLAB_LINK); </s> add import { trackEvent } from "../../analytics"; import { getFrame } from "../../utils";
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/excalidraw-app/index.tsx
keep replace keep replace keep keep keep keep
<mask> <mask> initializeScene({ collabAPI }).then((data) => { <mask> loadImages(data, /* isInitialLoad */ true); <mask> initialStatePromiseRef.current.promise.resolve(data.scene); <mask> }); <mask> <mask> const onHashChange = async (event: HashChangeEvent) => { <mask> event.preventDefault(); </s> feat: collab component state handling rewrite & fixes (#5046) </s> add if ( collabAPI.isCollaborating() && !isCollaborationLink(window.location.href) ) { collabAPI.stopCollaboration(false); } excalidrawAPI.updateScene({ appState: { isLoading: true } }); </s> remove const collabAPI = useContext(CollabContext)?.api; </s> add const [collabAPI] = useAtom(collabAPIAtom); const [, setCollabDialogShown] = useAtom(collabDialogShownAtom); const [isCollaborating] = useAtomWithInitialValue(isCollaboratingAtom, () => { return isCollaborationLink(window.location.href); }); </s> add import { trackEvent } from "../../analytics"; import { getFrame } from "../../utils"; </s> add const RE_COLLAB_LINK = /^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/; export const isCollaborationLink = (link: string) => { const hash = new URL(link).hash; return RE_COLLAB_LINK.test(hash); }; </s> remove const match = hash.match(/^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/); </s> add const match = hash.match(RE_COLLAB_LINK);
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/excalidraw-app/index.tsx
keep add keep keep keep keep
<mask> const libraryUrlTokens = parseLibraryTokensFromUrl(); <mask> if (!libraryUrlTokens) { <mask> initializeScene({ collabAPI }).then((data) => { <mask> loadImages(data); <mask> if (data.scene) { <mask> excalidrawAPI.updateScene({ </s> feat: collab component state handling rewrite & fixes (#5046) </s> remove appState: restoreAppState(data.scene.appState, null), </s> add ...restore(data.scene, null, null), commitToHistory: true, </s> remove initializeScene({ collabAPI }).then((data) => { </s> add initializeScene({ collabAPI }).then(async (data) => { </s> remove initialStatePromiseRef.current.promise.resolve(data.scene); </s> add initialStatePromiseRef.current.promise.resolve({ ...data.scene, // at this point the state may have already been updated (e.g. when // collaborating, we may have received updates from other clients) appState: restoreAppState( data.scene?.appState, excalidrawAPI.getAppState(), ), elements: reconcileElements( data.scene?.elements || [], excalidrawAPI.getSceneElementsIncludingDeleted(), excalidrawAPI.getAppState(), ), }); </s> remove scene: await opts.collabAPI.initializeSocketClient(roomLinkData), </s> add scene: await opts.collabAPI.startCollaboration(roomLinkData), </s> remove const match = hash.match(/^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/); </s> add const match = hash.match(RE_COLLAB_LINK); </s> add const RE_COLLAB_LINK = /^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/; export const isCollaborationLink = (link: string) => { const hash = new URL(link).hash; return RE_COLLAB_LINK.test(hash); };
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/excalidraw-app/index.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> loadImages(data); <mask> if (data.scene) { <mask> excalidrawAPI.updateScene({ <mask> ...data.scene, <mask> appState: restoreAppState(data.scene.appState, null), <mask> }); <mask> } <mask> }); <mask> } <mask> }; </s> feat: collab component state handling rewrite & fixes (#5046) </s> add if ( collabAPI.isCollaborating() && !isCollaborationLink(window.location.href) ) { collabAPI.stopCollaboration(false); } excalidrawAPI.updateScene({ appState: { isLoading: true } }); </s> remove initialStatePromiseRef.current.promise.resolve(data.scene); </s> add initialStatePromiseRef.current.promise.resolve({ ...data.scene, // at this point the state may have already been updated (e.g. when // collaborating, we may have received updates from other clients) appState: restoreAppState( data.scene?.appState, excalidrawAPI.getAppState(), ), elements: reconcileElements( data.scene?.elements || [], excalidrawAPI.getSceneElementsIncludingDeleted(), excalidrawAPI.getAppState(), ), }); </s> remove scene: await opts.collabAPI.initializeSocketClient(roomLinkData), </s> add scene: await opts.collabAPI.startCollaboration(roomLinkData), </s> remove initializeScene({ collabAPI }).then((data) => { </s> add initializeScene({ collabAPI }).then(async (data) => { </s> remove const match = hash.match(/^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/); </s> add const match = hash.match(RE_COLLAB_LINK); </s> remove window.collab.openPortal(); </s> add window.collab.startCollaboration(null);
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/excalidraw-app/index.tsx
keep keep keep replace replace replace replace keep keep keep keep replace keep keep
<mask> localStorage.setItem(STORAGE_KEYS.LOCAL_STORAGE_LIBRARY, serializedItems); <mask> }; <mask> <mask> const onRoomClose = useCallback(() => { <mask> LocalData.fileStorage.reset(); <mask> }, []); <mask> <mask> return ( <mask> <div <mask> style={{ height: "100%" }} <mask> className={clsx("excalidraw-app", { <mask> "is-collaborating": collabAPI?.isCollaborating(), <mask> })} <mask> > </s> feat: collab component state handling rewrite & fixes (#5046) </s> remove {collaboratorCount > 0 && ( </s> add {isCollaborating && ( </s> remove <CollabContextConsumer> </s> add <Provider unstable_createStore={() => jotaiStore}> </s> add const RE_COLLAB_LINK = /^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/; export const isCollaborationLink = (link: string) => { const hash = new URL(link).hash; return RE_COLLAB_LINK.test(hash); }; </s> remove const match = hash.match(/^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/); </s> add const match = hash.match(RE_COLLAB_LINK); </s> remove onClick={onRoomCreate} </s> add onClick={() => { trackEvent("share", "room creation", `ui (${getFrame()})`); onRoomCreate(); }}
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/excalidraw-app/index.tsx
keep keep keep keep replace replace keep keep keep keep keep
<mask> <Excalidraw <mask> ref={excalidrawRefCallback} <mask> onChange={onChange} <mask> initialData={initialStatePromiseRef.current.promise} <mask> onCollabButtonClick={collabAPI?.onCollabButtonClick} <mask> isCollaborating={collabAPI?.isCollaborating()} <mask> onPointerUpdate={collabAPI?.onPointerUpdate} <mask> UIOptions={{ <mask> canvasActions: { <mask> export: { <mask> onExportToBackend, </s> feat: collab component state handling rewrite & fixes (#5046) </s> remove "is-collaborating": collabAPI?.isCollaborating(), </s> add "is-collaborating": isCollaborating, </s> remove import { useCallback, useContext, useEffect, useRef, useState } from "react"; </s> add import { useCallback, useEffect, useRef, useState } from "react"; </s> add if ( collabAPI.isCollaborating() && !isCollaborationLink(window.location.href) ) { collabAPI.stopCollaboration(false); } excalidrawAPI.updateScene({ appState: { isLoading: true } }); </s> add import { Provider, useAtom } from "jotai"; import { jotaiStore, useAtomWithInitialValue } from "../jotai"; import { reconcileElements } from "./collab/reconciliation"; </s> remove import { restoreAppState, RestoredDataState } from "../data/restore"; </s> add import { restore, restoreAppState, RestoredDataState } from "../data/restore"; </s> remove scene: await opts.collabAPI.initializeSocketClient(roomLinkData), </s> add scene: await opts.collabAPI.startCollaboration(roomLinkData),
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/excalidraw-app/index.tsx
keep keep keep keep replace replace replace replace replace replace keep keep keep keep keep
<mask> handleKeyboardGlobally={true} <mask> onLibraryChange={onLibraryChange} <mask> autoFocus={true} <mask> /> <mask> {excalidrawAPI && ( <mask> <CollabWrapper <mask> excalidrawAPI={excalidrawAPI} <mask> onRoomClose={onRoomClose} <mask> /> <mask> )} <mask> {errorMessage && ( <mask> <ErrorDialog <mask> message={errorMessage} <mask> onClose={() => setErrorMessage("")} <mask> /> </s> feat: collab component state handling rewrite & fixes (#5046) </s> remove onClick={onRoomCreate} </s> add onClick={() => { trackEvent("share", "room creation", `ui (${getFrame()})`); onRoomCreate(); }} </s> remove {collaboratorCount > 0 && ( </s> add {isCollaborating && ( </s> remove </CollabContextConsumer> </s> add </Provider> </s> remove <CollabContextConsumer> </s> add <Provider unstable_createStore={() => jotaiStore}> </s> remove onClick={onRoomDestroy} </s> add onClick={() => { trackEvent("share", "room closed"); onRoomDestroy(); }} </s> add if ( collabAPI.isCollaborating() && !isCollaborationLink(window.location.href) ) { collabAPI.stopCollaboration(false); } excalidrawAPI.updateScene({ appState: { isLoading: true } });
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/excalidraw-app/index.tsx
keep keep keep replace keep replace keep keep keep
<mask> const ExcalidrawApp = () => { <mask> return ( <mask> <TopErrorBoundary> <mask> <CollabContextConsumer> <mask> <ExcalidrawWrapper /> <mask> </CollabContextConsumer> <mask> </TopErrorBoundary> <mask> ); <mask> }; </s> feat: collab component state handling rewrite & fixes (#5046) </s> add once: () => {}, </s> remove const onRoomClose = useCallback(() => { LocalData.fileStorage.reset(); }, []); </s> add </s> remove const collabAPI = useContext(CollabContext)?.api; </s> add const [collabAPI] = useAtom(collabAPIAtom); const [, setCollabDialogShown] = useAtom(collabDialogShownAtom); const [isCollaborating] = useAtomWithInitialValue(isCollaboratingAtom, () => { return isCollaborationLink(window.location.href); }); </s> add const RE_COLLAB_LINK = /^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/; export const isCollaborationLink = (link: string) => { const hash = new URL(link).hash; return RE_COLLAB_LINK.test(hash); }; </s> remove const match = hash.match(/^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/); </s> add const match = hash.match(RE_COLLAB_LINK);
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/excalidraw-app/index.tsx
replace keep keep keep
<mask> import { unstable_createStore } from "jotai"; <mask> <mask> export const jotaiScope = Symbol(); <mask> export const jotaiStore = unstable_createStore(); </s> feat: collab component state handling rewrite & fixes (#5046) </s> add const RE_COLLAB_LINK = /^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/; export const isCollaborationLink = (link: string) => { const hash = new URL(link).hash; return RE_COLLAB_LINK.test(hash); }; </s> add import { Provider, useAtom } from "jotai"; import { jotaiStore, useAtomWithInitialValue } from "../jotai"; import { reconcileElements } from "./collab/reconciliation"; </s> remove const match = hash.match(/^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/); </s> add const match = hash.match(RE_COLLAB_LINK); </s> add import { trackEvent } from "../../analytics"; import { getFrame } from "../../utils"; </s> remove import { useCallback, useContext, useEffect, useRef, useState } from "react"; </s> add import { useCallback, useEffect, useRef, useState } from "react"; </s> remove import { restoreAppState, RestoredDataState } from "../data/restore"; </s> add import { restore, restoreAppState, RestoredDataState } from "../data/restore";
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/jotai.ts
keep keep add keep keep keep keep keep keep
<mask> return { <mask> close: () => {}, <mask> on: () => {}, <mask> off: () => {}, <mask> emit: () => {}, <mask> }; <mask> }; <mask> }); <mask> </s> feat: collab component state handling rewrite & fixes (#5046) </s> remove <CollabContextConsumer> </s> add <Provider unstable_createStore={() => jotaiStore}> </s> remove const collabAPI = useContext(CollabContext)?.api; </s> add const [collabAPI] = useAtom(collabAPIAtom); const [, setCollabDialogShown] = useAtom(collabDialogShownAtom); const [isCollaborating] = useAtomWithInitialValue(isCollaboratingAtom, () => { return isCollaborationLink(window.location.href); }); </s> add import { trackEvent } from "../../analytics"; import { getFrame } from "../../utils"; </s> remove initializeScene({ collabAPI }).then((data) => { </s> add initializeScene({ collabAPI }).then(async (data) => { </s> remove appState: restoreAppState(data.scene.appState, null), </s> add ...restore(data.scene, null, null), commitToHistory: true, </s> add const RE_COLLAB_LINK = /^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/; export const isCollaborationLink = (link: string) => { const hash = new URL(link).hash; return RE_COLLAB_LINK.test(hash); };
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/tests/collab.test.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> expect.objectContaining({ id: "B", isDeleted: true }), <mask> ]); <mask> expect(API.getStateHistory().length).toBe(1); <mask> }); <mask> window.collab.openPortal(); <mask> await waitFor(() => { <mask> expect(h.elements).toEqual([expect.objectContaining({ id: "A" })]); <mask> expect(API.getStateHistory().length).toBe(1); <mask> }); <mask> </s> feat: collab component state handling rewrite & fixes (#5046) </s> remove scene: await opts.collabAPI.initializeSocketClient(roomLinkData), </s> add scene: await opts.collabAPI.startCollaboration(roomLinkData), </s> add if ( collabAPI.isCollaborating() && !isCollaborationLink(window.location.href) ) { collabAPI.stopCollaboration(false); } excalidrawAPI.updateScene({ appState: { isLoading: true } }); </s> remove constructor(collab: CollabWrapper) { </s> add constructor(collab: TCollabClass) { </s> remove appState: restoreAppState(data.scene.appState, null), </s> add ...restore(data.scene, null, null), commitToHistory: true, </s> remove const collabAPI = useContext(CollabContext)?.api; </s> add const [collabAPI] = useAtom(collabAPIAtom); const [, setCollabDialogShown] = useAtom(collabDialogShownAtom); const [isCollaborating] = useAtomWithInitialValue(isCollaboratingAtom, () => { return isCollaborationLink(window.location.href); }); </s> remove initializeScene({ collabAPI }).then((data) => { </s> add initializeScene({ collabAPI }).then(async (data) => {
https://github.com/excalidraw/excalidraw/commit/dac8dda4d4f4b92471e3ae388206443dcb66fb78
src/tests/collab.test.tsx
keep keep replace keep keep replace
<mask> }; <mask> <mask> const generateElement = ( <mask> element: NonDeletedExcalidrawElement, <mask> generator: RoughGenerator, <mask> sceneState?: SceneState, </s> fix not always generating shape on render (#1741) </s> add }; const generateElementWithCanvas = ( element: NonDeletedExcalidrawElement, sceneState?: SceneState, ) => { </s> remove generateElement(element, generator); </s> add generateElementShape(element, generator); </s> remove const elementWithCanvas = generateElement( </s> add const elementWithCanvas = generateElementWithCanvas( </s> remove generator, </s> add </s> remove generateElement(element, generator); </s> add generateElementShape(element, generator);
https://github.com/excalidraw/excalidraw/commit/dadf054ea21a7546b4d863238dffbe2fdb57db46
src/renderer/renderElement.ts
keep add keep keep keep keep keep
<mask> shapeCache.set(element, shape); <mask> } <mask> const zoom = sceneState ? sceneState.zoom : 1; <mask> const prevElementWithCanvas = elementWithCanvasCache.get(element); <mask> const shouldRegenerateBecauseZoom = <mask> prevElementWithCanvas && <mask> prevElementWithCanvas.canvasZoom !== zoom && </s> fix not always generating shape on render (#1741) </s> remove generateElement(element, generator); </s> add generateElementShape(element, generator); </s> remove const generateElement = ( </s> add const generateElementShape = ( </s> remove generateElement(element, generator); </s> add generateElementShape(element, generator); </s> remove generator, </s> add </s> remove const elementWithCanvas = generateElement( </s> add const elementWithCanvas = generateElementWithCanvas( </s> remove sceneState?: SceneState, </s> add
https://github.com/excalidraw/excalidraw/commit/dadf054ea21a7546b4d863238dffbe2fdb57db46
src/renderer/renderElement.ts
keep add keep keep keep keep keep
<mask> case "arrow": <mask> case "text": { <mask> if (renderOptimizations) { <mask> const elementWithCanvas = generateElementWithCanvas( <mask> element, <mask> sceneState, <mask> ); </s> fix not always generating shape on render (#1741) </s> remove const elementWithCanvas = generateElement( </s> add const elementWithCanvas = generateElementWithCanvas( </s> remove generator, </s> add </s> remove generateElement(element, generator); </s> add generateElementShape(element, generator); </s> remove generateElement(element, generator); </s> add generateElementShape(element, generator); </s> remove sceneState?: SceneState, </s> add </s> remove const generateElement = ( </s> add const generateElementShape = (
https://github.com/excalidraw/excalidraw/commit/dadf054ea21a7546b4d863238dffbe2fdb57db46
src/renderer/renderElement.ts
keep keep keep keep replace keep replace keep keep keep keep
<mask> case "draw": <mask> case "arrow": <mask> case "text": { <mask> if (renderOptimizations) { <mask> const elementWithCanvas = generateElement( <mask> element, <mask> generator, <mask> sceneState, <mask> ); <mask> drawElementFromCanvas(elementWithCanvas, rc, context, sceneState); <mask> } else { </s> fix not always generating shape on render (#1741) </s> add generateElementShape(element, generator); </s> remove generateElement(element, generator); </s> add generateElementShape(element, generator); </s> remove generateElement(element, generator); </s> add generateElementShape(element, generator); </s> remove sceneState?: SceneState, </s> add </s> remove const generateElement = ( </s> add const generateElementShape = (
https://github.com/excalidraw/excalidraw/commit/dadf054ea21a7546b4d863238dffbe2fdb57db46
src/renderer/renderElement.ts
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> case "rectangle": <mask> case "diamond": <mask> case "ellipse": { <mask> generateElement(element, generator); <mask> const node = rsvg.draw(getShapeForElement(element) as Drawable); <mask> const opacity = element.opacity / 100; <mask> if (opacity !== 1) { <mask> node.setAttribute("stroke-opacity", `${opacity}`); <mask> node.setAttribute("fill-opacity", `${opacity}`); </s> fix not always generating shape on render (#1741) </s> remove generateElement(element, generator); </s> add generateElementShape(element, generator); </s> add generateElementShape(element, generator); </s> remove const elementWithCanvas = generateElement( </s> add const elementWithCanvas = generateElementWithCanvas( </s> remove generator, </s> add </s> add }; const generateElementWithCanvas = ( element: NonDeletedExcalidrawElement, sceneState?: SceneState, ) => { </s> remove const generateElement = ( </s> add const generateElementShape = (
https://github.com/excalidraw/excalidraw/commit/dadf054ea21a7546b4d863238dffbe2fdb57db46
src/renderer/renderElement.ts
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> case "line": <mask> case "draw": <mask> case "arrow": { <mask> generateElement(element, generator); <mask> const group = svgRoot.ownerDocument!.createElementNS(SVG_NS, "g"); <mask> const opacity = element.opacity / 100; <mask> (getShapeForElement(element) as Drawable[]).forEach((shape) => { <mask> const node = rsvg.draw(shape); <mask> if (opacity !== 1) { </s> fix not always generating shape on render (#1741) </s> remove generateElement(element, generator); </s> add generateElementShape(element, generator); </s> remove const elementWithCanvas = generateElement( </s> add const elementWithCanvas = generateElementWithCanvas( </s> add generateElementShape(element, generator); </s> remove generator, </s> add </s> add }; const generateElementWithCanvas = ( element: NonDeletedExcalidrawElement, sceneState?: SceneState, ) => { </s> remove const generateElement = ( </s> add const generateElementShape = (
https://github.com/excalidraw/excalidraw/commit/dadf054ea21a7546b4d863238dffbe2fdb57db46
src/renderer/renderElement.ts
keep keep keep keep replace keep keep keep keep keep
<mask> loadFromBlob, <mask> SOCKET_SERVER, <mask> SocketUpdateDataSource, <mask> exportCanvas, <mask> createNameFromSocketId, <mask> } from "../data"; <mask> import { restore } from "../data/restore"; <mask> <mask> import { renderScene } from "../renderer"; <mask> import { AppState, GestureEvent, Gesture } from "../types"; </s> Revert "[RFC] Randomized names next to mouse pointers. (#971)" (#972) This reverts commit dcb93f75e6b721738fad9d17d9197636fa8643cd. </s> remove const pointerUsernames: { [id: string]: string } = {}; </s> add </s> remove const { socketID, pointerCoords, username, } = decryptedData.payload; </s> add const { socketID, pointerCoords } = decryptedData.payload; </s> remove if (user.username) { pointerUsernames[socketID] = user.username; } </s> add </s> remove collaborators: Map< string, { pointer?: { x: number; y: number }; username?: string } >; </s> add collaborators: Map<string, { pointer?: { x: number; y: number } }>; </s> remove const user = state.collaborators.get(socketID) || {}; </s> add if (!state.collaborators.has(socketID)) { state.collaborators.set(socketID, {}); } const user = state.collaborators.get(socketID)!; </s> remove user.username = username; </s> add
https://github.com/excalidraw/excalidraw/commit/db1f97f59ecf42d560ea088b6e1504c0266f03ba
src/components/App.tsx
keep keep replace replace replace replace replace keep replace keep
<mask> break; <mask> case "MOUSE_LOCATION": <mask> const { <mask> socketID, <mask> pointerCoords, <mask> username, <mask> } = decryptedData.payload; <mask> this.setState(state => { <mask> const user = state.collaborators.get(socketID) || {}; <mask> user.pointer = pointerCoords; </s> Revert "[RFC] Randomized names next to mouse pointers. (#971)" (#972) This reverts commit dcb93f75e6b721738fad9d17d9197636fa8643cd. </s> remove user.username = username; </s> add </s> remove const pointerUsernames: { [id: string]: string } = {}; </s> add </s> remove const username = sceneState.remotePointerUsernames[clientId]; </s> add </s> remove if (!isOutOfBounds && username) { const offsetX = x + width; const offsetY = y + height; const paddingHorizontal = 4; const paddingVertical = 4; const measure = context.measureText(username); const measureHeight = measure.actualBoundingBoxDescent + measure.actualBoundingBoxAscent; context.fillRect( offsetX, offsetY, measure.width + 2 * paddingHorizontal, measureHeight + 2 * paddingVertical, ); context.fillStyle = "white"; context.fillText( username, offsetX + paddingHorizontal, offsetY + paddingVertical + measure.actualBoundingBoxAscent, ); } </s> add </s> remove if (user.username) { pointerUsernames[socketID] = user.username; } </s> add
https://github.com/excalidraw/excalidraw/commit/db1f97f59ecf42d560ea088b6e1504c0266f03ba
src/components/App.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> } = decryptedData.payload; <mask> this.setState(state => { <mask> const user = state.collaborators.get(socketID) || {}; <mask> user.pointer = pointerCoords; <mask> user.username = username; <mask> state.collaborators.set(socketID, user); <mask> return state; <mask> }); <mask> break; <mask> } </s> Revert "[RFC] Randomized names next to mouse pointers. (#971)" (#972) This reverts commit dcb93f75e6b721738fad9d17d9197636fa8643cd. </s> remove const user = state.collaborators.get(socketID) || {}; </s> add if (!state.collaborators.has(socketID)) { state.collaborators.set(socketID, {}); } const user = state.collaborators.get(socketID)!; </s> remove const { socketID, pointerCoords, username, } = decryptedData.payload; </s> add const { socketID, pointerCoords } = decryptedData.payload; </s> remove const pointerUsernames: { [id: string]: string } = {}; </s> add </s> remove if (user.username) { pointerUsernames[socketID] = user.username; } </s> add </s> remove const username = sceneState.remotePointerUsernames[clientId]; </s> add </s> remove if (!isOutOfBounds && username) { const offsetX = x + width; const offsetY = y + height; const paddingHorizontal = 4; const paddingVertical = 4; const measure = context.measureText(username); const measureHeight = measure.actualBoundingBoxDescent + measure.actualBoundingBoxAscent; context.fillRect( offsetX, offsetY, measure.width + 2 * paddingHorizontal, measureHeight + 2 * paddingVertical, ); context.fillStyle = "white"; context.fillText( username, offsetX + paddingHorizontal, offsetY + paddingVertical + measure.actualBoundingBoxAscent, ); } </s> add
https://github.com/excalidraw/excalidraw/commit/db1f97f59ecf42d560ea088b6e1504c0266f03ba
src/components/App.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> type: "MOUSE_LOCATION", <mask> payload: { <mask> socketID: this.socket.id, <mask> pointerCoords: payload.pointerCoords, <mask> username: createNameFromSocketId(this.socket.id), <mask> }, <mask> }; <mask> return this._broadcastSocketData( <mask> data as typeof data & { _brand: "socketUpdateData" }, <mask> ); </s> Revert "[RFC] Randomized names next to mouse pointers. (#971)" (#972) This reverts commit dcb93f75e6b721738fad9d17d9197636fa8643cd. </s> remove username: string; </s> add </s> remove remotePointerUsernames: pointerUsernames, </s> add </s> remove remotePointerUsernames: {}, </s> add </s> remove if (user.username) { pointerUsernames[socketID] = user.username; } </s> add </s> remove const ADJ = [ "aggressive", "agreeable", "ambitious", "brave", "calm", "delightful", "eager", "faithful", "gentle", "happy", "jolly", "kind", "lively", "nice", "obedient", "polite", "proud", "silly", "thankful", "victorious", "witty", "wonderful", "zealous", ]; const NOUN = [ "alligator", "ant", "bear", "bee", "bird", "camel", "cat", "cheetah", "chicken", "chimpanzee", "cow", "crocodile", "deer", "dog", "dolphin", "duck", "eagle", "elephant", "fish", "fly", "fox", "frog", "giraffe", "goat", "goldfish", "hamster", "hippopotamus", "horse", "kangaroo", "kitten", "lion", "lobster", "monkey", "octopus", "owl", "panda", "pig", "puppy", "rabbit", "rat", "scorpion", "seal", "shark", "sheep", "snail", "snake", "spider", "squirrel", "tiger", "turtle", "wolf", "zebra", ]; export function createNameFromSocketId(socketId: string) { const buf = new Buffer(socketId, "utf8"); return [ ADJ[buf.readUInt32LE(0) % ADJ.length], NOUN[buf.readUInt32LE(4) % NOUN.length], ].join(" "); } </s> add </s> remove remotePointerUsernames: { [id: string]: string }; </s> add
https://github.com/excalidraw/excalidraw/commit/db1f97f59ecf42d560ea088b6e1504c0266f03ba
src/components/App.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> const pointerViewportCoords: { <mask> [id: string]: { x: number; y: number }; <mask> } = {}; <mask> const pointerUsernames: { [id: string]: string } = {}; <mask> this.state.collaborators.forEach((user, socketID) => { <mask> if (!user.pointer) { <mask> return; <mask> } <mask> pointerViewportCoords[socketID] = sceneCoordsToViewportCoords( </s> Revert "[RFC] Randomized names next to mouse pointers. (#971)" (#972) This reverts commit dcb93f75e6b721738fad9d17d9197636fa8643cd. </s> remove remotePointerUsernames: { [id: string]: string }; </s> add </s> remove collaborators: Map< string, { pointer?: { x: number; y: number }; username?: string } >; </s> add collaborators: Map<string, { pointer?: { x: number; y: number } }>; </s> remove const { socketID, pointerCoords, username, } = decryptedData.payload; </s> add const { socketID, pointerCoords } = decryptedData.payload; </s> remove const user = state.collaborators.get(socketID) || {}; </s> add if (!state.collaborators.has(socketID)) { state.collaborators.set(socketID, {}); } const user = state.collaborators.get(socketID)!; </s> remove user.username = username; </s> add </s> remove if (user.username) { pointerUsernames[socketID] = user.username; } </s> add
https://github.com/excalidraw/excalidraw/commit/db1f97f59ecf42d560ea088b6e1504c0266f03ba
src/components/App.tsx
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> this.state, <mask> this.canvas, <mask> window.devicePixelRatio, <mask> ); <mask> if (user.username) { <mask> pointerUsernames[socketID] = user.username; <mask> } <mask> }); <mask> const { atLeastOneVisibleElement, scrollBars } = renderScene( <mask> globalSceneState.getAllElements(), <mask> this.state, <mask> this.state.selectionElement, </s> Revert "[RFC] Randomized names next to mouse pointers. (#971)" (#972) This reverts commit dcb93f75e6b721738fad9d17d9197636fa8643cd. </s> remove const user = state.collaborators.get(socketID) || {}; </s> add if (!state.collaborators.has(socketID)) { state.collaborators.set(socketID, {}); } const user = state.collaborators.get(socketID)!; </s> remove const pointerUsernames: { [id: string]: string } = {}; </s> add </s> remove user.username = username; </s> add </s> remove const { socketID, pointerCoords, username, } = decryptedData.payload; </s> add const { socketID, pointerCoords } = decryptedData.payload; </s> remove if (!isOutOfBounds && username) { const offsetX = x + width; const offsetY = y + height; const paddingHorizontal = 4; const paddingVertical = 4; const measure = context.measureText(username); const measureHeight = measure.actualBoundingBoxDescent + measure.actualBoundingBoxAscent; context.fillRect( offsetX, offsetY, measure.width + 2 * paddingHorizontal, measureHeight + 2 * paddingVertical, ); context.fillStyle = "white"; context.fillText( username, offsetX + paddingHorizontal, offsetY + paddingVertical + measure.actualBoundingBoxAscent, ); } </s> add </s> remove const username = sceneState.remotePointerUsernames[clientId]; </s> add
https://github.com/excalidraw/excalidraw/commit/db1f97f59ecf42d560ea088b6e1504c0266f03ba
src/components/App.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> scrollY: this.state.scrollY, <mask> viewBackgroundColor: this.state.viewBackgroundColor, <mask> zoom: this.state.zoom, <mask> remotePointerViewportCoords: pointerViewportCoords, <mask> remotePointerUsernames: pointerUsernames, <mask> }, <mask> { <mask> renderOptimizations: true, <mask> }, <mask> ); </s> Revert "[RFC] Randomized names next to mouse pointers. (#971)" (#972) This reverts commit dcb93f75e6b721738fad9d17d9197636fa8643cd. </s> remove remotePointerUsernames: {}, </s> add </s> remove remotePointerUsernames: { [id: string]: string }; </s> add </s> remove username: createNameFromSocketId(this.socket.id), </s> add </s> remove if (user.username) { pointerUsernames[socketID] = user.username; } </s> add </s> remove collaborators: Map< string, { pointer?: { x: number; y: number }; username?: string } >; </s> add collaborators: Map<string, { pointer?: { x: number; y: number } }>; </s> remove const ADJ = [ "aggressive", "agreeable", "ambitious", "brave", "calm", "delightful", "eager", "faithful", "gentle", "happy", "jolly", "kind", "lively", "nice", "obedient", "polite", "proud", "silly", "thankful", "victorious", "witty", "wonderful", "zealous", ]; const NOUN = [ "alligator", "ant", "bear", "bee", "bird", "camel", "cat", "cheetah", "chicken", "chimpanzee", "cow", "crocodile", "deer", "dog", "dolphin", "duck", "eagle", "elephant", "fish", "fly", "fox", "frog", "giraffe", "goat", "goldfish", "hamster", "hippopotamus", "horse", "kangaroo", "kitten", "lion", "lobster", "monkey", "octopus", "owl", "panda", "pig", "puppy", "rabbit", "rat", "scorpion", "seal", "shark", "sheep", "snail", "snake", "spider", "squirrel", "tiger", "turtle", "wolf", "zebra", ]; export function createNameFromSocketId(socketId: string) { const buf = new Buffer(socketId, "utf8"); return [ ADJ[buf.readUInt32LE(0) % ADJ.length], NOUN[buf.readUInt32LE(4) % NOUN.length], ].join(" "); } </s> add
https://github.com/excalidraw/excalidraw/commit/db1f97f59ecf42d560ea088b6e1504c0266f03ba
src/components/App.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> type: "MOUSE_LOCATION"; <mask> payload: { <mask> socketID: string; <mask> pointerCoords: { x: number; y: number }; <mask> username: string; <mask> }; <mask> }; <mask> }; <mask> <mask> export type SocketUpdateDataIncoming = </s> Revert "[RFC] Randomized names next to mouse pointers. (#971)" (#972) This reverts commit dcb93f75e6b721738fad9d17d9197636fa8643cd. </s> remove username: createNameFromSocketId(this.socket.id), </s> add </s> remove collaborators: Map< string, { pointer?: { x: number; y: number }; username?: string } >; </s> add collaborators: Map<string, { pointer?: { x: number; y: number } }>; </s> remove remotePointerUsernames: { [id: string]: string }; </s> add </s> remove const pointerUsernames: { [id: string]: string } = {}; </s> add </s> remove const ADJ = [ "aggressive", "agreeable", "ambitious", "brave", "calm", "delightful", "eager", "faithful", "gentle", "happy", "jolly", "kind", "lively", "nice", "obedient", "polite", "proud", "silly", "thankful", "victorious", "witty", "wonderful", "zealous", ]; const NOUN = [ "alligator", "ant", "bear", "bee", "bird", "camel", "cat", "cheetah", "chicken", "chimpanzee", "cow", "crocodile", "deer", "dog", "dolphin", "duck", "eagle", "elephant", "fish", "fly", "fox", "frog", "giraffe", "goat", "goldfish", "hamster", "hippopotamus", "horse", "kangaroo", "kitten", "lion", "lobster", "monkey", "octopus", "owl", "panda", "pig", "puppy", "rabbit", "rat", "scorpion", "seal", "shark", "sheep", "snail", "snake", "spider", "squirrel", "tiger", "turtle", "wolf", "zebra", ]; export function createNameFromSocketId(socketId: string) { const buf = new Buffer(socketId, "utf8"); return [ ADJ[buf.readUInt32LE(0) % ADJ.length], NOUN[buf.readUInt32LE(4) % NOUN.length], ].join(" "); } </s> add </s> remove const { socketID, pointerCoords, username, } = decryptedData.payload; </s> add const { socketID, pointerCoords } = decryptedData.payload;
https://github.com/excalidraw/excalidraw/commit/db1f97f59ecf42d560ea088b6e1504c0266f03ba
src/data/index.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 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 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
<mask> elements: data.elements, <mask> appState: data.appState && { ...data.appState }, <mask> }; <mask> } <mask> <mask> const ADJ = [ <mask> "aggressive", <mask> "agreeable", <mask> "ambitious", <mask> "brave", <mask> "calm", <mask> "delightful", <mask> "eager", <mask> "faithful", <mask> "gentle", <mask> "happy", <mask> "jolly", <mask> "kind", <mask> "lively", <mask> "nice", <mask> "obedient", <mask> "polite", <mask> "proud", <mask> "silly", <mask> "thankful", <mask> "victorious", <mask> "witty", <mask> "wonderful", <mask> "zealous", <mask> ]; <mask> <mask> const NOUN = [ <mask> "alligator", <mask> "ant", <mask> "bear", <mask> "bee", <mask> "bird", <mask> "camel", <mask> "cat", <mask> "cheetah", <mask> "chicken", <mask> "chimpanzee", <mask> "cow", <mask> "crocodile", <mask> "deer", <mask> "dog", <mask> "dolphin", <mask> "duck", <mask> "eagle", <mask> "elephant", <mask> "fish", <mask> "fly", <mask> "fox", <mask> "frog", <mask> "giraffe", <mask> "goat", <mask> "goldfish", <mask> "hamster", <mask> "hippopotamus", <mask> "horse", <mask> "kangaroo", <mask> "kitten", <mask> "lion", <mask> "lobster", <mask> "monkey", <mask> "octopus", <mask> "owl", <mask> "panda", <mask> "pig", <mask> "puppy", <mask> "rabbit", <mask> "rat", <mask> "scorpion", <mask> "seal", <mask> "shark", <mask> "sheep", <mask> "snail", <mask> "snake", <mask> "spider", <mask> "squirrel", <mask> "tiger", <mask> "turtle", <mask> "wolf", <mask> "zebra", <mask> ]; <mask> <mask> export function createNameFromSocketId(socketId: string) { <mask> const buf = new Buffer(socketId, "utf8"); <mask> <mask> return [ <mask> ADJ[buf.readUInt32LE(0) % ADJ.length], <mask> NOUN[buf.readUInt32LE(4) % NOUN.length], <mask> ].join(" "); <mask> } </s> Revert "[RFC] Randomized names next to mouse pointers. (#971)" (#972) This reverts commit dcb93f75e6b721738fad9d17d9197636fa8643cd. </s> remove const user = state.collaborators.get(socketID) || {}; </s> add if (!state.collaborators.has(socketID)) { state.collaborators.set(socketID, {}); } const user = state.collaborators.get(socketID)!; </s> remove const pointerUsernames: { [id: string]: string } = {}; </s> add </s> remove const { socketID, pointerCoords, username, } = decryptedData.payload; </s> add const { socketID, pointerCoords } = decryptedData.payload; </s> remove user.username = username; </s> add </s> remove const username = sceneState.remotePointerUsernames[clientId]; </s> add </s> remove if (!isOutOfBounds && username) { const offsetX = x + width; const offsetY = y + height; const paddingHorizontal = 4; const paddingVertical = 4; const measure = context.measureText(username); const measureHeight = measure.actualBoundingBoxDescent + measure.actualBoundingBoxAscent; context.fillRect( offsetX, offsetY, measure.width + 2 * paddingHorizontal, measureHeight + 2 * paddingVertical, ); context.fillStyle = "white"; context.fillText( username, offsetX + paddingHorizontal, offsetY + paddingVertical + measure.actualBoundingBoxAscent, ); } </s> add
https://github.com/excalidraw/excalidraw/commit/db1f97f59ecf42d560ea088b6e1504c0266f03ba
src/data/index.ts
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> // Paint remote pointers <mask> for (const clientId in sceneState.remotePointerViewportCoords) { <mask> let { x, y } = sceneState.remotePointerViewportCoords[clientId]; <mask> const username = sceneState.remotePointerUsernames[clientId]; <mask> <mask> const width = 9; <mask> const height = 14; <mask> <mask> const isOutOfBounds = </s> Revert "[RFC] Randomized names next to mouse pointers. (#971)" (#972) This reverts commit dcb93f75e6b721738fad9d17d9197636fa8643cd. </s> remove if (!isOutOfBounds && username) { const offsetX = x + width; const offsetY = y + height; const paddingHorizontal = 4; const paddingVertical = 4; const measure = context.measureText(username); const measureHeight = measure.actualBoundingBoxDescent + measure.actualBoundingBoxAscent; context.fillRect( offsetX, offsetY, measure.width + 2 * paddingHorizontal, measureHeight + 2 * paddingVertical, ); context.fillStyle = "white"; context.fillText( username, offsetX + paddingHorizontal, offsetY + paddingVertical + measure.actualBoundingBoxAscent, ); } </s> add </s> remove const { socketID, pointerCoords, username, } = decryptedData.payload; </s> add const { socketID, pointerCoords } = decryptedData.payload; </s> remove const user = state.collaborators.get(socketID) || {}; </s> add if (!state.collaborators.has(socketID)) { state.collaborators.set(socketID, {}); } const user = state.collaborators.get(socketID)!; </s> remove const pointerUsernames: { [id: string]: string } = {}; </s> add </s> remove user.username = username; </s> add </s> remove if (user.username) { pointerUsernames[socketID] = user.username; } </s> add
https://github.com/excalidraw/excalidraw/commit/db1f97f59ecf42d560ea088b6e1504c0266f03ba
src/renderer/renderScene.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 keep keep keep keep keep
<mask> context.lineTo(x + 9, y + 10); <mask> context.lineTo(x, y); <mask> context.fill(); <mask> context.stroke(); <mask> <mask> if (!isOutOfBounds && username) { <mask> const offsetX = x + width; <mask> const offsetY = y + height; <mask> const paddingHorizontal = 4; <mask> const paddingVertical = 4; <mask> const measure = context.measureText(username); <mask> const measureHeight = <mask> measure.actualBoundingBoxDescent + measure.actualBoundingBoxAscent; <mask> <mask> context.fillRect( <mask> offsetX, <mask> offsetY, <mask> measure.width + 2 * paddingHorizontal, <mask> measureHeight + 2 * paddingVertical, <mask> ); <mask> context.fillStyle = "white"; <mask> context.fillText( <mask> username, <mask> offsetX + paddingHorizontal, <mask> offsetY + paddingVertical + measure.actualBoundingBoxAscent, <mask> ); <mask> } <mask> <mask> context.strokeStyle = strokeStyle; <mask> context.fillStyle = fillStyle; <mask> context.globalAlpha = globalAlpha; <mask> } <mask> </s> Revert "[RFC] Randomized names next to mouse pointers. (#971)" (#972) This reverts commit dcb93f75e6b721738fad9d17d9197636fa8643cd. </s> remove remotePointerUsernames: {}, </s> add </s> remove const username = sceneState.remotePointerUsernames[clientId]; </s> add </s> remove const { socketID, pointerCoords, username, } = decryptedData.payload; </s> add const { socketID, pointerCoords } = decryptedData.payload; </s> remove const user = state.collaborators.get(socketID) || {}; </s> add if (!state.collaborators.has(socketID)) { state.collaborators.set(socketID, {}); } const user = state.collaborators.get(socketID)!; </s> remove if (user.username) { pointerUsernames[socketID] = user.username; } </s> add </s> remove const pointerUsernames: { [id: string]: string } = {}; </s> add
https://github.com/excalidraw/excalidraw/commit/db1f97f59ecf42d560ea088b6e1504c0266f03ba
src/renderer/renderScene.ts
keep keep keep keep replace keep keep keep keep keep
<mask> scrollX: normalizeScroll(-minX + exportPadding), <mask> scrollY: normalizeScroll(-minY + exportPadding), <mask> zoom: 1, <mask> remotePointerViewportCoords: {}, <mask> remotePointerUsernames: {}, <mask> }, <mask> { <mask> renderScrollbars: false, <mask> renderSelection: false, <mask> renderOptimizations: false, </s> Revert "[RFC] Randomized names next to mouse pointers. (#971)" (#972) This reverts commit dcb93f75e6b721738fad9d17d9197636fa8643cd. </s> remove remotePointerUsernames: pointerUsernames, </s> add </s> remove remotePointerUsernames: { [id: string]: string }; </s> add </s> remove if (!isOutOfBounds && username) { const offsetX = x + width; const offsetY = y + height; const paddingHorizontal = 4; const paddingVertical = 4; const measure = context.measureText(username); const measureHeight = measure.actualBoundingBoxDescent + measure.actualBoundingBoxAscent; context.fillRect( offsetX, offsetY, measure.width + 2 * paddingHorizontal, measureHeight + 2 * paddingVertical, ); context.fillStyle = "white"; context.fillText( username, offsetX + paddingHorizontal, offsetY + paddingVertical + measure.actualBoundingBoxAscent, ); } </s> add </s> remove username: createNameFromSocketId(this.socket.id), </s> add </s> remove collaborators: Map< string, { pointer?: { x: number; y: number }; username?: string } >; </s> add collaborators: Map<string, { pointer?: { x: number; y: number } }>; </s> remove const pointerUsernames: { [id: string]: string } = {}; </s> add
https://github.com/excalidraw/excalidraw/commit/db1f97f59ecf42d560ea088b6e1504c0266f03ba
src/scene/export.ts
keep keep keep keep replace keep keep keep keep keep
<mask> // null indicates transparent bg <mask> viewBackgroundColor: string | null; <mask> zoom: number; <mask> remotePointerViewportCoords: { [id: string]: { x: number; y: number } }; <mask> remotePointerUsernames: { [id: string]: string }; <mask> }; <mask> <mask> export type SceneScroll = { <mask> scrollX: FlooredNumber; <mask> scrollY: FlooredNumber; </s> Revert "[RFC] Randomized names next to mouse pointers. (#971)" (#972) This reverts commit dcb93f75e6b721738fad9d17d9197636fa8643cd. </s> remove collaborators: Map< string, { pointer?: { x: number; y: number }; username?: string } >; </s> add collaborators: Map<string, { pointer?: { x: number; y: number } }>; </s> remove const pointerUsernames: { [id: string]: string } = {}; </s> add </s> remove username: string; </s> add </s> remove remotePointerUsernames: pointerUsernames, </s> add </s> remove remotePointerUsernames: {}, </s> add </s> remove const username = sceneState.remotePointerUsernames[clientId]; </s> add
https://github.com/excalidraw/excalidraw/commit/db1f97f59ecf42d560ea088b6e1504c0266f03ba
src/scene/types.ts
keep keep keep keep replace replace replace replace keep keep keep keep keep
<mask> zoom: number; <mask> openMenu: "canvas" | "shape" | null; <mask> lastPointerDownWith: PointerType; <mask> selectedElementIds: { [id: string]: boolean }; <mask> collaborators: Map< <mask> string, <mask> { pointer?: { x: number; y: number }; username?: string } <mask> >; <mask> }; <mask> <mask> export type PointerCoords = Readonly<{ <mask> x: number; <mask> y: number; </s> Revert "[RFC] Randomized names next to mouse pointers. (#971)" (#972) This reverts commit dcb93f75e6b721738fad9d17d9197636fa8643cd. </s> remove remotePointerUsernames: { [id: string]: string }; </s> add </s> remove const pointerUsernames: { [id: string]: string } = {}; </s> add </s> remove username: string; </s> add </s> remove const { socketID, pointerCoords, username, } = decryptedData.payload; </s> add const { socketID, pointerCoords } = decryptedData.payload; </s> remove if (user.username) { pointerUsernames[socketID] = user.username; } </s> add </s> remove const user = state.collaborators.get(socketID) || {}; </s> add if (!state.collaborators.has(socketID)) { state.collaborators.set(socketID, {}); } const user = state.collaborators.get(socketID)!;
https://github.com/excalidraw/excalidraw/commit/db1f97f59ecf42d560ea088b6e1504c0266f03ba
src/types.ts
keep add keep keep keep keep keep keep
<mask> SOCKET_SERVER, <mask> SocketUpdateDataSource, <mask> } from "../data"; <mask> import { restore } from "../data/restore"; <mask> <mask> import { renderScene } from "../renderer"; <mask> import { AppState, GestureEvent, Gesture } from "../types"; <mask> import { ExcalidrawElement } from "../element/types"; </s> Add copy to PNG option on context menu (#941) * Add copy to PNG option on context menu * lint & refactor & fixes * add keybinding * swap keybinding * fix docs Co-authored-by: dwelle <[email protected]> </s> remove import { copyToAppClipboard, getClipboardContent } from "../clipboard"; </s> add import { copyToAppClipboard, getClipboardContent, probablySupportsClipboardBlob, } from "../clipboard"; </s> add if (event.code === "KeyC" && event.altKey && event.shiftKey) { this.copyToClipboardAsPng(); event.preventDefault(); return; } </s> add probablySupportsClipboardBlob && { label: t("labels.copyAsPng"), action: this.copyToClipboardAsPng, }, </s> add private copyToClipboardAsPng = () => { const selectedElements = getSelectedElements(elements, this.state); exportCanvas( "clipboard", selectedElements.length ? selectedElements : elements, this.state, this.canvas!, this.state, ); }; </s> add probablySupportsClipboardBlob && elements.length > 0 && { label: t("labels.copyAsPng"), action: this.copyToClipboardAsPng, }, </s> add "copyAsPng": "Kopier til PNG",
https://github.com/excalidraw/excalidraw/commit/dbfc8bee5740156d9cebc54138f98f114c0ec71b
src/components/App.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> import { ActionResult } from "../actions/types"; <mask> import { getDefaultAppState } from "../appState"; <mask> import { t, getLanguage } from "../i18n"; <mask> <mask> import { copyToAppClipboard, getClipboardContent } from "../clipboard"; <mask> import { normalizeScroll } from "../scene"; <mask> import { getCenter, getDistance } from "../gesture"; <mask> import { createUndoAction, createRedoAction } from "../actions/actionHistory"; <mask> import { <mask> CURSOR_TYPE, </s> Add copy to PNG option on context menu (#941) * Add copy to PNG option on context menu * lint & refactor & fixes * add keybinding * swap keybinding * fix docs Co-authored-by: dwelle <[email protected]> </s> add exportCanvas, </s> add if (event.code === "KeyC" && event.altKey && event.shiftKey) { this.copyToClipboardAsPng(); event.preventDefault(); return; } </s> add probablySupportsClipboardBlob && { label: t("labels.copyAsPng"), action: this.copyToClipboardAsPng, }, </s> add private copyToClipboardAsPng = () => { const selectedElements = getSelectedElements(elements, this.state); exportCanvas( "clipboard", selectedElements.length ? selectedElements : elements, this.state, this.canvas!, this.state, ); }; </s> add probablySupportsClipboardBlob && elements.length > 0 && { label: t("labels.copyAsPng"), action: this.copyToClipboardAsPng, }, </s> add "copyAsPng": "Kopier til PNG",
https://github.com/excalidraw/excalidraw/commit/dbfc8bee5740156d9cebc54138f98f114c0ec71b
src/components/App.tsx
keep add keep keep keep keep
<mask> } <mask> <mask> if (this.actionManager.handleKeyDown(event)) { <mask> return; <mask> } <mask> </s> Add copy to PNG option on context menu (#941) * Add copy to PNG option on context menu * lint & refactor & fixes * add keybinding * swap keybinding * fix docs Co-authored-by: dwelle <[email protected]> </s> remove import { copyToAppClipboard, getClipboardContent } from "../clipboard"; </s> add import { copyToAppClipboard, getClipboardContent, probablySupportsClipboardBlob, } from "../clipboard"; </s> add exportCanvas, </s> add private copyToClipboardAsPng = () => { const selectedElements = getSelectedElements(elements, this.state); exportCanvas( "clipboard", selectedElements.length ? selectedElements : elements, this.state, this.canvas!, this.state, ); }; </s> add probablySupportsClipboardBlob && { label: t("labels.copyAsPng"), action: this.copyToClipboardAsPng, }, </s> add probablySupportsClipboardBlob && elements.length > 0 && { label: t("labels.copyAsPng"), action: this.copyToClipboardAsPng, }, </s> add "copyAsPng": "Kopier til PNG",
https://github.com/excalidraw/excalidraw/commit/dbfc8bee5740156d9cebc54138f98f114c0ec71b
src/components/App.tsx
keep keep add keep keep keep keep keep keep
<mask> copyToAppClipboard(elements, this.state); <mask> }; <mask> <mask> private pasteFromClipboard = async (event: ClipboardEvent | null) => { <mask> // #686 <mask> const target = document.activeElement; <mask> const elementUnderCursor = document.elementFromPoint(cursorX, cursorY); <mask> if ( <mask> // if no ClipboardEvent supplied, assume we're pasting via contextMenu </s> Add copy to PNG option on context menu (#941) * Add copy to PNG option on context menu * lint & refactor & fixes * add keybinding * swap keybinding * fix docs Co-authored-by: dwelle <[email protected]> </s> add if (event.code === "KeyC" && event.altKey && event.shiftKey) { this.copyToClipboardAsPng(); event.preventDefault(); return; } </s> add probablySupportsClipboardBlob && { label: t("labels.copyAsPng"), action: this.copyToClipboardAsPng, }, </s> add probablySupportsClipboardBlob && elements.length > 0 && { label: t("labels.copyAsPng"), action: this.copyToClipboardAsPng, }, </s> remove import { copyToAppClipboard, getClipboardContent } from "../clipboard"; </s> add import { copyToAppClipboard, getClipboardContent, probablySupportsClipboardBlob, } from "../clipboard"; </s> add exportCanvas, </s> add "copyAsPng": "Kopier til PNG",
https://github.com/excalidraw/excalidraw/commit/dbfc8bee5740156d9cebc54138f98f114c0ec71b
src/components/App.tsx
keep keep add keep keep keep keep keep
<mask> label: t("labels.paste"), <mask> action: () => this.pasteFromClipboard(null), <mask> }, <mask> ...this.actionManager.getContextMenuItems(action => <mask> this.canvasOnlyActions.includes(action.name), <mask> ), <mask> ], <mask> top: event.clientY, </s> Add copy to PNG option on context menu (#941) * Add copy to PNG option on context menu * lint & refactor & fixes * add keybinding * swap keybinding * fix docs Co-authored-by: dwelle <[email protected]> </s> add probablySupportsClipboardBlob && { label: t("labels.copyAsPng"), action: this.copyToClipboardAsPng, }, </s> add private copyToClipboardAsPng = () => { const selectedElements = getSelectedElements(elements, this.state); exportCanvas( "clipboard", selectedElements.length ? selectedElements : elements, this.state, this.canvas!, this.state, ); }; </s> add "copyAsPng": "Kopier til PNG", </s> add "copyAsPng": "Copy to clipboard as PNG", </s> add if (event.code === "KeyC" && event.altKey && event.shiftKey) { this.copyToClipboardAsPng(); event.preventDefault(); return; } </s> remove import { copyToAppClipboard, getClipboardContent } from "../clipboard"; </s> add import { copyToAppClipboard, getClipboardContent, probablySupportsClipboardBlob, } from "../clipboard";
https://github.com/excalidraw/excalidraw/commit/dbfc8bee5740156d9cebc54138f98f114c0ec71b
src/components/App.tsx
keep keep add keep keep keep keep keep
<mask> label: t("labels.paste"), <mask> action: () => this.pasteFromClipboard(null), <mask> }, <mask> ...this.actionManager.getContextMenuItems( <mask> action => !this.canvasOnlyActions.includes(action.name), <mask> ), <mask> ], <mask> top: event.clientY, </s> Add copy to PNG option on context menu (#941) * Add copy to PNG option on context menu * lint & refactor & fixes * add keybinding * swap keybinding * fix docs Co-authored-by: dwelle <[email protected]> </s> add probablySupportsClipboardBlob && elements.length > 0 && { label: t("labels.copyAsPng"), action: this.copyToClipboardAsPng, }, </s> add private copyToClipboardAsPng = () => { const selectedElements = getSelectedElements(elements, this.state); exportCanvas( "clipboard", selectedElements.length ? selectedElements : elements, this.state, this.canvas!, this.state, ); }; </s> add "copyAsPng": "Kopier til PNG", </s> add "copyAsPng": "Copy to clipboard as PNG", </s> add if (event.code === "KeyC" && event.altKey && event.shiftKey) { this.copyToClipboardAsPng(); event.preventDefault(); return; } </s> remove import { copyToAppClipboard, getClipboardContent } from "../clipboard"; </s> add import { copyToAppClipboard, getClipboardContent, probablySupportsClipboardBlob, } from "../clipboard";
https://github.com/excalidraw/excalidraw/commit/dbfc8bee5740156d9cebc54138f98f114c0ec71b
src/components/App.tsx
keep add keep keep keep keep keep keep
<mask> "selectAll": "Select All", <mask> "copy": "Copy", <mask> "bringForward": "Bring Forward", <mask> "sendToBack": "Send To Back", <mask> "bringToFront": "Bring To Front", <mask> "sendBackward": "Send Backward", <mask> "delete": "Delete", <mask> "copyStyles": "Copy Styles", </s> Add copy to PNG option on context menu (#941) * Add copy to PNG option on context menu * lint & refactor & fixes * add keybinding * swap keybinding * fix docs Co-authored-by: dwelle <[email protected]> </s> add "copyAsPng": "Kopier til PNG", </s> add probablySupportsClipboardBlob && { label: t("labels.copyAsPng"), action: this.copyToClipboardAsPng, }, </s> add probablySupportsClipboardBlob && elements.length > 0 && { label: t("labels.copyAsPng"), action: this.copyToClipboardAsPng, }, </s> add private copyToClipboardAsPng = () => { const selectedElements = getSelectedElements(elements, this.state); exportCanvas( "clipboard", selectedElements.length ? selectedElements : elements, this.state, this.canvas!, this.state, ); }; </s> add if (event.code === "KeyC" && event.altKey && event.shiftKey) { this.copyToClipboardAsPng(); event.preventDefault(); return; } </s> remove import { copyToAppClipboard, getClipboardContent } from "../clipboard"; </s> add import { copyToAppClipboard, getClipboardContent, probablySupportsClipboardBlob, } from "../clipboard";
https://github.com/excalidraw/excalidraw/commit/dbfc8bee5740156d9cebc54138f98f114c0ec71b
src/locales/en.json
keep add keep keep keep keep keep
<mask> "selectAll": "Velg alt", <mask> "copy": "Kopier", <mask> "bringForward": "Flytt framover", <mask> "sendToBack": "Flytt bakover", <mask> "bringToFront": "Flytt forrest", <mask> "sendBackward": "Flytt bakerst", <mask> "delete": "Slett", </s> Add copy to PNG option on context menu (#941) * Add copy to PNG option on context menu * lint & refactor & fixes * add keybinding * swap keybinding * fix docs Co-authored-by: dwelle <[email protected]> </s> add "copyAsPng": "Copy to clipboard as PNG", </s> add probablySupportsClipboardBlob && { label: t("labels.copyAsPng"), action: this.copyToClipboardAsPng, }, </s> add probablySupportsClipboardBlob && elements.length > 0 && { label: t("labels.copyAsPng"), action: this.copyToClipboardAsPng, }, </s> add private copyToClipboardAsPng = () => { const selectedElements = getSelectedElements(elements, this.state); exportCanvas( "clipboard", selectedElements.length ? selectedElements : elements, this.state, this.canvas!, this.state, ); }; </s> add if (event.code === "KeyC" && event.altKey && event.shiftKey) { this.copyToClipboardAsPng(); event.preventDefault(); return; } </s> remove import { copyToAppClipboard, getClipboardContent } from "../clipboard"; </s> add import { copyToAppClipboard, getClipboardContent, probablySupportsClipboardBlob, } from "../clipboard";
https://github.com/excalidraw/excalidraw/commit/dbfc8bee5740156d9cebc54138f98f114c0ec71b
src/locales/no.json
keep keep keep keep replace replace replace replace keep keep keep keep keep
<mask> ) { <mask> this.broadcastSceneUpdate(); <mask> } <mask> <mask> if (history.isRecording()) { <mask> history.pushEntry(this.state, globalSceneState.getAllElements()); <mask> history.skipRecording(); <mask> } <mask> } <mask> } <mask> <mask> // ----------------------------------------------------------------------------- <mask> // TEST HOOKS </s> Encapsulate SceneHistory. A little. (#1016) </s> remove isRecording() { return this.recording; } skipRecording() { this.recording = false; } </s> add // Suspicious that this is called so many places. Seems error-prone. </s> add record(state: AppState, elements: readonly ExcalidrawElement[]) { if (this.recording) { this.pushEntry(state, elements); this.recording = false; } }
https://github.com/excalidraw/excalidraw/commit/dc618ab12249aac9dadf757ca9c10540e3ebcf5f
src/components/App.tsx
keep keep keep keep replace replace replace replace replace replace replace replace keep keep keep keep keep
<mask> <mask> return null; <mask> } <mask> <mask> isRecording() { <mask> return this.recording; <mask> } <mask> <mask> skipRecording() { <mask> this.recording = false; <mask> } <mask> <mask> resumeRecording() { <mask> this.recording = true; <mask> } <mask> } <mask> </s> Encapsulate SceneHistory. A little. (#1016) </s> add record(state: AppState, elements: readonly ExcalidrawElement[]) { if (this.recording) { this.pushEntry(state, elements); this.recording = false; } } </s> remove if (history.isRecording()) { history.pushEntry(this.state, globalSceneState.getAllElements()); history.skipRecording(); } </s> add history.record(this.state, globalSceneState.getAllElements());
https://github.com/excalidraw/excalidraw/commit/dc618ab12249aac9dadf757ca9c10540e3ebcf5f
src/history.ts
keep keep keep add keep keep keep keep keep keep
<mask> // Suspicious that this is called so many places. Seems error-prone. <mask> resumeRecording() { <mask> this.recording = true; <mask> } <mask> } <mask> <mask> export const createHistory: () => { history: SceneHistory } = () => { <mask> const history = new SceneHistory(); <mask> return { history }; <mask> }; </s> Encapsulate SceneHistory. A little. (#1016) </s> remove isRecording() { return this.recording; } skipRecording() { this.recording = false; } </s> add // Suspicious that this is called so many places. Seems error-prone. </s> remove if (history.isRecording()) { history.pushEntry(this.state, globalSceneState.getAllElements()); history.skipRecording(); } </s> add history.record(this.state, globalSceneState.getAllElements());
https://github.com/excalidraw/excalidraw/commit/dc618ab12249aac9dadf757ca9c10540e3ebcf5f
src/history.ts
keep keep add keep keep keep keep keep
<mask> SOCKET_SERVER, <mask> SocketUpdateDataSource, <mask> exportCanvas, <mask> } from "../data"; <mask> import { restore } from "../data/restore"; <mask> <mask> import { renderScene } from "../renderer"; <mask> import { AppState, GestureEvent, Gesture } from "../types"; </s> [RFC] Randomized names next to mouse pointers. (#971) * [WIP] Add names next to pointers This implements the rendering and messaging across. Still need to do the UI to set the name. Also, not really sure what's the best place to send the name and store it. * Add randomized names Co-authored-by: Christopher Chedeau <[email protected]> </s> add const pointerUsernames: { [id: string]: string } = {}; </s> remove const { socketID, pointerCoords } = decryptedData.payload; </s> add const { socketID, pointerCoords, username, } = decryptedData.payload; </s> add if (user.username) { pointerUsernames[socketID] = user.username; } </s> remove if (!state.collaborators.has(socketID)) { state.collaborators.set(socketID, {}); } const user = state.collaborators.get(socketID)!; </s> add const user = state.collaborators.get(socketID) || {}; </s> remove collaborators: Map<string, { pointer?: { x: number; y: number } }>; </s> add collaborators: Map< string, { pointer?: { x: number; y: number }; username?: string } >; </s> add remotePointerUsernames: { [id: string]: string };
https://github.com/excalidraw/excalidraw/commit/dcb93f75e6b721738fad9d17d9197636fa8643cd
src/components/App.tsx
keep replace keep replace replace replace replace keep keep keep
<mask> case "MOUSE_LOCATION": <mask> const { socketID, pointerCoords } = decryptedData.payload; <mask> this.setState(state => { <mask> if (!state.collaborators.has(socketID)) { <mask> state.collaborators.set(socketID, {}); <mask> } <mask> const user = state.collaborators.get(socketID)!; <mask> user.pointer = pointerCoords; <mask> state.collaborators.set(socketID, user); <mask> return state; </s> [RFC] Randomized names next to mouse pointers. (#971) * [WIP] Add names next to pointers This implements the rendering and messaging across. Still need to do the UI to set the name. Also, not really sure what's the best place to send the name and store it. * Add randomized names Co-authored-by: Christopher Chedeau <[email protected]> </s> add user.username = username; </s> add const pointerUsernames: { [id: string]: string } = {}; </s> add if (user.username) { pointerUsernames[socketID] = user.username; } </s> add const username = sceneState.remotePointerUsernames[clientId]; </s> add remotePointerUsernames: { [id: string]: string };
https://github.com/excalidraw/excalidraw/commit/dcb93f75e6b721738fad9d17d9197636fa8643cd
src/components/App.tsx
keep keep keep add keep keep keep keep keep keep
<mask> } = decryptedData.payload; <mask> this.setState(state => { <mask> const user = state.collaborators.get(socketID) || {}; <mask> user.pointer = pointerCoords; <mask> state.collaborators.set(socketID, user); <mask> return state; <mask> }); <mask> break; <mask> } <mask> }, </s> [RFC] Randomized names next to mouse pointers. (#971) * [WIP] Add names next to pointers This implements the rendering and messaging across. Still need to do the UI to set the name. Also, not really sure what's the best place to send the name and store it. * Add randomized names Co-authored-by: Christopher Chedeau <[email protected]> </s> remove if (!state.collaborators.has(socketID)) { state.collaborators.set(socketID, {}); } const user = state.collaborators.get(socketID)!; </s> add const user = state.collaborators.get(socketID) || {}; </s> remove const { socketID, pointerCoords } = decryptedData.payload; </s> add const { socketID, pointerCoords, username, } = decryptedData.payload; </s> add const pointerUsernames: { [id: string]: string } = {}; </s> add if (user.username) { pointerUsernames[socketID] = user.username; } </s> add const username = sceneState.remotePointerUsernames[clientId]; </s> add username: createNameFromSocketId(this.socket.id),
https://github.com/excalidraw/excalidraw/commit/dcb93f75e6b721738fad9d17d9197636fa8643cd
src/components/App.tsx
keep keep add keep keep keep keep keep keep
<mask> payload: { <mask> socketID: this.socket.id, <mask> pointerCoords: payload.pointerCoords, <mask> }, <mask> }; <mask> return this._broadcastSocketData( <mask> data as typeof data & { _brand: "socketUpdateData" }, <mask> ); <mask> } </s> [RFC] Randomized names next to mouse pointers. (#971) * [WIP] Add names next to pointers This implements the rendering and messaging across. Still need to do the UI to set the name. Also, not really sure what's the best place to send the name and store it. * Add randomized names Co-authored-by: Christopher Chedeau <[email protected]> </s> add username: string; </s> add remotePointerUsernames: pointerUsernames, </s> add user.username = username; </s> add if (user.username) { pointerUsernames[socketID] = user.username; } </s> add remotePointerUsernames: {}, </s> remove if (!state.collaborators.has(socketID)) { state.collaborators.set(socketID, {}); } const user = state.collaborators.get(socketID)!; </s> add const user = state.collaborators.get(socketID) || {};
https://github.com/excalidraw/excalidraw/commit/dcb93f75e6b721738fad9d17d9197636fa8643cd
src/components/App.tsx
keep keep keep add keep keep keep keep
<mask> } <mask> const pointerViewportCoords: { <mask> [id: string]: { x: number; y: number }; <mask> } = {}; <mask> this.state.collaborators.forEach((user, socketID) => { <mask> if (!user.pointer) { <mask> return; <mask> } </s> [RFC] Randomized names next to mouse pointers. (#971) * [WIP] Add names next to pointers This implements the rendering and messaging across. Still need to do the UI to set the name. Also, not really sure what's the best place to send the name and store it. * Add randomized names Co-authored-by: Christopher Chedeau <[email protected]> </s> add remotePointerUsernames: { [id: string]: string }; </s> remove collaborators: Map<string, { pointer?: { x: number; y: number } }>; </s> add collaborators: Map< string, { pointer?: { x: number; y: number }; username?: string } >; </s> remove const { socketID, pointerCoords } = decryptedData.payload; </s> add const { socketID, pointerCoords, username, } = decryptedData.payload; </s> remove if (!state.collaborators.has(socketID)) { state.collaborators.set(socketID, {}); } const user = state.collaborators.get(socketID)!; </s> add const user = state.collaborators.get(socketID) || {}; </s> add username: string; </s> add user.username = username;
https://github.com/excalidraw/excalidraw/commit/dcb93f75e6b721738fad9d17d9197636fa8643cd
src/components/App.tsx
keep keep keep add keep keep keep keep
<mask> this.state, <mask> this.canvas, <mask> window.devicePixelRatio, <mask> ); <mask> }); <mask> const { atLeastOneVisibleElement, scrollBars } = renderScene( <mask> globalSceneState.getAllElements(), <mask> this.state, </s> [RFC] Randomized names next to mouse pointers. (#971) * [WIP] Add names next to pointers This implements the rendering and messaging across. Still need to do the UI to set the name. Also, not really sure what's the best place to send the name and store it. * Add randomized names Co-authored-by: Christopher Chedeau <[email protected]> </s> add user.username = username; </s> remove if (!state.collaborators.has(socketID)) { state.collaborators.set(socketID, {}); } const user = state.collaborators.get(socketID)!; </s> add const user = state.collaborators.get(socketID) || {}; </s> remove const { socketID, pointerCoords } = decryptedData.payload; </s> add const { socketID, pointerCoords, username, } = decryptedData.payload; </s> add const pointerUsernames: { [id: string]: string } = {}; </s> add username: createNameFromSocketId(this.socket.id), </s> add const username = sceneState.remotePointerUsernames[clientId];
https://github.com/excalidraw/excalidraw/commit/dcb93f75e6b721738fad9d17d9197636fa8643cd
src/components/App.tsx
keep keep add keep keep keep keep keep
<mask> viewBackgroundColor: this.state.viewBackgroundColor, <mask> zoom: this.state.zoom, <mask> remotePointerViewportCoords: pointerViewportCoords, <mask> }, <mask> { <mask> renderOptimizations: true, <mask> }, <mask> ); </s> [RFC] Randomized names next to mouse pointers. (#971) * [WIP] Add names next to pointers This implements the rendering and messaging across. Still need to do the UI to set the name. Also, not really sure what's the best place to send the name and store it. * Add randomized names Co-authored-by: Christopher Chedeau <[email protected]> </s> add remotePointerUsernames: {}, </s> add username: createNameFromSocketId(this.socket.id), </s> add remotePointerUsernames: { [id: string]: string }; </s> add user.username = username; </s> add if (user.username) { pointerUsernames[socketID] = user.username; } </s> remove collaborators: Map<string, { pointer?: { x: number; y: number } }>; </s> add collaborators: Map< string, { pointer?: { x: number; y: number }; username?: string } >;
https://github.com/excalidraw/excalidraw/commit/dcb93f75e6b721738fad9d17d9197636fa8643cd
src/components/App.tsx
keep add keep keep keep keep keep
<mask> socketID: string; <mask> pointerCoords: { x: number; y: number }; <mask> }; <mask> }; <mask> }; <mask> <mask> export type SocketUpdateDataIncoming = </s> [RFC] Randomized names next to mouse pointers. (#971) * [WIP] Add names next to pointers This implements the rendering and messaging across. Still need to do the UI to set the name. Also, not really sure what's the best place to send the name and store it. * Add randomized names Co-authored-by: Christopher Chedeau <[email protected]> </s> add remotePointerUsernames: { [id: string]: string }; </s> remove collaborators: Map<string, { pointer?: { x: number; y: number } }>; </s> add collaborators: Map< string, { pointer?: { x: number; y: number }; username?: string } >; </s> add username: createNameFromSocketId(this.socket.id), </s> add const pointerUsernames: { [id: string]: string } = {}; </s> remove const { socketID, pointerCoords } = decryptedData.payload; </s> add const { socketID, pointerCoords, username, } = decryptedData.payload; </s> add const username = sceneState.remotePointerUsernames[clientId];
https://github.com/excalidraw/excalidraw/commit/dcb93f75e6b721738fad9d17d9197636fa8643cd
src/data/index.ts
keep add keep keep keep keep
<mask> for (const clientId in sceneState.remotePointerViewportCoords) { <mask> let { x, y } = sceneState.remotePointerViewportCoords[clientId]; <mask> <mask> const width = 9; <mask> const height = 14; <mask> </s> [RFC] Randomized names next to mouse pointers. (#971) * [WIP] Add names next to pointers This implements the rendering and messaging across. Still need to do the UI to set the name. Also, not really sure what's the best place to send the name and store it. * Add randomized names Co-authored-by: Christopher Chedeau <[email protected]> </s> remove const { socketID, pointerCoords } = decryptedData.payload; </s> add const { socketID, pointerCoords, username, } = decryptedData.payload; </s> add const pointerUsernames: { [id: string]: string } = {}; </s> remove if (!state.collaborators.has(socketID)) { state.collaborators.set(socketID, {}); } const user = state.collaborators.get(socketID)!; </s> add const user = state.collaborators.get(socketID) || {}; </s> add if (user.username) { pointerUsernames[socketID] = user.username; } </s> add user.username = username; </s> add remotePointerUsernames: { [id: string]: string };
https://github.com/excalidraw/excalidraw/commit/dcb93f75e6b721738fad9d17d9197636fa8643cd
src/renderer/renderScene.ts
keep add keep keep keep keep
<mask> zoom: 1, <mask> remotePointerViewportCoords: {}, <mask> }, <mask> { <mask> renderScrollbars: false, <mask> renderSelection: false, </s> [RFC] Randomized names next to mouse pointers. (#971) * [WIP] Add names next to pointers This implements the rendering and messaging across. Still need to do the UI to set the name. Also, not really sure what's the best place to send the name and store it. * Add randomized names Co-authored-by: Christopher Chedeau <[email protected]> </s> add remotePointerUsernames: pointerUsernames, </s> add remotePointerUsernames: { [id: string]: string }; </s> add username: createNameFromSocketId(this.socket.id), </s> remove collaborators: Map<string, { pointer?: { x: number; y: number } }>; </s> add collaborators: Map< string, { pointer?: { x: number; y: number }; username?: string } >; </s> add user.username = username; </s> add const pointerUsernames: { [id: string]: string } = {};
https://github.com/excalidraw/excalidraw/commit/dcb93f75e6b721738fad9d17d9197636fa8643cd
src/scene/export.ts
keep add keep keep keep keep keep
<mask> zoom: number; <mask> remotePointerViewportCoords: { [id: string]: { x: number; y: number } }; <mask> }; <mask> <mask> export type SceneScroll = { <mask> scrollX: FlooredNumber; <mask> scrollY: FlooredNumber; </s> [RFC] Randomized names next to mouse pointers. (#971) * [WIP] Add names next to pointers This implements the rendering and messaging across. Still need to do the UI to set the name. Also, not really sure what's the best place to send the name and store it. * Add randomized names Co-authored-by: Christopher Chedeau <[email protected]> </s> remove collaborators: Map<string, { pointer?: { x: number; y: number } }>; </s> add collaborators: Map< string, { pointer?: { x: number; y: number }; username?: string } >; </s> add const pointerUsernames: { [id: string]: string } = {}; </s> add username: string; </s> add remotePointerUsernames: {}, </s> add remotePointerUsernames: pointerUsernames, </s> remove const { socketID, pointerCoords } = decryptedData.payload; </s> add const { socketID, pointerCoords, username, } = decryptedData.payload;
https://github.com/excalidraw/excalidraw/commit/dcb93f75e6b721738fad9d17d9197636fa8643cd
src/scene/types.ts
keep keep keep keep replace keep keep keep keep keep
<mask> zoom: number; <mask> openMenu: "canvas" | "shape" | null; <mask> lastPointerDownWith: PointerType; <mask> selectedElementIds: { [id: string]: boolean }; <mask> collaborators: Map<string, { pointer?: { x: number; y: number } }>; <mask> }; <mask> <mask> export type PointerCoords = Readonly<{ <mask> x: number; <mask> y: number; </s> [RFC] Randomized names next to mouse pointers. (#971) * [WIP] Add names next to pointers This implements the rendering and messaging across. Still need to do the UI to set the name. Also, not really sure what's the best place to send the name and store it. * Add randomized names Co-authored-by: Christopher Chedeau <[email protected]> </s> add remotePointerUsernames: { [id: string]: string }; </s> add username: string; </s> add const pointerUsernames: { [id: string]: string } = {}; </s> remove const { socketID, pointerCoords } = decryptedData.payload; </s> add const { socketID, pointerCoords, username, } = decryptedData.payload; </s> add username: createNameFromSocketId(this.socket.id), </s> add if (user.username) { pointerUsernames[socketID] = user.username; }
https://github.com/excalidraw/excalidraw/commit/dcb93f75e6b721738fad9d17d9197636fa8643cd
src/types.ts
keep keep keep keep replace keep keep keep keep keep
<mask> isArrowElement, <mask> isBoundToContainer, <mask> isTextElement, <mask> } from "./typeChecks"; <mask> import { CLASSES, isFirefox, isSafari, VERTICAL_ALIGN } from "../constants"; <mask> import { <mask> ExcalidrawElement, <mask> ExcalidrawLinearElement, <mask> ExcalidrawTextElementWithContainer, <mask> ExcalidrawTextElement, </s> fix: add an offset of 0.5px for text editor in containers (#6328) * fix: add an offset of 0.5px for text editor in containers * fix specs and lint </s> remove } else if (isFirefox || isSafari) { // As firefox, Safari needs little higher dimensions on DOM </s> add } else { </s> remove style="position: absolute; display: inline-block; min-height: 1em; margin: 0px; padding: 0px; border: 0px; outline: 0; resize: none; background: transparent; overflow: hidden; z-index: var(--zIndex-wysiwyg); word-break: break-word; white-space: pre-wrap; overflow-wrap: break-word; box-sizing: content-box; width: 10px; height: 24px; left: 35px; top: 8px; transform: translate(0px, 0px) scale(1) rotate(0deg); text-align: center; vertical-align: middle; color: rgb(0, 0, 0); opacity: 1; filter: var(--theme-filter); max-height: -8px; font: Emoji 20px 20px; line-height: 24px; font-family: Virgil, Segoe UI Emoji;" </s> add style="position: absolute; display: inline-block; min-height: 1em; margin: 0px; padding: 0px; border: 0px; outline: 0; resize: none; background: transparent; overflow: hidden; z-index: var(--zIndex-wysiwyg); word-break: break-word; white-space: pre-wrap; overflow-wrap: break-word; box-sizing: content-box; width: 10.5px; height: 24px; left: 35px; top: 8px; transform: translate(0px, 0px) scale(1) rotate(0deg); text-align: center; vertical-align: middle; color: rgb(0, 0, 0); opacity: 1; filter: var(--theme-filter); max-height: -8px; font: Emoji 20px 20px; line-height: 24px; font-family: Virgil, Segoe UI Emoji;"
https://github.com/excalidraw/excalidraw/commit/dd4c333925c48009cc1677d9688462141df0aceb
src/element/textWysiwyg.tsx
keep keep keep keep replace replace keep keep keep keep keep
<mask> : updatedTextElement.height / lines.length; <mask> if (!container) { <mask> maxWidth = (appState.width - 8 - viewportX) / appState.zoom.value; <mask> textElementWidth = Math.min(textElementWidth, maxWidth); <mask> } else if (isFirefox || isSafari) { <mask> // As firefox, Safari needs little higher dimensions on DOM <mask> textElementWidth += 0.5; <mask> } <mask> // Make sure text editor height doesn't go beyond viewport <mask> const editorMaxHeight = <mask> (appState.height - viewportY) / appState.zoom.value; </s> fix: add an offset of 0.5px for text editor in containers (#6328) * fix: add an offset of 0.5px for text editor in containers * fix specs and lint </s> remove import { CLASSES, isFirefox, isSafari, VERTICAL_ALIGN } from "../constants"; </s> add import { CLASSES, VERTICAL_ALIGN } from "../constants"; </s> remove style="position: absolute; display: inline-block; min-height: 1em; margin: 0px; padding: 0px; border: 0px; outline: 0; resize: none; background: transparent; overflow: hidden; z-index: var(--zIndex-wysiwyg); word-break: break-word; white-space: pre-wrap; overflow-wrap: break-word; box-sizing: content-box; width: 10px; height: 24px; left: 35px; top: 8px; transform: translate(0px, 0px) scale(1) rotate(0deg); text-align: center; vertical-align: middle; color: rgb(0, 0, 0); opacity: 1; filter: var(--theme-filter); max-height: -8px; font: Emoji 20px 20px; line-height: 24px; font-family: Virgil, Segoe UI Emoji;" </s> add style="position: absolute; display: inline-block; min-height: 1em; margin: 0px; padding: 0px; border: 0px; outline: 0; resize: none; background: transparent; overflow: hidden; z-index: var(--zIndex-wysiwyg); word-break: break-word; white-space: pre-wrap; overflow-wrap: break-word; box-sizing: content-box; width: 10.5px; height: 24px; left: 35px; top: 8px; transform: translate(0px, 0px) scale(1) rotate(0deg); text-align: center; vertical-align: middle; color: rgb(0, 0, 0); opacity: 1; filter: var(--theme-filter); max-height: -8px; font: Emoji 20px 20px; line-height: 24px; font-family: Virgil, Segoe UI Emoji;"
https://github.com/excalidraw/excalidraw/commit/dd4c333925c48009cc1677d9688462141df0aceb
src/element/textWysiwyg.tsx
keep keep keep keep replace keep keep keep keep
<mask> <textarea <mask> class="excalidraw-wysiwyg" <mask> data-type="wysiwyg" <mask> dir="auto" <mask> style="position: absolute; display: inline-block; min-height: 1em; margin: 0px; padding: 0px; border: 0px; outline: 0; resize: none; background: transparent; overflow: hidden; z-index: var(--zIndex-wysiwyg); word-break: break-word; white-space: pre-wrap; overflow-wrap: break-word; box-sizing: content-box; width: 10px; height: 24px; left: 35px; top: 8px; transform: translate(0px, 0px) scale(1) rotate(0deg); text-align: center; vertical-align: middle; color: rgb(0, 0, 0); opacity: 1; filter: var(--theme-filter); max-height: -8px; font: Emoji 20px 20px; line-height: 24px; font-family: Virgil, Segoe UI Emoji;" <mask> tabindex="0" <mask> wrap="off" <mask> /> <mask> `; </s> fix: add an offset of 0.5px for text editor in containers (#6328) * fix: add an offset of 0.5px for text editor in containers * fix specs and lint </s> remove } else if (isFirefox || isSafari) { // As firefox, Safari needs little higher dimensions on DOM </s> add } else { </s> remove import { CLASSES, isFirefox, isSafari, VERTICAL_ALIGN } from "../constants"; </s> add import { CLASSES, VERTICAL_ALIGN } from "../constants";
https://github.com/excalidraw/excalidraw/commit/dd4c333925c48009cc1677d9688462141df0aceb
src/tests/__snapshots__/linearElementEditor.test.tsx.snap
keep keep keep keep replace keep keep keep keep keep
<mask> } <mask> <mask> &__github-corner { <mask> top: 0; <mask> right: 0; <mask> position: absolute; <mask> width: 40px; <mask> } <mask> <mask> &__footer { </s> #1529 Rtl ui broken in zen mode (#1530) </s> remove right: 0; </s> add :root[dir="ltr"] & { right: 0; } :root[dir="rtl"] & { left: 0; } </s> add :root[dir="rtl"] &.transition-left { transform: translate(999px, 0); } :root[dir="rtl"] &.transition-right { transform: translate(-999px, 0); } </s> remove &.transition-right { </s> add :root[dir="ltr"] &.transition-right { </s> remove &.transition-left { </s> add :root[dir="ltr"] &.transition-left {
https://github.com/excalidraw/excalidraw/commit/dd7aa29297369b034c5664b8977b07f9dd9ea071
src/components/LayerUI.scss
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> &__footer { <mask> position: absolute; <mask> bottom: 0px; <mask> right: 0; <mask> width: 190px; <mask> } <mask> <mask> .zen-mode-transition { <mask> transition: transform 0.5s ease-in-out; </s> #1529 Rtl ui broken in zen mode (#1530) </s> remove right: 0; </s> add :root[dir="ltr"] & { right: 0; } :root[dir="rtl"] & { left: 0; } </s> remove &.transition-left { </s> add :root[dir="ltr"] &.transition-left { </s> add :root[dir="rtl"] &.transition-left { transform: translate(999px, 0); } :root[dir="rtl"] &.transition-right { transform: translate(-999px, 0); } </s> remove &.transition-right { </s> add :root[dir="ltr"] &.transition-right {
https://github.com/excalidraw/excalidraw/commit/dd7aa29297369b034c5664b8977b07f9dd9ea071
src/components/LayerUI.scss
keep replace keep keep replace keep keep keep
<mask> transition: transform 0.5s ease-in-out; <mask> &.transition-left { <mask> transform: translate(-999px, 0); <mask> } <mask> &.transition-right { <mask> transform: translate(999px, 0px); <mask> } <mask> } </s> #1529 Rtl ui broken in zen mode (#1530) </s> add :root[dir="rtl"] &.transition-left { transform: translate(999px, 0); } :root[dir="rtl"] &.transition-right { transform: translate(-999px, 0); } </s> remove right: 0; </s> add :root[dir="ltr"] & { right: 0; } :root[dir="rtl"] & { left: 0; } </s> remove right: 0; </s> add :root[dir="ltr"] & { right: 0; } :root[dir="rtl"] & { left: 0; }
https://github.com/excalidraw/excalidraw/commit/dd7aa29297369b034c5664b8977b07f9dd9ea071
src/components/LayerUI.scss
keep add keep keep keep keep keep keep
<mask> transform: translate(999px, 0px); <mask> } <mask> } <mask> <mask> .disable-zen-mode { <mask> height: 30px; <mask> position: absolute; <mask> bottom: 10px; </s> #1529 Rtl ui broken in zen mode (#1530) </s> remove &.transition-right { </s> add :root[dir="ltr"] &.transition-right { </s> remove right: 0; </s> add :root[dir="ltr"] & { right: 0; } :root[dir="rtl"] & { left: 0; } </s> remove &.transition-left { </s> add :root[dir="ltr"] &.transition-left { </s> remove right: 0; </s> add :root[dir="ltr"] & { right: 0; } :root[dir="rtl"] & { left: 0; }
https://github.com/excalidraw/excalidraw/commit/dd7aa29297369b034c5664b8977b07f9dd9ea071
src/components/LayerUI.scss
keep keep add keep keep keep keep
<mask> exportEmbedScene: appState.exportEmbedScene, <mask> gridSize: appState.gridSize, <mask> shouldAddWatermark: appState.shouldAddWatermark, <mask> }, <mask> commitToHistory: true, <mask> }; <mask> }, </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]> </s> add showStats: { browser: true, export: false }, </s> add { label: t("labels.toggleStats"), action: this.toggleStats, }, </s> add }, "stats": { "angle": "Angle", "element": "Element", "elements": "Elements", "height": "Height", "scene": "Scene", "selected": "Selected", "storage": "Storage", "title": "Stats for nerds", "total": "Total", "width": "Width" </s> add "showStats": false, </s> add "showStats": false, </s> add ret.cancel = () => { clearTimeout(handle); };
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/actions/actionCanvas.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> } from "../element/types"; <mask> import { <mask> getCommonAttributeOfSelectedElements, <mask> isSomeElementSelected, <mask> getTargetElement, <mask> canChangeSharpness, <mask> } from "../scene"; <mask> import { ButtonSelect } from "../components/ButtonSelect"; <mask> import { ButtonIconSelect } from "../components/ButtonIconSelect"; <mask> import { </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]> </s> remove getTargetElement, </s> add getTargetElements, </s> add import { copiedStyles } from "../actions/actionStyles"; import { ExcalidrawElement } from "../element/types"; import { setLanguage, t } from "../i18n"; import { CODES, KEYS } from "../keys"; import Excalidraw from "../packages/excalidraw/index"; import { reseed } from "../random"; </s> remove import Excalidraw from "../packages/excalidraw/index"; import { setLanguage } from "../i18n"; import { setDateTimeForTests } from "../utils"; import { ExcalidrawElement } from "../element/types"; import { queryByText } from "@testing-library/react"; import { copiedStyles } from "../actions/actionStyles"; import { UI, Pointer, Keyboard } from "./helpers/ui"; import { API } from "./helpers/api"; import { CODES, KEYS } from "../keys"; </s> add </s> add import { setDateTimeForTests } from "../utils"; import { API } from "./helpers/api"; import { Keyboard, Pointer, UI } from "./helpers/ui"; </s> remove import { reseed } from "../random"; </s> add import { queryByText } from "@testing-library/react"; </s> remove waitFor, render, screen, </s> add
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/actions/actionProperties.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> <mask> export const actionChangeSharpness = register({ <mask> name: "changeSharpness", <mask> perform: (elements, appState, value) => { <mask> const targetElements = getTargetElement( <mask> getNonDeletedElements(elements), <mask> appState, <mask> ); <mask> const shouldUpdateForNonLinearElements = targetElements.length <mask> ? targetElements.every((el) => !isLinearElement(el)) </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]> </s> remove const targetElements = getTargetElement( </s> add const targetElements = getTargetElements( </s> add export const getElementsStorageSize = () => { const elements = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS); const elementsSize = elements ? JSON.stringify(elements).length : 0; return elementsSize; }; </s> remove const elements = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS); </s> add </s> remove export const getTargetElement = ( </s> add export const getTargetElements = ( </s> remove ) => { return elements.filter((element) => appState.selectedElementIds[element.id]); }; </s> add ) => elements.filter((element) => appState.selectedElementIds[element.id]); </s> add ret.cancel = () => { clearTimeout(handle); };
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/actions/actionProperties.tsx
keep add keep keep keep keep keep keep
<mask> fileHandle: null, <mask> collaborators: new Map(), <mask> }; <mask> }; <mask> <mask> /** <mask> * Config containing all AppState keys. Used to determine whether given state <mask> * prop should be stripped when exporting to given storage type. </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]> </s> add showStats: boolean; </s> remove ): boolean => { return elements.some((element) => appState.selectedElementIds[element.id]); }; </s> add ): boolean => elements.some((element) => appState.selectedElementIds[element.id]); </s> add "toggleStats": "Toggle stats for nerds", </s> add ret.cancel = () => { clearTimeout(handle); }; </s> add showStats: { browser: true, export: false }, </s> add toggleStats = () => { if (!this.state.showStats) { trackEvent(EVENT_DIALOG, "stats"); } this.setState({ showStats: !this.state.showStats, }); };
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/appState.ts
keep add keep keep keep keep
<mask> fileHandle: { browser: false, export: false }, <mask> collaborators: { browser: false, export: false }, <mask> }); <mask> <mask> const _clearAppStateForStorage = <ExportType extends "export" | "browser">( <mask> appState: Partial<AppState>, </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]> </s> add showStats: boolean; </s> add { label: t("labels.toggleStats"), action: this.toggleStats, }, </s> add showStats: appState.showStats, </s> remove const expectedOptions = ["Select all", "Toggle grid mode"]; </s> add const expectedOptions = [ t("labels.selectAll"), t("labels.toggleGridMode"), t("labels.toggleStats"), ]; </s> remove ) => { return elements.filter((element) => appState.selectedElementIds[element.id]); }; </s> add ) => elements.filter((element) => appState.selectedElementIds[element.id]); </s> add showStats: false,
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/appState.ts
keep keep keep keep replace keep keep keep keep keep
<mask> hasBackground, <mask> hasStroke, <mask> canChangeSharpness, <mask> hasText, <mask> getTargetElement, <mask> } from "../scene"; <mask> import { t } from "../i18n"; <mask> import { SHAPES } from "../shapes"; <mask> import { ToolButton } from "./ToolButton"; <mask> import { capitalizeString, isTransparent, setCursorForShape } from "../utils"; </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]> </s> remove getTargetElement, </s> add getTargetElements, </s> add import { copiedStyles } from "../actions/actionStyles"; import { ExcalidrawElement } from "../element/types"; import { setLanguage, t } from "../i18n"; import { CODES, KEYS } from "../keys"; import Excalidraw from "../packages/excalidraw/index"; import { reseed } from "../random"; </s> remove import Excalidraw from "../packages/excalidraw/index"; import { setLanguage } from "../i18n"; import { setDateTimeForTests } from "../utils"; import { ExcalidrawElement } from "../element/types"; import { queryByText } from "@testing-library/react"; import { copiedStyles } from "../actions/actionStyles"; import { UI, Pointer, Keyboard } from "./helpers/ui"; import { API } from "./helpers/api"; import { CODES, KEYS } from "../keys"; </s> add </s> add import { setDateTimeForTests } from "../utils"; import { API } from "./helpers/api"; import { Keyboard, Pointer, UI } from "./helpers/ui"; </s> remove waitFor, render, screen, </s> add </s> remove import { reseed } from "../random"; </s> add import { queryByText } from "@testing-library/react";
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/components/Actions.tsx
keep keep keep keep replace keep keep keep keep keep
<mask> elements: readonly ExcalidrawElement[]; <mask> renderAction: ActionManager["renderAction"]; <mask> elementType: ExcalidrawElement["type"]; <mask> }) => { <mask> const targetElements = getTargetElement( <mask> getNonDeletedElements(elements), <mask> appState, <mask> ); <mask> const isEditing = Boolean(appState.editingElement); <mask> const isMobile = useIsMobile(); </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]> </s> remove const targetElements = getTargetElement( </s> add const targetElements = getTargetElements( </s> remove ) => { return elements.filter((element) => appState.selectedElementIds[element.id]); }; </s> add ) => elements.filter((element) => appState.selectedElementIds[element.id]); </s> remove export const getTargetElement = ( </s> add export const getTargetElements = ( </s> add export const getElementsStorageSize = () => { const elements = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS); const elementsSize = elements ? JSON.stringify(elements).length : 0; return elementsSize; }; </s> remove const elements = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS); </s> add </s> remove ) => { return appState.editingElement </s> add ) => appState.editingElement
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/components/Actions.tsx
keep keep add keep keep keep keep keep
<mask> EVENT_SHAPE, <mask> trackEvent, <mask> } from "../analytics"; <mask> <mask> const { history } = createHistory(); <mask> <mask> let didTapTwice: boolean = false; <mask> let tappedTwiceTimer = 0; </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]> </s> add render, screen, waitFor, </s> remove import Excalidraw from "../packages/excalidraw/index"; import { setLanguage } from "../i18n"; import { setDateTimeForTests } from "../utils"; import { ExcalidrawElement } from "../element/types"; import { queryByText } from "@testing-library/react"; import { copiedStyles } from "../actions/actionStyles"; import { UI, Pointer, Keyboard } from "./helpers/ui"; import { API } from "./helpers/api"; import { CODES, KEYS } from "../keys"; </s> add </s> add export const getElementsStorageSize = () => { const elements = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS); const elementsSize = elements ? JSON.stringify(elements).length : 0; return elementsSize; }; </s> remove const elements = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS); </s> add </s> remove const elementsSize = elements ? JSON.stringify(elements).length : 0; </s> add </s> remove return appStateSize + collabSize + elementsSize + librarySize; </s> add return appStateSize + collabSize + librarySize + getElementsStorageSize();
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/components/App.tsx
keep add keep keep keep keep
<mask> isCollaborating={this.props.isCollaborating || false} <mask> /> <mask> <main> <mask> <canvas <mask> id="canvas" <mask> style={{ </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]> </s> add ret.cancel = () => { clearTimeout(handle); }; </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false,
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/components/App.tsx
keep add keep keep keep keep
<mask> }; <mask> <mask> setScrollToCenter = (remoteElements: readonly ExcalidrawElement[]) => { <mask> this.setState({ <mask> ...calculateScrollCenter( <mask> getNonDeletedElements(remoteElements), </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]> </s> remove ) => { return elements.filter((element) => appState.selectedElementIds[element.id]); }; </s> add ) => elements.filter((element) => appState.selectedElementIds[element.id]); </s> remove export const getTargetElement = ( </s> add export const getTargetElements = ( </s> remove ) => { return appState.editingElement </s> add ) => appState.editingElement </s> add ret.cancel = () => { clearTimeout(handle); }; </s> add export const getElementsStorageSize = () => { const elements = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS); const elementsSize = elements ? JSON.stringify(elements).length : 0; return elementsSize; }; </s> remove ): boolean => { return elements.some((element) => appState.selectedElementIds[element.id]); }; </s> add ): boolean => elements.some((element) => appState.selectedElementIds[element.id]);
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/components/App.tsx
keep keep keep add keep keep keep keep keep
<mask> { <mask> label: t("labels.toggleGridMode"), <mask> action: this.toggleGridMode, <mask> }, <mask> ], <mask> top: clientY, <mask> left: clientX, <mask> }); <mask> return; </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]> </s> add showStats: { browser: true, export: false }, </s> remove const expectedOptions = ["Select all", "Toggle grid mode"]; </s> add const expectedOptions = [ t("labels.selectAll"), t("labels.toggleGridMode"), t("labels.toggleStats"), ]; </s> add showStats: appState.showStats, </s> add toggleStats = () => { if (!this.state.showStats) { trackEvent(EVENT_DIALOG, "stats"); } this.setState({ showStats: !this.state.showStats, }); }; </s> remove expect(options?.length).toBe(2); </s> add expect(options?.length).toBe(3); </s> add }, "stats": { "angle": "Angle", "element": "Element", "elements": "Elements", "height": "Height", "scene": "Scene", "selected": "Selected", "storage": "Storage", "title": "Stats for nerds", "total": "Total", "width": "Width"
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/components/App.tsx
keep keep keep add keep keep keep keep keep
<mask> } <mask> return { elements, appState }; <mask> }; <mask> <mask> export const getTotalStorageSize = () => { <mask> const appState = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_APP_STATE); <mask> const collab = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_COLLAB); <mask> const library = localStorage.getItem(APP_STORAGE_KEYS.LOCAL_STORAGE_LIBRARY); <mask> </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]> </s> remove const elements = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS); </s> add </s> remove const elementsSize = elements ? JSON.stringify(elements).length : 0; </s> add </s> add ret.cancel = () => { clearTimeout(handle); }; </s> remove export const getTargetElement = ( </s> add export const getTargetElements = ( </s> remove return appStateSize + collabSize + elementsSize + librarySize; </s> add return appStateSize + collabSize + librarySize + getElementsStorageSize(); </s> remove ) => { return elements.filter((element) => appState.selectedElementIds[element.id]); }; </s> add ) => elements.filter((element) => appState.selectedElementIds[element.id]);
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/excalidraw-app/data/localStorage.ts
keep keep keep keep replace keep keep keep keep replace keep
<mask> <mask> export const getTotalStorageSize = () => { <mask> const appState = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_APP_STATE); <mask> const collab = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_COLLAB); <mask> const elements = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS); <mask> const library = localStorage.getItem(APP_STORAGE_KEYS.LOCAL_STORAGE_LIBRARY); <mask> <mask> const appStateSize = appState ? JSON.stringify(appState).length : 0; <mask> const collabSize = collab ? JSON.stringify(collab).length : 0; <mask> const elementsSize = elements ? JSON.stringify(elements).length : 0; <mask> const librarySize = library ? JSON.stringify(library).length : 0; </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]> </s> remove return appStateSize + collabSize + elementsSize + librarySize; </s> add return appStateSize + collabSize + librarySize + getElementsStorageSize(); </s> add export const getElementsStorageSize = () => { const elements = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS); const elementsSize = elements ? JSON.stringify(elements).length : 0; return elementsSize; }; </s> remove const targetElements = getTargetElement( </s> add const targetElements = getTargetElements( </s> remove ) => { return appState.editingElement </s> add ) => appState.editingElement </s> remove export const getTargetElement = ( </s> add export const getTargetElements = (
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/excalidraw-app/data/localStorage.ts
keep keep keep keep replace keep
<mask> const collabSize = collab ? JSON.stringify(collab).length : 0; <mask> const elementsSize = elements ? JSON.stringify(elements).length : 0; <mask> const librarySize = library ? JSON.stringify(library).length : 0; <mask> <mask> return appStateSize + collabSize + elementsSize + librarySize; <mask> }; </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]> </s> remove const elementsSize = elements ? JSON.stringify(elements).length : 0; </s> add </s> remove const elements = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS); </s> add </s> add export const getElementsStorageSize = () => { const elements = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS); const elementsSize = elements ? JSON.stringify(elements).length : 0; return elementsSize; }; </s> remove ) => { return appState.editingElement </s> add ) => appState.editingElement </s> remove }; </s> add </s> remove export const getTargetElement = ( </s> add export const getTargetElements = (
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/excalidraw-app/data/localStorage.ts
keep keep add keep keep keep keep keep
<mask> "ungroup": "Ungroup selection", <mask> "collaborators": "Collaborators", <mask> "toggleGridMode": "Toggle grid mode", <mask> "addToLibrary": "Add to library", <mask> "removeFromLibrary": "Remove from library", <mask> "libraryLoadingMessage": "Loading library...", <mask> "loadingScene": "Loading scene...", <mask> "align": "Align", </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]> </s> remove expect(options?.length).toBe(2); </s> add expect(options?.length).toBe(3); </s> remove const expectedOptions = ["Select all", "Toggle grid mode"]; </s> add const expectedOptions = [ t("labels.selectAll"), t("labels.toggleGridMode"), t("labels.toggleStats"), ]; </s> add showStats: false, </s> add import { copiedStyles } from "../actions/actionStyles"; import { ExcalidrawElement } from "../element/types"; import { setLanguage, t } from "../i18n"; import { CODES, KEYS } from "../keys"; import Excalidraw from "../packages/excalidraw/index"; import { reseed } from "../random"; </s> remove waitFor, render, screen, </s> add </s> remove import { reseed } from "../random"; </s> add import { queryByText } from "@testing-library/react";
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/locales/en.json
keep keep add keep keep
<mask> "charts": { <mask> "noNumericColumn": "You pasted a spreadsheet without a numeric column.", <mask> "tooManyColumns": "You pasted a spreadsheet with more than two columns." <mask> } <mask> } </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]> </s> remove import Excalidraw from "../packages/excalidraw/index"; import { setLanguage } from "../i18n"; import { setDateTimeForTests } from "../utils"; import { ExcalidrawElement } from "../element/types"; import { queryByText } from "@testing-library/react"; import { copiedStyles } from "../actions/actionStyles"; import { UI, Pointer, Keyboard } from "./helpers/ui"; import { API } from "./helpers/api"; import { CODES, KEYS } from "../keys"; </s> add </s> remove getTargetElement, </s> add getTargetElements, </s> remove getTargetElement, </s> add getTargetElements, </s> add import { copiedStyles } from "../actions/actionStyles"; import { ExcalidrawElement } from "../element/types"; import { setLanguage, t } from "../i18n"; import { CODES, KEYS } from "../keys"; import Excalidraw from "../packages/excalidraw/index"; import { reseed } from "../random"; </s> add import { Stats } from "./Stats"; </s> add import { setDateTimeForTests } from "../utils"; import { API } from "./helpers/api"; import { Keyboard, Pointer, UI } from "./helpers/ui";
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/locales/en.json
keep keep keep keep replace keep keep keep keep keep
<mask> isSomeElementSelected, <mask> getElementsWithinSelection, <mask> getCommonAttributeOfSelectedElements, <mask> getSelectedElements, <mask> getTargetElement, <mask> } from "./selection"; <mask> export { normalizeScroll, calculateScrollCenter } from "./scroll"; <mask> export { <mask> hasBackground, <mask> hasStroke, </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]> </s> remove getTargetElement, </s> add getTargetElements, </s> remove getTargetElement, </s> add getTargetElements, </s> remove import Excalidraw from "../packages/excalidraw/index"; import { setLanguage } from "../i18n"; import { setDateTimeForTests } from "../utils"; import { ExcalidrawElement } from "../element/types"; import { queryByText } from "@testing-library/react"; import { copiedStyles } from "../actions/actionStyles"; import { UI, Pointer, Keyboard } from "./helpers/ui"; import { API } from "./helpers/api"; import { CODES, KEYS } from "../keys"; </s> add </s> add import { copiedStyles } from "../actions/actionStyles"; import { ExcalidrawElement } from "../element/types"; import { setLanguage, t } from "../i18n"; import { CODES, KEYS } from "../keys"; import Excalidraw from "../packages/excalidraw/index"; import { reseed } from "../random"; </s> add import { setDateTimeForTests } from "../utils"; import { API } from "./helpers/api"; import { Keyboard, Pointer, UI } from "./helpers/ui"; </s> remove import { reseed } from "../random"; </s> add import { queryByText } from "@testing-library/react";
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/scene/index.ts
keep keep keep keep replace replace replace keep keep keep keep keep
<mask> <mask> export const isSomeElementSelected = ( <mask> elements: readonly NonDeletedExcalidrawElement[], <mask> appState: AppState, <mask> ): boolean => { <mask> return elements.some((element) => appState.selectedElementIds[element.id]); <mask> }; <mask> <mask> /** <mask> * Returns common attribute (picked by `getAttribute` callback) of selected <mask> * elements. If elements don't share the same value, returns `null`. <mask> */ </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]> </s> remove ) => { return elements.filter((element) => appState.selectedElementIds[element.id]); }; </s> add ) => elements.filter((element) => appState.selectedElementIds[element.id]); </s> remove export const getTargetElement = ( </s> add export const getTargetElements = ( </s> remove ) => { return appState.editingElement </s> add ) => appState.editingElement </s> add export const getElementsStorageSize = () => { const elements = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS); const elementsSize = elements ? JSON.stringify(elements).length : 0; return elementsSize; }; </s> add ret.cancel = () => { clearTimeout(handle); }; </s> remove const targetElements = getTargetElement( </s> add const targetElements = getTargetElements(
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/scene/selection.ts
keep keep keep keep replace replace replace keep keep keep keep keep keep keep keep replace
<mask> <mask> export const getSelectedElements = ( <mask> elements: readonly NonDeletedExcalidrawElement[], <mask> appState: AppState, <mask> ) => { <mask> return elements.filter((element) => appState.selectedElementIds[element.id]); <mask> }; <mask> <mask> export const getTargetElement = ( <mask> elements: readonly NonDeletedExcalidrawElement[], <mask> appState: AppState, <mask> ) => { <mask> return elements.filter((element) => appState.selectedElementIds[element.id]); <mask> }; <mask> <mask> export const getTargetElement = ( </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]> </s> remove ) => { return appState.editingElement </s> add ) => appState.editingElement </s> remove ): boolean => { return elements.some((element) => appState.selectedElementIds[element.id]); }; </s> add ): boolean => elements.some((element) => appState.selectedElementIds[element.id]); </s> add export const getElementsStorageSize = () => { const elements = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS); const elementsSize = elements ? JSON.stringify(elements).length : 0; return elementsSize; }; </s> add ret.cancel = () => { clearTimeout(handle); }; </s> remove const targetElements = getTargetElement( </s> add const targetElements = getTargetElements(
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/scene/selection.ts
keep keep keep keep replace replace keep keep replace
<mask> <mask> export const getTargetElement = ( <mask> elements: readonly NonDeletedExcalidrawElement[], <mask> appState: AppState, <mask> ) => { <mask> return appState.editingElement <mask> ? [appState.editingElement] <mask> : getSelectedElements(elements, appState); <mask> }; </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]> </s> remove export const getTargetElement = ( </s> add export const getTargetElements = ( </s> remove ) => { return elements.filter((element) => appState.selectedElementIds[element.id]); }; </s> add ) => elements.filter((element) => appState.selectedElementIds[element.id]); </s> remove ): boolean => { return elements.some((element) => appState.selectedElementIds[element.id]); }; </s> add ): boolean => elements.some((element) => appState.selectedElementIds[element.id]); </s> add export const getElementsStorageSize = () => { const elements = localStorage.getItem(STORAGE_KEYS.LOCAL_STORAGE_ELEMENTS); const elementsSize = elements ? JSON.stringify(elements).length : 0; return elementsSize; }; </s> remove const elementsSize = elements ? JSON.stringify(elements).length : 0; </s> add
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/scene/selection.ts
keep add keep keep keep keep keep keep
<mask> "shouldCacheIgnoreZoom": false, <mask> "showShortcutsDialog": false, <mask> "startBoundElement": null, <mask> "suggestedBindings": Array [], <mask> "viewBackgroundColor": "#ffffff", <mask> "width": 1024, <mask> "zenModeEnabled": false, <mask> "zoom": Object { </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]> </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false,
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep add keep keep keep keep
<mask> "selectionElement": null, <mask> "shouldAddWatermark": false, <mask> "shouldCacheIgnoreZoom": false, <mask> "showShortcutsDialog": false, <mask> "startBoundElement": null, <mask> "suggestedBindings": Array [], <mask> "viewBackgroundColor": "#ffffff", <mask> "width": 1024, </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]> </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false,
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep add keep keep keep keep keep
<mask> "shouldCacheIgnoreZoom": false, <mask> "showShortcutsDialog": false, <mask> "startBoundElement": null, <mask> "suggestedBindings": Array [], <mask> "viewBackgroundColor": "#ffffff", <mask> "width": 1024, <mask> "zenModeEnabled": false, </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]>
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep add keep keep keep keep keep keep
<mask> "shouldCacheIgnoreZoom": false, <mask> "showShortcutsDialog": false, <mask> "startBoundElement": null, <mask> "suggestedBindings": Array [], <mask> "viewBackgroundColor": "#ffffff", <mask> "width": 1024, <mask> "zenModeEnabled": false, <mask> "zoom": Object { </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]>
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep add keep keep keep keep keep keep
<mask> "selectionElement": null, <mask> "shouldAddWatermark": false, <mask> "shouldCacheIgnoreZoom": false, <mask> "showShortcutsDialog": false, <mask> "startBoundElement": null, <mask> "suggestedBindings": Array [], <mask> "viewBackgroundColor": "#ffffff", <mask> "width": 1024, <mask> "zenModeEnabled": false, <mask> "zoom": Object { </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]> </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false,
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep add keep keep keep keep
<mask> "shouldAddWatermark": false, <mask> "shouldCacheIgnoreZoom": false, <mask> "showShortcutsDialog": false, <mask> "startBoundElement": null, <mask> "suggestedBindings": Array [], <mask> "viewBackgroundColor": "#ffffff", <mask> "width": 1024, </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]> </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false,
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep add keep keep keep keep keep
<mask> "shouldCacheIgnoreZoom": false, <mask> "showShortcutsDialog": false, <mask> "startBoundElement": null, <mask> "suggestedBindings": Array [], <mask> "viewBackgroundColor": "#ffffff", <mask> "width": 1024, <mask> "zenModeEnabled": false, </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]>
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep keep add keep keep keep keep
<mask> "selectionElement": null, <mask> "shouldAddWatermark": false, <mask> "shouldCacheIgnoreZoom": false, <mask> "showShortcutsDialog": false, <mask> "startBoundElement": null, <mask> "suggestedBindings": Array [], <mask> "viewBackgroundColor": "#ffffff", <mask> "width": 1024, </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]>
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep add keep keep keep keep keep keep
<mask> "shouldCacheIgnoreZoom": false, <mask> "showShortcutsDialog": false, <mask> "startBoundElement": null, <mask> "suggestedBindings": Array [], <mask> "viewBackgroundColor": "#ffffff", <mask> "width": 1024, <mask> "zenModeEnabled": false, <mask> "zoom": Object { </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]>
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep add keep keep keep keep keep
<mask> "shouldAddWatermark": false, <mask> "shouldCacheIgnoreZoom": false, <mask> "showShortcutsDialog": false, <mask> "startBoundElement": null, <mask> "suggestedBindings": Array [], <mask> "viewBackgroundColor": "#ffffff", <mask> "width": 1024, <mask> "zenModeEnabled": false, </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]> </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false,
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep add keep keep keep keep keep
<mask> "shouldAddWatermark": false, <mask> "shouldCacheIgnoreZoom": false, <mask> "showShortcutsDialog": false, <mask> "startBoundElement": null, <mask> "suggestedBindings": Array [], <mask> "viewBackgroundColor": "#ffffff", <mask> "width": 1024, <mask> "zenModeEnabled": false, </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]>
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep add keep keep keep keep keep keep
<mask> "shouldAddWatermark": false, <mask> "shouldCacheIgnoreZoom": false, <mask> "showShortcutsDialog": false, <mask> "startBoundElement": null, <mask> "suggestedBindings": Array [], <mask> "viewBackgroundColor": "#ffffff", <mask> "width": 1024, <mask> "zenModeEnabled": false, <mask> "zoom": Object { </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]> </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false, </s> add "showStats": false,
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep add keep keep keep keep keep keep
<mask> "shouldAddWatermark": false, <mask> "shouldCacheIgnoreZoom": false, <mask> "showShortcutsDialog": false, <mask> "startBoundElement": null, <mask> "suggestedBindings": Array [], <mask> "viewBackgroundColor": "#ffffff", <mask> "width": 1024, <mask> "zenModeEnabled": false, <mask> "zoom": Object { </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]>
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep add keep keep keep keep
<mask> "shouldAddWatermark": false, <mask> "shouldCacheIgnoreZoom": false, <mask> "showShortcutsDialog": false, <mask> "startBoundElement": null, <mask> "suggestedBindings": Array [], <mask> "viewBackgroundColor": "#ffffff", <mask> "width": 1024, </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]>
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/tests/__snapshots__/regressionTests.test.tsx.snap
keep keep add keep keep keep keep keep keep
<mask> "shouldAddWatermark": false, <mask> "shouldCacheIgnoreZoom": false, <mask> "showShortcutsDialog": false, <mask> "startBoundElement": null, <mask> "suggestedBindings": Array [], <mask> "viewBackgroundColor": "#ffffff", <mask> "width": 1024, <mask> "zenModeEnabled": false, <mask> "zoom": Object { </s> Add stats for nerds (#2453) Co-authored-by: David Luzar <[email protected]> Co-authored-by: dwelle <[email protected]>
https://github.com/excalidraw/excalidraw/commit/dd993adc5c2f8fa764ed40fdb5be02b33f37ba5f
src/tests/__snapshots__/regressionTests.test.tsx.snap