Issue #1894πŸ’¬ AnsweredOpened March 14, 2019by jwilson-lyonscg0 reactions

Custom Trait documentation example doesn't work

Quick answerby jwilson-lyonscg

Nevermind. I was misunderstanding the syntax. I didn't realize that the onChange and the onValueChange are 2 different unrelated methods apparently. It's not clear to me what onChange does exactly.

Read full answer below ↓

Question

Specifically this:

https://grapesjs.com/docs/modules/Traits.html#define-new-trait-type

First of all, the keyUp event references onChange when the function name is actually onChange. Next, even if you fix this, this.model.get('value') evaluates to a blank/null value whenever I make changes to it. The only way I can seem to get the actual value is to reference it at e.srcElement.value. That doesn't seem like the correct way to do it though so I would assume something with the get() code is not working right.

Answers (2)

jwilson-lyonscgβ€’ March 14, 2019

Nevermind. I was misunderstanding the syntax. I didn't realize that the onChange and the onValueChange are 2 different unrelated methods apparently. It's not clear to me what onChange does exactly.

lock[bot]β€’ March 17, 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.