mirror of
https://github.com/transloadit/uppy.git
synced 2026-01-23 02:25:07 +00:00
Apply feedback
This commit is contained in:
parent
f3e284a379
commit
65b5b70cee
3 changed files with 12 additions and 6 deletions
|
|
@ -7,12 +7,8 @@
|
|||

|
||||

|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue