Page MenuHomeSealhub

No OneTemporary

diff --git a/resources/horizontal.png b/resources/horizontal.png
new file mode 100644
index 0000000..8717301
Binary files /dev/null and b/resources/horizontal.png differ
diff --git a/resources/image1.jpg b/resources/image1.jpg
deleted file mode 100644
index d735f51..0000000
Binary files a/resources/image1.jpg and /dev/null differ
diff --git a/resources/image3.jpg b/resources/image3.jpg
deleted file mode 100644
index efdb9a4..0000000
Binary files a/resources/image3.jpg and /dev/null differ
diff --git a/resources/image4.jpg b/resources/image4.jpg
deleted file mode 100644
index 5452254..0000000
Binary files a/resources/image4.jpg and /dev/null differ
diff --git a/resources/image5.jpg b/resources/image5.jpg
deleted file mode 100644
index f380c97..0000000
Binary files a/resources/image5.jpg and /dev/null differ
diff --git a/resources/square.png b/resources/square.png
new file mode 100644
index 0000000..4cd64bb
Binary files /dev/null and b/resources/square.png differ
diff --git a/resources/vertical.png b/resources/vertical.png
new file mode 100644
index 0000000..1a92663
Binary files /dev/null and b/resources/vertical.png differ
diff --git a/src/component-arguments/image.ts b/src/component-arguments/image.ts
index 1c117c5..fdb9227 100644
--- a/src/component-arguments/image.ts
+++ b/src/component-arguments/image.ts
@@ -1,41 +1,41 @@
import { JDDContext } from "../index.js";
import { File as FileArgument } from "./file.js";
import { FilePointer } from "@sealcode/file-manager";
import _locreq from "locreq";
import { module_dirname } from "../utils/module-dirname.js";
const locreq = _locreq(module_dirname(import.meta.url));
const default_example_images: Record<string, FilePointer | null> =
Object.fromEntries(
- ["image1.jpg", "image3.jpg", "image4.jpg", "image5.jpg"].map((key) => [
+ ["square.png", "horizontal.png", "vertical.png"].map((key) => [
locreq.resolve(`resources/${key}`),
null,
])
);
export class Image extends FileArgument {
private example_images = default_example_images;
getTypeName() {
return "image";
}
setExampleImages(paths: string[]) {
this.example_images = Object.fromEntries(
paths.map((path) => [path, null])
);
return this;
}
async getExampleValue(context: JDDContext) {
const keys = Object.keys(this.example_images);
const key = keys[Math.floor(Math.random() * keys.length)];
if (!this.example_images[key]) {
const file = context.file_manager.fromPath(key);
this.example_images[key] = file;
await file.save(false);
}
return this.example_images[key];
}
}

File Metadata

Mime Type
text/x-diff
Expires
Sat, Nov 23, 07:26 (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
547492
Default Alt Text
(2 KB)

Event Timeline