1
0
mirror of https://github.com/excalidraw/excalidraw.git synced 2024-11-10 11:35:52 +01:00

fix: Don't show export and delete when library is empty (#3288)

This commit is contained in:
Aakansha Doshi 2021-03-20 21:58:37 +05:30 committed by GitHub
parent efb6d0825b
commit 13d9374cde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -144,34 +144,37 @@ const LibraryMenuItems = ({
}); });
}} }}
/> />
<ToolButton {!!library.length && (
key="export" <>
type="button" <ToolButton
title={t("buttons.export")} key="export"
aria-label={t("buttons.export")} type="button"
icon={exportFile} title={t("buttons.export")}
onClick={() => { aria-label={t("buttons.export")}
saveLibraryAsJSON() icon={exportFile}
.catch(muteFSAbortError) onClick={() => {
.catch((error) => { saveLibraryAsJSON()
setAppState({ errorMessage: error.message }); .catch(muteFSAbortError)
}); .catch((error) => {
}} setAppState({ errorMessage: error.message });
/> });
<ToolButton }}
key="reset" />
type="button" <ToolButton
title={t("buttons.resetLibrary")} key="reset"
aria-label={t("buttons.resetLibrary")} type="button"
icon={trash} title={t("buttons.resetLibrary")}
onClick={() => { aria-label={t("buttons.resetLibrary")}
if (window.confirm(t("alerts.resetLibrary"))) { icon={trash}
Library.resetLibrary(); onClick={() => {
setLibraryItems([]); if (window.confirm(t("alerts.resetLibrary"))) {
} Library.resetLibrary();
}} setLibraryItems([]);
/> }
}}
/>
</>
)}
<a <a
href={`https://libraries.excalidraw.com?referrer=${referrer}`} href={`https://libraries.excalidraw.com?referrer=${referrer}`}
target="_excalidraw_libraries" target="_excalidraw_libraries"