Back to Grapesjs

Asset

docs/api/asset.md

0.22.161.2 KB
Original Source
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

Asset

Properties

  • type String Asset type, eg. 'image'.
  • src String Asset URL, eg. 'https://.../image.png'.

getType

Get asset type.

Examples

javascript
// Asset: { src: 'https://.../image.png', type: 'image' }
asset.getType(); // -> 'image'

Returns String

getSrc

Get asset URL.

Examples

javascript
// Asset: { src: 'https://.../image.png'  }
asset.getSrc(); // -> 'https://.../image.png'

Returns String

getFilename

Get filename of the asset (based on src).

Examples

javascript
// Asset: { src: 'https://.../image.png' }
asset.getFilename(); // -> 'image.png'
// Asset: { src: 'https://.../image' }
asset.getFilename(); // -> 'image'

Returns String

getExtension

Get extension of the asset (based on src).

Examples

javascript
// Asset: { src: 'https://.../image.png' }
asset.getExtension(); // -> 'png'
// Asset: { src: 'https://.../image' }
asset.getExtension(); // -> ''

Returns String