Skip to content

Commit

Permalink
fix: accept selection of only .fott files for open local project (#554)
Browse files Browse the repository at this point in the history
  • Loading branch information
stew-ro authored Sep 8, 2020
1 parent 656de2f commit 193520e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/react/components/common/filePicker/filePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { IFileInfo } from "../../../../models/applicationState";
export interface IFilePickerProps {
onChange: (sender: SyntheticEvent, fileText: IFileInfo) => void;
onError: (sender: SyntheticEvent, error: any) => void;
accept: string[];
}

/**
Expand All @@ -36,7 +37,7 @@ export default class FilePicker extends React.Component<IFilePickerProps> {

public render() {
return (
<input id={shortid.generate()} ref={this.fileInput} type="file" onChange={this.onFileUploaded} />
<input id={shortid.generate()} ref={this.fileInput} type="file" onChange={this.onFileUploaded} accept={this.props.accept.join()}/>
);
}

Expand Down
4 changes: 3 additions & 1 deletion src/react/components/pages/homepage/homePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ export default class HomePage extends React.Component<IHomePageProps, IHomePageS
</a>
<FilePicker ref={this.filePicker}
onChange={this.onProjectFileUpload}
onError={this.onProjectFileUploadError} />
onError={this.onProjectFileUploadError}
accept={[".fott"]}
/>
</li>
}
<li>
Expand Down

0 comments on commit 193520e

Please sign in to comment.