[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)
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]'
}
}
});
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.
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.
Issue #1988
bug on resize image
Hi ! I have some issues when i want resize an image. When i put an image and when i click one resizer handler, the image don't keep his hei...
Issue #1906
Components & Js - Load Template
Hey, I have a component which has a JS attached to it. Everything is created using the JS. When I drag and drop my block for the first time...
Issue #1255
[QUESTION]: How to set editor html contents from custom component?
I'm having trouble getting a custom block+component to display its template HTML inside the grapes editor. Within the exported HTML, the ma...
Issue #1696
Traits appear first time when draged custom component
Hi artf , i have created custom component and add traits for it , when dragging this component to editor and select it the setting traits w...
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.