浏览代码

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

David Luzar 3 年之前
父节点
当前提交
34a382ace9
共有 1 个文件被更改,包括 10 次插入0 次删除
  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) => {