Compare commits
4 commits
253fccaf78
...
170e23cba7
Author | SHA1 | Date | |
---|---|---|---|
170e23cba7 | |||
|
7b7d119831 | ||
|
8d0abe0195 | ||
|
7c383e8cd0 |
2 changed files with 53 additions and 27 deletions
|
@ -88,7 +88,9 @@ th {
|
|||
cursor: pointer;
|
||||
}
|
||||
|
||||
img, audio, video {
|
||||
img,
|
||||
audio,
|
||||
video {
|
||||
border-radius: $padding;
|
||||
margin-bottom: $padding;
|
||||
max-height: 75vh;
|
||||
|
@ -96,11 +98,9 @@ img, audio, video {
|
|||
}
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
min-width: 75vw;
|
||||
min-height: 75vh;
|
||||
box-sizing: border-box;
|
||||
@extend .paste;
|
||||
height: 75vh;
|
||||
border-color: white;
|
||||
}
|
||||
|
||||
.primary {
|
||||
|
@ -117,3 +117,29 @@ textarea {
|
|||
padding-left: $padding;
|
||||
}
|
||||
}
|
||||
|
||||
.button {
|
||||
@extend .hljs;
|
||||
|
||||
border: 1px solid white;
|
||||
border-radius: $padding;
|
||||
padding: $padding;
|
||||
margin: $padding;
|
||||
font-size: 16px;
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.file-upload {
|
||||
@extend .button;
|
||||
|
||||
input {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.text-upload {
|
||||
@extend .button;
|
||||
}
|
|
@ -25,20 +25,21 @@ require('highlightjs-line-numbers.js');
|
|||
|
||||
const FileForm = () => {
|
||||
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||
let file = event.target.files![0];
|
||||
const fr = new FileReader();
|
||||
fr.onload = (e) => {
|
||||
const { result } = e.target;
|
||||
if (result instanceof ArrayBuffer) {
|
||||
let data = new Uint8Array(result);
|
||||
fr.onload = (_e) => {
|
||||
let data = new Uint8Array(fr.result as ArrayBuffer);
|
||||
encrypt_array_buffer(data);
|
||||
}
|
||||
}
|
||||
fr.readAsArrayBuffer((event.target as HTMLInputElement).files[0]);
|
||||
fr.readAsArrayBuffer(file);
|
||||
}
|
||||
|
||||
return (
|
||||
return <>
|
||||
<label className="file-upload" >
|
||||
Select a file
|
||||
<input type="file" onChange={handleChange} />
|
||||
)
|
||||
</label>
|
||||
</>
|
||||
}
|
||||
|
||||
const PasteForm = () => {
|
||||
|
@ -50,22 +51,21 @@ const PasteForm = () => {
|
|||
}
|
||||
|
||||
return (
|
||||
<pre className='paste'>
|
||||
<form className='hljs centered' onSubmit={handleSubmit}>
|
||||
<textarea
|
||||
placeholder="Sample text"
|
||||
value={value}
|
||||
onChange={(e) => setValue(e.target.value)}
|
||||
/>
|
||||
<input type="submit" value="submit" />
|
||||
<input className="text-upload" type="submit" value="submit" />
|
||||
</form>
|
||||
</pre>
|
||||
)
|
||||
}
|
||||
|
||||
function createUploadUi() {
|
||||
const html = <main className='hljs centered fullscreen'>
|
||||
<FileForm />
|
||||
<p>or paste your data below</p>
|
||||
<PasteForm />
|
||||
</main>;
|
||||
|
||||
|
|
Loading…
Reference in a new issue