Virtual whiteboard for sketching hand-drawn like diagrams
fix: adding to library via contextmenu when no image is selected (#4356)
zsviczianf354788cd087
diff --git a/src/actions/actionAddToLibrary.ts b/src/actions/actionAddToLibrary.tsindex 0df832b0e7..98ef5debfb 100644--- a/src/actions/actionAddToLibrary.ts+++ b/src/actions/actionAddToLibrary.ts@@ -8,7 +8,11 @@ import { t } from "../i18n";export const actionAddToLibrary = register({name: "addToLibrary",perform: (elements, appState, _, app) => {- if (elements.some((element) => element.type === "image")) {+ const selectedElements = getSelectedElements(+ getNonDeletedElements(elements),+ appState,+ );+ if (selectedElements.some((element) => element.type === "image")) {return {commitToHistory: false,appState: {@@ -25,10 +29,7 @@ export const actionAddToLibrary = register({{id: randomId(),status: "unpublished",- elements: getSelectedElements(- getNonDeletedElements(elements),- appState,- ).map(deepCopyElement),+ elements: selectedElements.map(deepCopyElement),created: Date.now(),},...items,