Skip to content

Virtual whiteboard for sketching hand-drawn like diagrams

feat: pass current `theme` when installing libraries (#3701)

David Luzar69b6fbb3f4ab
diff --git a/src/components/LayerUI.tsx b/src/components/LayerUI.tsx
index c69d87f6c4..dc245fc248 100644
--- a/src/components/LayerUI.tsx
+++ b/src/components/LayerUI.tsx
@@ -107,6 +107,7 @@ const LibraryMenuItems = ({
onAddToLibrary,
onInsertShape,
pendingElements,
+ theme,
setAppState,
setLibraryItems,
libraryReturnUrl,
@@ -119,6 +120,7 @@ const LibraryMenuItems = ({
onRemoveFromLibrary: (index: number) => void;
onInsertShape: (elements: LibraryItem) => void;
onAddToLibrary: (elements: LibraryItem) => void;
+ theme: AppState["theme"];
setAppState: React.Component<any, AppState>["setState"];
setLibraryItems: (library: LibraryItems) => void;
libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
@@ -192,7 +194,7 @@ const LibraryMenuItems = ({
<a
href={`https://libraries.excalidraw.com?target=${
window.name || "_blank"
- }&referrer=${referrer}&useHash=true&token=${id}`}
+ }&referrer=${referrer}&useHash=true&token=${id}&theme=${theme}`}
target="_excalidraw_libraries"
>
{t("labels.libraries")}
@@ -246,6 +248,7 @@ const LibraryMenu = ({
onInsertShape,
pendingElements,
onAddToLibrary,
+ theme,
setAppState,
libraryReturnUrl,
focusContainer,
@@ -256,6 +259,7 @@ const LibraryMenu = ({
onClickOutside: (event: MouseEvent) => void;
onInsertShape: (elements: LibraryItem) => void;
onAddToLibrary: () => void;
+ theme: AppState["theme"];
setAppState: React.Component<any, AppState>["setState"];
libraryReturnUrl: ExcalidrawProps["libraryReturnUrl"];
focusContainer: () => void;
@@ -345,6 +349,7 @@ const LibraryMenu = ({
libraryReturnUrl={libraryReturnUrl}
focusContainer={focusContainer}
library={library}
+ theme={theme}
id={id}
/>
)}
@@ -537,6 +542,7 @@ const LayerUI = ({
libraryReturnUrl={libraryReturnUrl}
focusContainer={focusContainer}
library={library}
+ theme={appState.theme}
id={id}
/>
) : null;