Issue #1121Opened May 18, 2018by alimajed930 reactions

[BUG] - <Tbody> inside <Table>

Question

Hi @artf ,

I created a new component with tagName = 'table'. When selected and one option of its toolbar I also created is clicked, a new modal opens, and when the user submits, some content should be added to the block. I am using editor.getSelected().get('components').add(HtmlCode), where HTML code always starts with <tbody><tr><td>. My issue is that those tags are being omitted. So the final result is <table>[Rest of the HTML code] instead of <table><tbody><tr><td>[Rest of the HTML code].

I think it is because tbody is only draggable inside a table? But as I mentioned, the component is already a table. If <tbody><tr><td> are replaced by a <div> per example, everything works as expected.

Any idea How to solve this issue?

Thank you!

Answers (3)

artfMay 23, 20180 reactions

I think this happens because when you add the HtmlCode is parsed by the browser, but outside of the table scope and therefore it strips your tags. Try to skip the parser by passing a component object:

// And instead of adding <tbody> I'd prefer to set a new one as you might end adding 2 of them 
editor.getSelected().components({
	tagName: 'tbody',
	components: {
		tagName: 'tr',
		components: {
			tagName: 'td',
			components: '[Rest of the HTML code]'
		}
	}
});
no-response[bot]June 2, 20180 reactions

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

lock[bot]September 17, 20190 reactions

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

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.