mirror of
https://github.com/mue/mue.git
synced 2026-07-07 22:23:37 +02:00
fix: sideload tab and file uploads
This commit is contained in:
@@ -330,7 +330,7 @@ export default class Create extends PureComponent {
|
||||
id="file-input"
|
||||
type="settings"
|
||||
accept="application/json"
|
||||
loadFunction={(e) => this.importSettings(JSON.parse(e.target.result))}
|
||||
loadFunction={(e) => this.importSettings(JSON.parse(e))}
|
||||
/>
|
||||
</SettingsItem>
|
||||
<div className="createButtons">
|
||||
|
||||
@@ -14,7 +14,9 @@ export default class FileUpload extends PureComponent {
|
||||
|
||||
if (this.props.type === 'settings') {
|
||||
reader.readAsText(file, 'UTF-8');
|
||||
return this.props.loadFunction(e);
|
||||
reader.onload = (e) => {
|
||||
return this.props.loadFunction(e.target.result);
|
||||
}
|
||||
} else {
|
||||
// background upload
|
||||
const settings = {};
|
||||
|
||||
@@ -52,7 +52,7 @@ export function exportSettings() {
|
||||
}
|
||||
|
||||
export function importSettings(e) {
|
||||
const content = JSON.parse(e.target.result);
|
||||
const content = JSON.parse(e);
|
||||
|
||||
Object.keys(content).forEach((key) => {
|
||||
localStorage.setItem(key, content[key]);
|
||||
|
||||
Reference in New Issue
Block a user