aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/assistant/Ops.js
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/assistant/Ops.js')
-rw-r--r--desktop/assistant/Ops.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/desktop/assistant/Ops.js b/desktop/assistant/Ops.js
index 2761a2d..4d7ef96 100644
--- a/desktop/assistant/Ops.js
+++ b/desktop/assistant/Ops.js
@@ -14,11 +14,12 @@
// The file state's Do row. op is a fileops operation, or "md" for the
// daemon's write, or "compress", which opens the COMPRESS formats. kinds
// lists the staged kinds it fits ("any" fits every mix); min is the number
-// of files it needs; format is the suffix a file already has when the
+// of files it needs and max the most it takes (To .md writes one file from
+// one PDF); format is the suffix a file already has when the
// operation would not change it. icon is a Nerd Font codepoint, checked in
// Inconsolata Nerd Font's cmap.
const OPS = [
- { label: "To .md", icon: "\uf48a", op: "md", kinds: ["pdf"] },
+ { label: "To .md", icon: "\uf48a", op: "md", kinds: ["pdf"], max: 1 },
{ label: "To images", icon: "\uf1c5", op: "pdf-images", kinds: ["pdf"] },
{ label: "Merge", icon: "\uf419", op: "pdf-merge", kinds: ["pdf"], min: 2 },
{ label: "Extract audio", icon: "\uf001", op: "audio", kinds: ["video"] },
@@ -49,6 +50,6 @@ function ext(name) {
function offered(files) {
if (!files.length) return [];
return OPS.filter(o => (o.kinds.includes("any") || files.every(f => o.kinds.includes(f.kind)))
- && files.length >= (o.min ?? 1)
+ && files.length >= (o.min ?? 1) && files.length <= (o.max ?? Infinity)
&& !(o.format && files.every(f => o.format.includes(ext(f.name)))));
}