about summary refs log tree commit diff
path: root/src/lib/media/alt-text.ts
blob: 9f9f907bff931a9c4d9f18c7f79660c6865f0392 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import {RootStoreModel} from 'state/index'

export async function openAltTextModal(store: RootStoreModel): Promise<string> {
  return new Promise((resolve, reject) => {
    store.shell.openModal({
      name: 'alt-text-image',
      onAltTextSet: (altText?: string) => {
        if (altText) {
          resolve(altText)
        } else {
          reject(new Error('Canceled'))
        }
      },
    })
  })
}