Issue #2943Opened August 7, 2020by Joshmamroud1 reactions

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?

>>> 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?

demo

[ X ] Yes (attach) [ ] No

Answers (3)

artfAugust 27, 20201 reactions

No, content property is only used in components like Text/Textnode. Replace your this.get('content') with this.components().map(comp => comp.toHTML())

JoshmamroudAugust 11, 20200 reactions

@artf does this look like a bug or am I doing something wrong?

DmitryTar1August 13, 20200 reactions

@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.

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...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.