Rework modals to support multiple active
This commit is contained in:
parent
b4f2a6979a
commit
154c34e915
13 changed files with 147 additions and 187 deletions
|
@ -1,6 +1,5 @@
|
|||
/// <reference lib="dom" />
|
||||
|
||||
import {CropImageModal} from 'state/models/shell-ui'
|
||||
import {PickerOpts, CameraOpts, CropperOpts, PickedMedia} from './types'
|
||||
export type {PickedMedia} from './types'
|
||||
import {RootStoreModel} from 'state/index'
|
||||
|
@ -51,15 +50,17 @@ export async function openCropper(
|
|||
): Promise<PickedMedia> {
|
||||
// TODO handle more opts
|
||||
return new Promise((resolve, reject) => {
|
||||
store.shell.openModal(
|
||||
new CropImageModal(opts.path, (img?: PickedMedia) => {
|
||||
store.shell.openModal({
|
||||
name: 'crop-image',
|
||||
uri: opts.path,
|
||||
onSelect: (img?: PickedMedia) => {
|
||||
if (img) {
|
||||
resolve(img)
|
||||
} else {
|
||||
reject(new Error('Canceled'))
|
||||
}
|
||||
}),
|
||||
)
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue