Spaces:
Paused
Paused
Download packages/element/src/containerCache.ts from Leon4gr45/excalidraw: direct link, hf CLI and curl.
- Browser
- Download file 823 Bytes
-
https://huggingface.co/spaces/Leon4gr45/excalidraw/resolve/main/packages/element/src/containerCache.ts
- Command line
-
hf download hf://spaces/Leon4gr45/excalidraw/packages/element/src/containerCache.ts
-
curl -L -o containerCache.ts https://huggingface.co/spaces/Leon4gr45/excalidraw/resolve/main/packages/element/src/containerCache.ts
823 Bytes
| import type { ExcalidrawTextContainer } from "./types"; | |
| export const originalContainerCache: { | |
| [id: ExcalidrawTextContainer["id"]]: | |
| | { | |
| height: ExcalidrawTextContainer["height"]; | |
| } | |
| | undefined; | |
| } = {}; | |
| export const updateOriginalContainerCache = ( | |
| id: ExcalidrawTextContainer["id"], | |
| height: ExcalidrawTextContainer["height"], | |
| ) => { | |
| const data = | |
| originalContainerCache[id] || (originalContainerCache[id] = { height }); | |
| data.height = height; | |
| return data; | |
| }; | |
| export const resetOriginalContainerCache = ( | |
| id: ExcalidrawTextContainer["id"], | |
| ) => { | |
| if (originalContainerCache[id]) { | |
| delete originalContainerCache[id]; | |
| } | |
| }; | |
| export const getOriginalContainerHeightFromCache = ( | |
| id: ExcalidrawTextContainer["id"], | |
| ) => { | |
| return originalContainerCache[id]?.height ?? null; | |
| }; | |