Asset manager empty on second open
Line 28, you're filtering it twice since you're already doing it on line 23? am.render(am.getAll().filter(assets)); Works when I'm doing it like so: am.render(assets);
Read full answer below βQuestion
Hi, I am trying to build a plugin which sets up the asset manager as a SVG repository. If the user selects a SVG, the asset manager opens. Next, the user can replace the current SVG with the one selected. Most of the code I am using is found on: https://grapesjs.com/docs/modules/Assets.html#customization
Demo: https://jsfiddle.net/9vgf573s/12/
Problem:
- Click the SVG, (asset manager opens)
- Close the asset manager
- Click the SVG again -> asset manager is empty
What am I doing wrong?
PS: Replacing does not seem to work either but I have not really looked into it because the current problem makes it annoying to debug.
Cheers
Answers (3)
Line 28, you're filtering it twice since you're already doing it on line 23? am.render(am.getAll().filter(assets));
Works when I'm doing it like so: am.render(assets);
Awesome, thanks for the catch! @noogen
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #497
Asset manager
hi @artf , is it possible to replace current asset manager , from my custom one? I have created my own asset manager , i want to use that t...
Issue #1030
[Question] Firing events with custom components
I'm trying to build a plugin for Grapesjs with some custom components, and I'm having trouble with triggering events and interacting with t...
Issue #1327
[QUESTIONS] Replacing selected text and getting html
Hi! Im trying to replace selected text with a code (random code). It's works, i can see the code, but when i do editor.getHtml() not. If i...
Issue #1863
Adding new components to Block Manager
I'm trying to add multiple components which are in my canvas into the block manager but I believe because of an id issue they're not visibl...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins βPremium plugins ship with support, regular updates, and production-ready features β save days of integration work.
Browse premium plugins βRelated tutorials
In-depth guides on the same topic.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.