TextNodes interfere when changing content on element
Hi Juan, thanks for the report, are you able to show me how your text trait works? I'd expect it to work correctly if you update your component in this way component.components(e.target.value)
Read full answer below โQuestion
Version: 0.16.44 Hi @artf I have a custom block with a custom button component, which its content is similar to this one. <a data-gjs-type="custom_button" class="btn btn-1" href="">Click here</a> Additionally, I've added a text trait to change the button content, in this particular case I do not want to use the editor RTE. <img width="286" alt="image" src="https://user-images.githubusercontent.com/1976679/109966677-d3a91180-7cf0-11eb-8463-e28b8de806c2.png"> When i change the value, the first time it gets reflected correctly <img width="975" alt="image" src="https://user-images.githubuserconte...
Answers (4)
Hi Juan, thanks for the report, are you able to show me how your text trait works?
I'd expect it to work correctly if you update your component in this way component.components(e.target.value)
This was my trait I have changed it to And now it works without overriding update content or render children, thanks! I would have never arrived to the conclusion of using the components method. Now i don't like text nodes ๐ I think we can close this issue unless there's some other point you want...
I don't think you need this one target.set('content', value);. For the rest all good ๐
Thanks for reporting this, @jcamejo. Thanks for sharing your report about TextNodes interfere when changing content on element. To help the team investigate and prioritize this: Please provide: A minimal reproducible example (CodeSandbox/JSFiddle) Your GrapesJS version number Browser and OS informa...
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3500
Remove custom trait by its type.
I have created a custom trait but the name of that trait will be dynamic which is unknown. The problem is that the current removeTrait() on...
Issue #3546
How can I add the custom left toolbar for Image component similar to text
We want to add a custom toolbar to the image component to be shown at left side (similar to what we show for text component). Please let me...
Issue #3732
Comment component type do not support adding traits
i am working on a script that add a trait on all the component type , but the comment type do not have the prototype object. code
Issue #3507
No Generated ID and No auto select ID
Hi Guys, I am using grapesjs-blocks-bootstrap4 and I check how they component it's looks fine. But when you select block like container it...
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 โRelated tutorials
In-depth guides on the same topic.
Tutorial
Introducing Search on GJS.Market
GJS.Market now has one search across everything we publish โ plugins, articles, community questions, guides, authors and services. Press โK from any page.
Tutorial
GJS.Market Is Now Available for India ๐ฎ๐ณ
GJS.Market is expanding its global presence with a dedicated experience for developers, agencies, SaaS companies, and digital creators in India
Tutorial
How to Build an AI-Powered Page Builder with GrapesJS in 2026
What we learned building GJSDocs โ from simple AI text generation to structured, context-aware visual editing
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.