Issue #2226πŸ’¬ AnsweredOpened Aug 28, 2019by tliscomb1 reactions

Updating a component type trait definition after init

Quick answerby pouyamiralayi❀ 1

Hello! you must attach a listener for the file property, so whenever it changes to a new value(file), your listener will append it to the end of the options: NOTICE here i am listening to the changes on the selected-src itself, for your case you must listen to your file related property. NOTICE i see that for your sel...

Read full answer below ↓

Question

I have created a custom component & block which is used to display/embed uploaded files. I have defined traits for this component see below. When a new file is uploaded I need to update the options of the selected-src trait so that the user can use the select in the settings panel to select the file to be displayed. Any help would be greatly appreciated.

Answers (2)

pouyamiralayiβ€’ Aug 29, 2019

Hello! you must attach a listener for the file property, so whenever it changes to a new value(file), your listener will append it to the end of the options: NOTICE here i am listening to the changes on the selected-src itself, for your case you must listen to your file related property. NOTICE i s...

artfβ€’ Sep 4, 2019

Yeah the key part proposed by @pouyamiralayi is here This is how you update traits at run-time (more about this here)

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 β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.