about summary refs log tree commit diff
path: root/src/state/models
diff options
context:
space:
mode:
authorOllie Hsieh <renahlee@outlook.com>2023-04-27 07:51:47 -0700
committerGitHub <noreply@github.com>2023-04-27 09:51:47 -0500
commit7a2c21026db702d028c20796a8d0bccd68de5464 (patch)
treeb0f200338e646c186fefb545b3638ef5146d0845 /src/state/models
parentc8e51a7d48587d977a7c005caeb9a1b215fa0ab5 (diff)
downloadvoidsky-7a2c21026db702d028c20796a8d0bccd68de5464.tar.zst
Load previous state in alt text modal (#546)
Diffstat (limited to 'src/state/models')
-rw-r--r--src/state/models/media/image.ts4
-rw-r--r--src/state/models/ui/shell.ts1
2 files changed, 3 insertions, 2 deletions
diff --git a/src/state/models/media/image.ts b/src/state/models/media/image.ts
index 3585bb083..d989380d1 100644
--- a/src/state/models/media/image.ts
+++ b/src/state/models/media/image.ts
@@ -15,7 +15,7 @@ export class ImageModel implements RNImage {
   width: number
   height: number
   size: number
-  altText?: string = undefined
+  altText = ''
   cropped?: RNImage = undefined
   compressed?: RNImage = undefined
   scaledWidth: number = POST_IMG_MAX.width
@@ -45,7 +45,7 @@ export class ImageModel implements RNImage {
 
   async setAltText() {
     try {
-      const altText = await openAltTextModal(this.rootStore)
+      const altText = await openAltTextModal(this.rootStore, this.altText)
 
       runInAction(() => {
         this.altText = altText
diff --git a/src/state/models/ui/shell.ts b/src/state/models/ui/shell.ts
index a2891d9bb..797d53f81 100644
--- a/src/state/models/ui/shell.ts
+++ b/src/state/models/ui/shell.ts
@@ -43,6 +43,7 @@ export interface CropImageModal {
 
 export interface AltTextImageModal {
   name: 'alt-text-image'
+  prevAltText: string
   onAltTextSet: (altText?: string) => void
 }