From 82658618d0ca7feaa561cb4db9cfb5012752d71a Mon Sep 17 00:00:00 2001 From: jessop Date: Fri, 27 Sep 2019 12:22:15 -0400 Subject: [PATCH] wip publish page --- src/ui/component/common/file-selector.jsx | 36 ++++++++++++++--------- src/ui/component/publishForm/view.jsx | 5 +--- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/ui/component/common/file-selector.jsx b/src/ui/component/common/file-selector.jsx index 63e45338c..a2bdb0d03 100644 --- a/src/ui/component/common/file-selector.jsx +++ b/src/ui/component/common/file-selector.jsx @@ -1,6 +1,9 @@ // @flow import * as React from 'react'; +// @if TARGET='app' +// $FlowFixMe import { remote } from 'electron'; +// @endif import Button from 'component/button'; import { FormField } from 'component/common/form'; import path from 'path'; @@ -26,7 +29,7 @@ class FileSelector extends React.PureComponent { type: 'file', }; - fileInput: { current: React.ElementRef }; + fileInput: React.ElementRef; constructor() { super(); @@ -61,19 +64,19 @@ class FileSelector extends React.PureComponent { } // TODO: Add this back for web publishing - // handleFileInputSelection() { - // const { files } = this.fileInput.current; - // if (!files) { - // return; - // } + handleFileInputSelection() { + const { files } = this.fileInput.current; + if (!files) { + return; + } - // const filePath = files[0]; - // const fileName = filePath.name; + const filePath = files[0]; + const fileName = filePath.name; - // if (this.props.onFileChosen) { - // this.props.onFileChosen(filePath, fileName); - // } - // } + if (this.props.onFileChosen) { + this.props.onFileChosen(filePath, fileName); + } + } input: ?HTMLInputElement; @@ -84,6 +87,7 @@ class FileSelector extends React.PureComponent { return ( + {/* @if TARGET='app' */} { type="text" ref={this.fileInput} onFocus={() => { - if (this.fileInput) this.fileInput.current.select(); + if (this.fileInput) this.fileInput.select(); }} readOnly="readonly" value={currentPath || placeholder || __('Choose a file')} - inputButton={