Browse Source

Up Asset doc page

pull/4363/head
Artur Arseniev 4 years ago
parent
commit
fe302c56f4
  1. 1
      docs/api.js
  2. 24
      docs/api/asset.md
  3. 24
      docs/api/assets.md
  4. 1
      src/asset_manager/index.js
  5. 6
      src/asset_manager/model/Asset.js

1
docs/api.js

@ -63,6 +63,7 @@ async function generateDocs () {
.replace(/<\(\\\[/g, '<([')
.replace(/\| \\\[/g, '| [')
.replace(/\\n```js/g, '```js')
.replace(/docsjs\./g, '')
.replace('**Extends Model**', '');
fs.writeFileSync(`${docRoot}/api/${file[1]}`, res);
log('Created', file[1]);

24
docs/api/asset.md

@ -2,18 +2,16 @@
## Asset
### Properties
* `type` **[String][1]** Asset type, eg. 'image'.
* `src` **[String][1]** Asset URL, eg. '[https://.../image.png][2]'.
* `type` **[String][1]** Asset type, eg. `'image'`.
* `src` **[String][1]** Asset URL, eg. `'https://.../image.png'`.
### getType
## getType
Get asset type.
#### Examples
### Examples
```javascript
// Asset: { src: 'https://.../image.png', type: 'image' }
@ -22,11 +20,11 @@ asset.getType(); // -> 'image'
Returns **[String][1]**
### getSrc
## getSrc
Get asset URL.
#### Examples
### Examples
```javascript
// Asset: { src: 'https://.../image.png' }
@ -35,11 +33,11 @@ asset.getSrc(); // -> 'https://.../image.png'
Returns **[String][1]**
### getFilename
## getFilename
Get filename of the asset (based on `src`).
#### Examples
### Examples
```javascript
// Asset: { src: 'https://.../image.png' }
@ -50,11 +48,11 @@ asset.getFilename(); // -> 'image'
Returns **[String][1]**
### getExtension
## getExtension
Get extension of the asset (based on `src`).
#### Examples
### Examples
```javascript
// Asset: { src: 'https://.../image.png' }
@ -66,5 +64,3 @@ asset.getExtension(); // -> ''
Returns **[String][1]**
[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
[2]: https://.../image.png

24
docs/api/assets.md

@ -179,30 +179,6 @@ Return the Asset Manager Container
Returns **[HTMLElement][16]**
## render
Render assets
### Parameters
* `assts`
* `assets` **[array][12]** Assets to render, without the argument will render all global assets
### Examples
```javascript
// Render all assets
assetManager.render();
// Render some of the assets
const assets = assetManager.getAll();
assetManager.render(assets.filter(
asset => asset.get('category') == 'cats'
));
```
Returns **[HTMLElement][16]**
[1]: https://github.com/artf/grapesjs/blob/master/src/asset_manager/config/config.js
[2]: #open

1
src/asset_manager/index.js

@ -308,6 +308,7 @@ export default () => {
* Render assets
* @param {array} assets Assets to render, without the argument will render all global assets
* @returns {HTMLElement}
* @private
* @example
* // Render all assets
* assetManager.render();

6
src/asset_manager/model/Asset.js

@ -2,8 +2,10 @@ import { result } from 'underscore';
import { Model } from '../../common';
/**
* @property {String} type Asset type, eg. 'image'.
* @property {String} src Asset URL, eg. 'https://.../image.png'.
* @property {String} type Asset type, eg. `'image'`.
* @property {String} src Asset URL, eg. `'https://.../image.png'`.
*
* @module docsjs.Asset
*/
export default class Asset extends Model {
defaults() {

Loading…
Cancel
Save