Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F969365
input-image-preview.stimulus.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
494 B
Referenced Files
None
Subscribers
None
input-image-preview.stimulus.ts
View Options
import
{
Controller
}
from
"stimulus"
;
export
default
class
InputImagePreview
extends
Controller
{
id
:
string
;
handleChange
()
{
const
img
=
this
.
element
.
querySelector
(
"img"
);
window
.
URL
.
revokeObjectURL
(
img
.
src
);
const
new_url
=
window
.
URL
.
createObjectURL
(
this
.
element
.
querySelector
(
"input"
).
files
[
0
]
);
img
.
src
=
new_url
;
img
.
parentNode
;
img
.
parentElement
.
querySelectorAll
(
"source"
)
.
forEach
((
e
)
=>
e
.
parentNode
.
removeChild
(
e
));
img
.
style
.
aspectRatio
=
"1"
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Fri, Nov 22, 20:15 (1 d, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
547743
Default Alt Text
input-image-preview.stimulus.ts (494 B)
Attached To
Mode
rPLAY Sealious playground
Attached
Detach File
Event Timeline
Log In to Comment