Issue #3329πŸ’¬ AnsweredOpened Mar 10, 2021by imouou0 reactions

How should I receive custom trait modifications in the script?

Quick answerby Ju99ernaut

You'll need to add the trait to script-props, you can read more here https://grapesjs.com/docs/modules/Components-js.html#passing-properties-to-scripts

Read full answer below ↓

Question

Hi, @artf, this is a great framework, thank you very much. I am now using it to create components of the mobile BUI framework, and I ran into a problem, I added a custom trait textarea, how can I make this When the data changes, it is triggered in the output script.

Answers (4)

imououβ€’ Mar 13, 2021

Thanks @Ju99ernaut, If it is some built-in features, when modifying the script can receive the value of the parameter, I am currently experiencing problems: custom feature textarea, can trigger changes such as dom, but the exported script can not receive the value of this parameter, even if the scr...

Ju99ernautβ€’ Mar 14, 2021

You can try forcing the script to update:

editor.DomComponents.addType('slide', {
   model: {
      // ...
      init() {
        this.on('change:datas', () => this.trigger('change:script'));
      },
   },
   // ...
});
GJSBlockβ€’ May 17, 2026

Thanks for reporting this, @imouou. Great question about How should I receive custom trait modifications in the script?. The recommended approach with Canvas is to use the event-driven API. Start here: Check the GrapesJS documentation for your specific module Look for the on() event listener method...

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.