mirror of
https://codeberg.org/uzu/strudel
synced 2026-08-01 21:37:42 -04:00
cleanup
This commit is contained in:
@@ -3,37 +3,27 @@ import { useSettings, storeStartupScript } from '../../../settings.mjs';
|
||||
import { SpecialActionInput } from '../button/action-button';
|
||||
|
||||
async function importScript(script) {
|
||||
const reader = new FileReader()
|
||||
reader.readAsText(script)
|
||||
const reader = new FileReader();
|
||||
reader.readAsText(script);
|
||||
|
||||
reader.onload = () => {
|
||||
const text = reader.result;
|
||||
console.info(text)
|
||||
storeStartupScript(text)
|
||||
|
||||
};
|
||||
|
||||
reader.onerror = () => {
|
||||
errorLogger(new Error('failed to import prebake script'), 'ImportPrebakeScriptButton')
|
||||
}
|
||||
reader.onload = () => {
|
||||
const text = reader.result;
|
||||
storeStartupScript(text);
|
||||
};
|
||||
|
||||
reader.onerror = () => {
|
||||
errorLogger(new Error('failed to import prebake script'), 'importScript');
|
||||
};
|
||||
}
|
||||
export function ImportPrebakeScriptButton() {
|
||||
const settings = useSettings();
|
||||
const settings = useSettings();
|
||||
|
||||
return <SpecialActionInput type="file"
|
||||
label="import prebake script"
|
||||
accept=".strudel, .txt"
|
||||
onChange={(e) => importScript(e.target.files[0])} />
|
||||
|
||||
// return <label className="hover:opacity-50 cursor-pointer">
|
||||
// <input
|
||||
// style={{ display: 'none' }}
|
||||
// type="file"
|
||||
// // multiple
|
||||
// accept=".strudel, .txt"
|
||||
// onChange={(e) => importScript(e.target.files[0])}
|
||||
// />
|
||||
// import prebake script
|
||||
// </label>
|
||||
}
|
||||
return (
|
||||
<SpecialActionInput
|
||||
type="file"
|
||||
label="import prebake script"
|
||||
accept=".strudel"
|
||||
onChange={(e) => importScript(e.target.files[0])}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user