Assets rendering all imagens instead of just some.
Question
Hey @artf, first of all, great Job with the GrapesJS! I'm having a lot of fun working with it. Is is amazing!
So, about the issue, or maybe still new on that....
Situation: I want to be able to create a gallery using the Asset Manager. I followed the steps to create the list and add some categories.
I created this function to generate random images for me.
getAssets(howMany: number): any[] {
const assets = [];
for (let i = 0; i < howMany; i++) {
const randomColor = Math.floor(Math.random() * 16777215).toString(16);
const category = i % 2 === 0 ? 1 : 2;
const img = {
category: 'c' + category,
type: 'image',
unitDim: 'px',
height: 350,
width: 250,
src: `http://placehold.it/350x250/${randomColor}/fff/image${i + 1}.jpg`,
};
assets.push(img);
}
return assets;
}
And then I have this:
const am = editor.AssetManager;
am.add(this.getAssets(10));
const assets = am.getAll();
am.render(assets.filter((asset: any) => {
return asset.get('category') === 'c1';
}));
console.log('All assets: ', am.getAll().length);
console.log('All visible: ', am.getAllVisible().length);
The functions that I call the getAll() gives me 10, and the getAllVisible() gives me 5 as it was supposed to do. But when I open the modal for the Asset Manager, all the 10 imagens are showing, not only the 5 that I wanted....
Should I create my own Modal and show the visible ones or should the Asset Manager show only the visible ones?
Answers (3)
Thank you @cartifon, about the issue, honestly, I'd expect to see the Asset Manager updated, are you able to create a reproducible live demo so I can check it better?
0.12.17 is way too old, use the latest version of grapesjs and it'll work
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3010
Asset Manager Configuration Is not Working
Hi, I tried all possible ways to change asset manager configuration, but it is not working as expected. Even I create a sample plugin but i...
Issue #2910
Issue in Asset manager handling
Hi @artf, I'm now working on grapesJS implementation in our application. I have gone through documents provided & some of the issues report...
Issue #386
Extend Pannel/Command examples/documentation with opening a new view
Hi Artur, First of all grapesjs is awsome! At the moment i am trying to puzzle together how to create a pannel with a button that opens a n...
Issue #3287
QUESTION: Wrapper styling
First of all, congrats @artf for this amazing project 💯 I am currently working on a project and I wanted to ask if I can edit the wrapper...
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.