mirror of
https://github.com/maputnik/editor.git
synced 2026-02-09 06:00:09 +00:00
moved Dropzone's onDrop handler to AppToolbar
This commit is contained in:
@@ -884,11 +884,9 @@ export default class App extends React.Component<any, AppState> {
|
||||
});
|
||||
}
|
||||
|
||||
onFileSelected = (e: File[]) => {
|
||||
const file = e[0];
|
||||
const pmt = new PMTiles(new FileSource(file));
|
||||
onLocalPMTilesSelected = (file: File) => {
|
||||
this.setState({
|
||||
localPMTiles: pmt
|
||||
localPMTiles: new PMTiles(new FileSource(file))
|
||||
})
|
||||
}
|
||||
|
||||
@@ -906,7 +904,7 @@ export default class App extends React.Component<any, AppState> {
|
||||
onStyleOpen={this.onStyleChanged}
|
||||
onSetMapState={this.setMapState}
|
||||
onToggleModal={this.toggleModal.bind(this)}
|
||||
onFileSelected={this.onFileSelected}
|
||||
onLocalPMTilesSelected={this.onLocalPMTilesSelected}
|
||||
/>
|
||||
|
||||
const layerList = <LayerList
|
||||
|
||||
@@ -105,7 +105,7 @@ type AppToolbarInternalProps = {
|
||||
onSetMapState(mapState: MapState): unknown
|
||||
mapState?: MapState
|
||||
renderer?: string
|
||||
onFileSelected(...args: unknown[]): unknown
|
||||
onLocalPMTilesSelected(file: File): unknown
|
||||
} & WithTranslation;
|
||||
|
||||
class AppToolbarInternal extends React.Component<AppToolbarInternalProps> {
|
||||
@@ -137,6 +137,11 @@ class AppToolbarInternal extends React.Component<AppToolbarInternalProps> {
|
||||
}
|
||||
}
|
||||
|
||||
onFileSelected = (e: File[]) => {
|
||||
const file = e[0];
|
||||
this.props.onLocalPMTilesSelected(file);
|
||||
}
|
||||
|
||||
render() {
|
||||
const t = this.props.t;
|
||||
const views = [
|
||||
@@ -293,7 +298,7 @@ class AppToolbarInternal extends React.Component<AppToolbarInternalProps> {
|
||||
<IconText>{t("Help")}</IconText>
|
||||
</ToolbarLink>
|
||||
|
||||
<Dropzone onDrop={this.props.onFileSelected}>
|
||||
<Dropzone onDrop={this.onFileSelected}>
|
||||
{({getRootProps, getInputProps}) => (
|
||||
<div {...getRootProps({className: 'dropzone maputnik-toolbar-link'})}>
|
||||
<input {...getInputProps()} />
|
||||
|
||||
Reference in New Issue
Block a user