sanity-io / sanity-plugin-media

Asset management plugin for Sanity
MIT License
159 stars 51 forks source link

Allow users to specify maximum upload size #221

Closed azaxarov closed 4 months ago

azaxarov commented 4 months ago

Addresses https://github.com/sanity-io/sanity-plugin-media/issues/203

Prior to this PR, the media plugin had no customisation options. In particular, there was no way to specify maximum upload size, even though the underlying dropzone component has support for it. This PR is focused around customising the dropzone with maxSize and onDropRejected properties. This PR also introduces MediaToolOptions as a customer-facing API for customising the plugin.

Tool options are stored in ToolOptionsContext, which is exposed to the whole application through useToolOptions hook.

If any of the uploaded files is rejected with file-too-large error code, an error toast will be shown to the customer.

github-actions[bot] commented 4 months ago

:tada: This PR is included in version 2.3.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: