Issue #2639πŸ’¬ AnsweredOpened March 12, 2020by MiseryMachine0 reactions

GrapesJS moving Mustache tokens

Quick answerby pouyamiralayi

@MiseryMachine have you tried wrapping your table internal's inside a `tbody` in your block definition? or at least moving your mustache tokens inside a tag?

Read full answer below ↓

Question

Hello, I am working with GrapesJS to allow users to create report templates. I've run into a problem with a block that creates a table, but the table rows are determined by Mustache tokens. However, when rendered, the tokens are moved outside of the table element. I believe the table or table row style is not allowing the existence of these tokens within the table element structure. My block: The product-list-type: When I drop the element onto the canvas, the {{#bomGroupProducts}} and {{/bomGroupProducts}} tokens are moved above the entire table. I need those tokens around the <tr> elements,...

Answers (3)

pouyamiralayiβ€’ March 12, 2020

@MiseryMachine have you tried wrapping your table internal's inside a tbody in your block definition? or at least moving your mustache tokens inside a tag?

MiseryMachineβ€’ March 13, 2020

Thanks for your suggestion. I have tried that with the same result, unfortunately. block script: Output: Maybe it's because GrapesJS is, by default, enforcing HTML structure. I'm still trying to work this out though.

artfβ€’ March 18, 2020

No, you can't do that because in that case, you have an invalid HTML, so the HTML parser moves it out. You have to create a valid HTML content to make the browser render it correctly:

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

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins β†’
Premium option

Premium plugins ship with support, regular updates, and production-ready features β€” save days of integration work.

Browse premium plugins β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.