Skip to content

Commit ad6eba6

Browse files
committed
opening upload dialog on double click
1 parent d8b855c commit ad6eba6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/components/FileEditor/FileEditor.react.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ export default class FileEditor extends React.Component {
2626
componentDidMount() {
2727
document.body.addEventListener('click', this.checkExternalClick);
2828
document.body.addEventListener('keypress', this.handleKey);
29+
let fileInputElement = document.getElementById('fileInput');
30+
fileInputElement.click();
2931
}
3032

3133
componentWillUnmount() {
@@ -72,9 +74,9 @@ export default class FileEditor extends React.Component {
7274
render() {
7375
const file = this.props.value;
7476
return (
75-
<div ref='input' style={{ minWidth: this.props.width }} className={styles.editor}>
77+
<div ref='input' style={{ minWidth: this.props.width, visibility: 'hidden' }} className={styles.editor}>
7678
<a className={styles.upload}>
77-
<input ref='fileInput' type='file' onChange={this.handleChange.bind(this)} />
79+
<input ref='fileInput' id="fileInput" type='file' onChange={this.handleChange.bind(this)} />
7880
<span>{file ? 'Replace file' : 'Upload file'}</span>
7981
</a>
8082
</div>

0 commit comments

Comments
 (0)