How to listen to trait value change directly from block add
Question
I'm passing following JSON to editor.BlockManager.add() function to define my block, load it's content from the server and populate select-type trait named defaultCategory in the same manner. Everything works nice. Now I need to listen to onchange event of that select and execute some JS there. I've consulted https://grapesjs.com/docs/modules/Traits.html#add-traits-to-components but can't fugure out how to do this. Would you mind to quickly show how would I execute alert('test') when value of my trait is changed (by user selecting one of the options)? Thanks in advance. For the button there i...
Answers (3)
Did you solve this issue? If so, how?
guide please
@lofcz How do you fix this problem?
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3704
load blocks closed by default?
I am using the following bit of code to collapse all the block categories, unfortunately, this is not working live demo : https://jsfiddle....
Issue #3626
How to set src of video tag at dynamic?
Hi @artf , Hi I have drag and drop video tag and button from blockmanager, On Clicking the button , I need to change the url to src. But no...
Issue #3237
Add Trait For wrapper
Hi @artf I've added trait for wrapper this way. How can I perform the init function for the same Here is the code @artf Could you please he...
Issue #2189
[Question] How to add "Ordered/Unordered List" option in rte/custom block
Hi I'm trying to create an ordered list with grapesjs. I tried adding the following to the rte: And this works if my page is pre-filled wit...
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 βBrowse Plugin Categories
Jump directly to plugin category pages on the marketplace.