[Bug]: Asset manager addType function not working after reload page
Question
`am.addType('svg-icon', {
view: {
// `getPreview()` and `getInfo()` are just few helpers, you can
// override the entire template with `template()`
// Check the base `template()` here:
// https://github.com/artf/grapesjs/blob/dev/src/asset_manager/view/AssetView.js
getPreview() {
return `<div style="text-align: center">${this.model.get('svgContent')}</div>`;
},
getInfo() {
// You can use model's properties if you passed them:
// am.add({
// type: 'svg-icon',
// svgContent: '<svg ...',
// name: 'Some name'
// })
// ... then
// this.model.get('name');
return '<div>SVG description</div>';
},
},
isType(value) {...}
})`
getPreview and getInfo functions do not apply if assets load from local storage.Answers (1)
Follow the issue template if you're submitting a bug, you have to create, at least, a reproducible demo
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3596
BUG: Values are not escaped
GrapesJS code is open to XSS issues because values are inserted into DOM without escaping, e.g. https://github.com/artf/grapesjs/blob/dev/s...
Issue #5941
BUG: GrapesJS CDN not working
GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? Chrome 125.0.6422.113 Reproducible demo li...
Issue #1609
Grapesjs, How to extract html/css code in view code into console log?
WARNING READ and FOLLOW next 5 steps, then REMOVE them before posting the issueFollow CONTRIBUTING Guidelines https://github.com/artf/grape...
Issue #3645
BUG:
WARNING READ and FOLLOW next 3 steps, then REMOVE them before posting the issueFollow CONTRIBUTING Guidelines https://github.com/artf/grape...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.