Page MenuHomeSealhub

image.ts
No OneTemporary

image.ts

import { Primitive } from "./primitive";
import { predicates, ShapeToType } from "@sealcode/ts-predicates";
export const ImageShape = {
type: predicates.const(<const>"image"),
content: predicates.string,
id: predicates.maybe(predicates.string),
};
export type ImageJSON = ShapeToType<typeof ImageShape>;
// content here is the image url
export class ImagePrimitive extends Primitive {
content: string;
id: string | null = null;
constructor(json: Record<string, unknown>) {
super();
this.content = json["content"] as string;
this.id = json["id"] as string | null;
}
to_html(): string {
return `<img src="${this.content}"`;
}
extract_images(): string[] {
return [this.content];
}
}

File Metadata

Mime Type
text/x-java
Expires
Fri, Jan 24, 16:50 (10 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
599676
Default Alt Text
image.ts (708 B)

Event Timeline