Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F10359983
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/inputs/component-input-image.ts b/src/inputs/component-input-image.ts
index bf872ce..8c06e64 100644
--- a/src/inputs/component-input-image.ts
+++ b/src/inputs/component-input-image.ts
@@ -1,70 +1,74 @@
import type { Context } from "koa";
import type { FilePointer } from "@sealcode/file-manager";
import type { Image, JDDContext } from "@sealcode/jdd";
import type { StatefulPage } from "@sealcode/sealgen";
import type { ComponentPreviewActions } from "../component-preview-actions.js";
import type { JDDPageState } from "../jdd-page.js";
import { tempstream } from "tempstream";
import { printArgPath } from "./print-arg-path.js";
export function ComponentInputImage<State extends JDDPageState>({
arg_path,
arg,
value,
ctx,
page,
state,
makeJDDContext,
}: {
state: State;
arg_path: string[];
arg: Image;
value: FilePointer | null;
page: StatefulPage<JDDPageState, typeof ComponentPreviewActions>;
ctx: Context;
makeJDDContext: (ctx: Context) => JDDContext;
}): JSX.Element {
const jdd_context = makeJDDContext(ctx);
return tempstream/* HTML */ `<div style="margin-bottom: 10px">
<label
style="display: flex; align-items: center; column-gap: 10px;"
data-controller="input-image-preview"
>
${arg_path.at(-1) || ""}
<div class="image-preview-container">
${value &&
jdd_context.render_image(value, {
container: {
width: 40,
height: 40,
objectFit: "cover",
},
crop: { width: 40, height: 40 },
style: "height: 40px; width: 40px;",
alt: "",
})}
</div>
<input
type="file"
name="${`$${printArgPath(arg_path)}.new`}"
value=""
autocomplete="off"
data-action="change->input-image-preview#handleChange"
${arg.hasParent("list") ? "multiple" : ""}
/>
</label>
<div>
- <input type="hidden" name="${`$${printArgPath(arg_path)}.old`}"
- value={value?.token || ""} autocomplete="off" />
+ <input
+ type="hidden"
+ name="${`$${printArgPath(arg_path)}.old`}"
+ value="${value?.token || ""}"
+ autocomplete="off"
+ />
</div>
${page.makeActionButton(
state,
{
action: "remove_file",
label: "❌",
},
arg_path
)}
</div>`;
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Nov 8, 03:36 (19 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1033975
Default Alt Text
(2 KB)
Attached To
Mode
rJDDE jdd-editor
Attached
Detach File
Event Timeline
Log In to Comment