Pre-web image changes refactor (#560)
* Pre-web image changes refactor * Remove unneeded async behavior
This commit is contained in:
parent
74fbb47979
commit
bd80db619b
5 changed files with 22 additions and 35 deletions
|
@ -5,7 +5,6 @@ import {makeAutoObservable, runInAction} from 'mobx'
|
|||
import {openCropper} from 'lib/media/picker'
|
||||
import {POST_IMG_MAX} from 'lib/constants'
|
||||
import {scaleDownDimensions} from 'lib/media/util'
|
||||
import {openAltTextModal} from 'lib/media/alt-text'
|
||||
|
||||
// TODO: EXIF embed
|
||||
// Cases to consider: ExternalEmbed
|
||||
|
@ -43,16 +42,8 @@ export class ImageModel implements RNImage {
|
|||
this.scaledHeight = height
|
||||
}
|
||||
|
||||
async setAltText() {
|
||||
try {
|
||||
const altText = await openAltTextModal(this.rootStore, this.altText)
|
||||
|
||||
runInAction(() => {
|
||||
this.altText = altText
|
||||
})
|
||||
} catch (err) {
|
||||
this.rootStore.log.error('Failed to set alt text', err)
|
||||
}
|
||||
async setAltText(altText: string) {
|
||||
this.altText = altText
|
||||
}
|
||||
|
||||
async crop() {
|
||||
|
|
|
@ -4,6 +4,7 @@ import {makeAutoObservable} from 'mobx'
|
|||
import {ProfileModel} from '../content/profile'
|
||||
import {isObj, hasProp} from 'lib/type-guards'
|
||||
import {Image as RNImage} from 'react-native-image-crop-picker'
|
||||
import {ImageModel} from '../media/image'
|
||||
|
||||
export interface ConfirmModal {
|
||||
name: 'confirm'
|
||||
|
@ -43,8 +44,7 @@ export interface CropImageModal {
|
|||
|
||||
export interface AltTextImageModal {
|
||||
name: 'alt-text-image'
|
||||
prevAltText: string
|
||||
onAltTextSet: (altText?: string) => void
|
||||
image: ImageModel
|
||||
}
|
||||
|
||||
export interface AltTextImageReadModal {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue