Apply feedback

This commit is contained in:
Murderlon 2025-12-02 10:21:04 +01:00
parent f3e284a379
commit 65b5b70cee
No known key found for this signature in database
GPG key ID: 1FF861FF1DDBB953
3 changed files with 12 additions and 6 deletions

View file

@ -7,12 +7,8 @@
![CI status for Companion tests](https://github.com/transloadit/uppy/workflows/Companion/badge.svg)
![CI status for browser tests](https://github.com/transloadit/uppy/workflows/End-to-end%20tests/badge.svg)
TODO: Description
⚠ In beta.
**[Read the docs](https://uppy.io/docs/image-generator)** |
**[Try it](https://uppy.io/examples/dashboard/)**
**[Try it](https://uppy.io/examples/)**
Uppy is being developed by the folks at [Transloadit](https://transloadit.com),
a versatile file encoding service.
@ -21,8 +17,15 @@ a versatile file encoding service.
```js
import Uppy from '@uppy/core'
import ImageGenerator from '@uppy/image-generator'
const uppy = new Uppy()
.use(ImageGenerator, {
assemblyOptions: async (prompt) => {
const res = await fetch(`/assembly-options?prompt=${encodeURIComponent(prompt)}`)
return res.json()
}
})
```
## Installation

View file

@ -160,6 +160,8 @@ export default class ImageGenerator<
* - Uninstall: closeAssembly(true) called directly, cancels server-side assembly
*/
generate = async () => {
if (this.getPluginState().prompt.trim() === '') return
const { promise, resolve, reject } = Promise.withResolvers<void>()
let cancelled = false
@ -209,6 +211,7 @@ export default class ImageGenerator<
await promise
} catch (error) {
this.client.submitError(error as Error).catch(() => {})
this.uppy.info('Image could not be generated', 'error')
throw error
} finally {
// @ts-expect-error not typed because we do not depend on @uppy/dashboard

View file

@ -48,7 +48,7 @@ function FilterInput({
<button
className="uppy-u-reset uppy-ProviderBrowser-searchFilterReset"
type="button"
aria-label="Clear search"
aria-label={i18n('resetFilter')}
onClick={() => onChange('')}
>
<svg