GrapesJS / grapesjs

Free and Open source Web Builder Framework. Next generation tool for building templates without coding
https://grapesjs.com
BSD 3-Clause "New" or "Revised" License
22.38k stars 4.06k forks source link

Asset manager empty on second open #1854

Closed NicoEngler closed 5 years ago

NicoEngler commented 5 years ago

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:

  1. Click the SVG, (asset manager opens)
  2. Close the asset manager
  3. 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

noogen commented 5 years ago

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);

NicoEngler commented 5 years ago

Awesome, thanks for the catch! @noogen

lock[bot] commented 4 years ago

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.