Browse Source

fix: prevent adding images to library via contextMenu (#4264)

David Luzar 3 years ago
parent
commit
34a382ace9
1 changed files with 10 additions and 0 deletions
  1. 10 0
      src/actions/actionAddToLibrary.ts

+ 10 - 0
src/actions/actionAddToLibrary.ts

@@ -8,6 +8,16 @@ import { t } from "../i18n";
 export const actionAddToLibrary = register({
   name: "addToLibrary",
   perform: (elements, appState, _, app) => {
+    if (elements.some((element) => element.type === "image")) {
+      return {
+        commitToHistory: false,
+        appState: {
+          ...appState,
+          errorMessage: "Support for adding images to the library coming soon!",
+        },
+      };
+    }
+
     return app.library
       .loadLibrary()
       .then((items) => {