Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F1263145
image.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
708 B
Referenced Files
None
Subscribers
None
image.ts
View Options
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
Details
Attached
Mime Type
text/x-java
Expires
Fri, Jan 24, 16:50 (7 h, 7 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
599676
Default Alt Text
image.ts (708 B)
Attached To
Mode
rJDD jdd
Attached
Detach File
Event Timeline
Log In to Comment