Browse Source

Up TS docs

pull/5778/head
Artur Arseniev 2 years ago
parent
commit
d9ca5e2223
  1. 77
      docs/api/assets.md

77
docs/api/assets.md

@ -19,18 +19,71 @@ const assetManager = editor.AssetManager;
```
## Available Events
* `asset:add` New asset added to the collection. The [Asset] is passed as an argument to the callback.
* `asset:open` - Asset Manager opened.
* `asset:close` - Asset Manager closed.
* `asset:add` - Asset added. The [Asset] is passed as an argument to the callback.
* `asset:remove` - Asset removed. The [Asset] is passed as an argument to the callback.
* `asset:update` - Asset updated. The updated [Asset] and the object containing changes are passed as arguments to the callback.
* `asset:upload:start` - Before the upload is started.
* `asset:upload:end` - After the upload is ended.
* `asset:upload:error` - On any error in upload, passes the error as an argument.
* `asset:upload:response` - On upload response, passes the result as an argument.
* `asset` - Catch-all event for all the events mentioned above. An object containing all the available data about the triggered event is passed as an argument to the callback.
* `asset:custom` - Event for handling custom Asset Manager UI.
```javascript
editor.on('asset:add', (asset) => { ... });
```
* `asset:remove` Asset removed from the collection. The [Asset] is passed as an argument to the callback.
```javascript
editor.on('asset:remove', (asset) => { ... });
```
* `asset:update` Asset updated. The [Asset] and the object containing changes are passed as arguments to the callback.
```javascript
editor.on('asset:update', (asset, updatedProps) => { ... });
```
* `asset:open` Asset Manager opened.
```javascript
editor.on('asset:open', () => { ... });
```
* `asset:close` Asset Manager closed.
```javascript
editor.on('asset:close', () => { ... });
```
* `asset:upload:start` Asset upload start.
```javascript
editor.on('asset:upload:start', () => { ... });
```
* `asset:upload:end` Asset upload end.
```javascript
editor.on('asset:upload:end', (result) => { ... });
```
* `asset:upload:error` Asset upload error.
```javascript
editor.on('asset:upload:error', (error) => { ... });
```
* `asset:upload:response` Asset upload response.
```javascript
editor.on('asset:upload:response', (res) => { ... });
```
* `asset:custom` Event to use in case of [custom Asset Manager UI](https://grapesjs.com/docs/modules/Assets.html#customization).
```javascript
editor.on('asset:custom', ({ container, assets, ... }) => { ... });
```
* `asset` Catch-all event for all the events mentioned above. An object containing all the available data about the triggered event is passed as an argument to the callback.
```javascript
editor.on('asset', ({ event, model, ... }) => { ... });
```
## Methods
@ -160,7 +213,7 @@ Remove asset
### Parameters
* `asset` **([String][13] | [Asset])** Asset or asset URL
* `opts` **Record<[string][13], any>?**
* `opts` **RemoveOptions?**
### Examples

Loading…
Cancel
Save