Issue #1854πŸ’¬ AnsweredOpened March 4, 2019by NicoEngler1 reactions

Asset manager empty on second open

Quick answerby noogen❀ 1

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:

  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

Answers (3)

noogenβ€’ March 4, 2019

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β€’ March 4, 2019

Awesome, thanks for the catch! @noogen

lock[bot]β€’ March 10, 2020

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.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins β†’
Premium option

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.

All tutorials β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.