From fe302c56f4c29650990a04dcecd8579bc35c11e6 Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Thu, 2 Jun 2022 16:01:23 +0200 Subject: [PATCH] Up Asset doc page --- docs/api.js | 1 + docs/api/asset.md | 24 ++++++++++-------------- docs/api/assets.md | 24 ------------------------ src/asset_manager/index.js | 1 + src/asset_manager/model/Asset.js | 6 ++++-- 5 files changed, 16 insertions(+), 40 deletions(-) diff --git a/docs/api.js b/docs/api.js index 81b53540f..d44053599 100644 --- a/docs/api.js +++ b/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]); diff --git a/docs/api/asset.md b/docs/api/asset.md index 1166bf458..af6e739b6 100644 --- a/docs/api/asset.md +++ b/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 diff --git a/docs/api/assets.md b/docs/api/assets.md index 175024446..6b86c53e1 100644 --- a/docs/api/assets.md +++ b/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 diff --git a/src/asset_manager/index.js b/src/asset_manager/index.js index e2c20053b..11d8eaab5 100644 --- a/src/asset_manager/index.js +++ b/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(); diff --git a/src/asset_manager/model/Asset.js b/src/asset_manager/model/Asset.js index 6d84d4d46..25ee99c36 100644 --- a/src/asset_manager/model/Asset.js +++ b/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() {