mirror of
https://github.com/maputnik/editor.git
synced 2026-07-26 07:47:25 +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[]) => {
|
onLocalPMTilesSelected = (file: File) => {
|
||||||
const file = e[0];
|
|
||||||
const pmt = new PMTiles(new FileSource(file));
|
|
||||||
this.setState({
|
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}
|
onStyleOpen={this.onStyleChanged}
|
||||||
onSetMapState={this.setMapState}
|
onSetMapState={this.setMapState}
|
||||||
onToggleModal={this.toggleModal.bind(this)}
|
onToggleModal={this.toggleModal.bind(this)}
|
||||||
onFileSelected={this.onFileSelected}
|
onLocalPMTilesSelected={this.onLocalPMTilesSelected}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
const layerList = <LayerList
|
const layerList = <LayerList
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ type AppToolbarInternalProps = {
|
|||||||
onSetMapState(mapState: MapState): unknown
|
onSetMapState(mapState: MapState): unknown
|
||||||
mapState?: MapState
|
mapState?: MapState
|
||||||
renderer?: string
|
renderer?: string
|
||||||
onFileSelected(...args: unknown[]): unknown
|
onLocalPMTilesSelected(file: File): unknown
|
||||||
} & WithTranslation;
|
} & WithTranslation;
|
||||||
|
|
||||||
class AppToolbarInternal extends React.Component<AppToolbarInternalProps> {
|
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() {
|
render() {
|
||||||
const t = this.props.t;
|
const t = this.props.t;
|
||||||
const views = [
|
const views = [
|
||||||
@@ -293,7 +298,7 @@ class AppToolbarInternal extends React.Component<AppToolbarInternalProps> {
|
|||||||
<IconText>{t("Help")}</IconText>
|
<IconText>{t("Help")}</IconText>
|
||||||
</ToolbarLink>
|
</ToolbarLink>
|
||||||
|
|
||||||
<Dropzone onDrop={this.props.onFileSelected}>
|
<Dropzone onDrop={this.onFileSelected}>
|
||||||
{({getRootProps, getInputProps}) => (
|
{({getRootProps, getInputProps}) => (
|
||||||
<div {...getRootProps({className: 'dropzone maputnik-toolbar-link'})}>
|
<div {...getRootProps({className: 'dropzone maputnik-toolbar-link'})}>
|
||||||
<input {...getInputProps()} />
|
<input {...getInputProps()} />
|
||||||
|
|||||||
Reference in New Issue
Block a user