BUG: this.get('content') returns empty string when trying to add custom component type
Question
Version: 0.16.18
Are you able to reproduce the bug from the demo?
[ X ] Yes [ ] No
What is the expected behavior? Expecting this.get('content') in the context of the model while creating a new component type (extending the default component type) should return the children as HTML.
Describe the bug detailed
Not sure if it's a but or I'm doing something wrong however in all of the examples I've come across in other issues it seems like this.get('content') should return it's children's HTML but instead it returns an empty string.
What is the current behavior? It only returns the text content in the component if there is any but if there are children components it will not return them.
Are you able to attach screenshots, screencasts or a live demo?

[ X ] Yes (attach) [ ] No
Answers (3)
No, content property is only used in components like Text/Textnode.
Replace your this.get('content') with this.components().map(comp => comp.toHTML())
@artf does this look like a bug or am I doing something wrong?
@artf does this look like a bug or am I doing something wrong?
May be try model.components() insead of content
Related Questions and Answers
Continue research with similar issue discussions.
Issue #3352
BUG: Default Content is getting Inserted while using setComponents if Tag Body is empty
Version: Latest You can get the version by typing grapesjs.version into the console Are you able to reproduce the bug from the demo?[X] Yes...
Issue #3434
BUG: Using imported HTML/CSS/JS into the editor shows outlines, but no content, JS Fiddle inside
You can get the version by typing grapesjs.version into the console YES: https://jsfiddle.net/75a9u1cf/2/ What is the expected behavior? I...
Issue #2882
BUG: Problem with adding caption element block to the canvas
Version: 0.16.18 Are you able to reproduce the bug from the demo? [x ] Yes https://jsfiddle.net/triawarman/tmcoqxhp/ What is the expected b...
Issue #2921
BUG: Autosave not working on style manager when classes are disabled
Version: 0.16.18 Are you able to reproduce the bug from the demo? [x ] Yes: https://jsfiddle.net/ju1a0onx/ What is the expected behavior? A...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.