[Feature]: Allow to import HTML documents
Question
Hi Team,
We are using grapesjs newsletter plugin in our project for importing and preview the template. We are facing some difficulty in retaining the template structure which we import in to grapesjs editor. Please check the below example
IMPORTED HTML
<!DOCTYPE html>
<html>
<body>
<h1>Grapesjs </h1>
<p>My first grapesjs template.</p>
</body>
</html>
EXPECTED OUTPUT
<!DOCTYPE html>
<html>
<body>
<h1>Grapesjs </h1>
<p>My first grapesjs template.</p>
</body>
</html>
ACTUAL OUTPUT , what we get from editor using the command (editor.runCommand('gjs-get-inlined-html'))
<h1 style="box-sizing: border-box;">Grapesjs</h1>
<p style="box-sizing: border-box;">My first grapesjs template..</p>
<style>..</style>
From the output u can see grapesjs has customised the actual template uploaded, by stripping off the html, head and body tags and adds new style tag in the content, Which we don't want to happen.
Is it possible for grapesjs editor to output html without altering the basic structure of the imported template. We looked for some options but couldn't find any.
Please help us in achieving this. Thanks
Answers (3)
@artf i am. First get the html with ->getHtml then put it in an dom element. Then extract the body en remove the title, meta, etc from the dom. Then extract the html again. Long live JQuery.
But still would be a great feature to do all that with grapesJS :-)
Currently, the editor imports only the content inside the body. To make it understand also other document nodes, it'd require a refactor of the current HTML parser
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1743
[FEATURE REQUEST] Add command to get actual template imported into editor
Hi Team, We are using grapesjs newsletter plugin in our project for importing and preview the template. We are facing some difficulty in re...
Issue #1744
[FEATURE REQUEST] Add Command to get actual template imported
Hi Team, We are using grapesjs newsletter plugin in our project for importing and preview the template. We are facing some difficulty in re...
Issue #1178
Want to replace wrapper div
Hello artf, I want to replace wrapper div, for example : When we create the newsletter template, wrapper div already exists there. On impor...
Issue #1909
SetComponents is sometimes very slow
Hi all We're working on a newsletter app and are using grapesjs as the email editor with the newsletter preset plguin and some custom chang...
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.