Return span randomly in custom component
Well from what you've posted I can't tell what is happening but definitely, there is nothing generated randomly, just go deeper with the debug. BTW you can solve this easier by using find(query) method:
Read full answer below βQuestion
I have custom component and on trait change wanted to updated html but randomly it returned span/textnode in trait change function insted of html element. Below is html generated by component and on title change want to updated h4 element.linkModel.get("components").at(0) returns "div.programme-description" correctlylinkModel.get("components").at(1) returns "span" not sure from where it is cominglinkModel.get("components").at(2) returns "span" not sure from where it is cominglinkModel.get("components").at(3) returns "img.programme-content-image" correctlylinkModel.get("components").at(4) retu...
Answers (3)
Well from what you've posted I can't tell what is happening but definitely, there is nothing generated randomly, just go deeper with the debug. BTW you can solve this easier by using find(query) method:
@artf I tried to debug but no luck as it is happening on some pages and not on all pages. also
this.find is undefined

Just update grapesjs
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1198
QUESTIONS : Find element in Model
I have custom component and it render below html, I want to update value of h4 tilte and other element on trait changed, but not sure how c...
Issue #513
Model and returned html issue
I have below code to create custom component and wants to retrieve updated html via editor.html() but return wrong html, I am sure I am mis...
Issue #1313
Set traits value from html on component load
I have custom component and want to set trait default values from html. below is html rendered by component. traits I am trying to set for...
Issue #1493
Render() works on the first time but not on subsequent calls
Hello, I've created a custom component that shows images using background-image on a <div> instead of using an <img> element. It's mostly w...
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.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.