Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Allow to import HTML documents #1745

Closed
sankaran85 opened this issue Jan 23, 2019 · 9 comments
Closed

[Feature]: Allow to import HTML documents #1745

sankaran85 opened this issue Jan 23, 2019 · 9 comments

Comments

@sankaran85
Copy link

sankaran85 commented Jan 23, 2019

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

@artf
Copy link
Member

artf commented Jan 27, 2019

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

@sankaran85
Copy link
Author

@artf thanks for reply... can we expect this feature to be in next version? Any information on that.

@artf
Copy link
Member

artf commented Feb 5, 2019

can we expect this feature to be in next version?

I'm not sure, but I'm gonna try

@artf artf added this to To do in Release v0.14.55 via automation Feb 5, 2019
@artf artf removed this from To do in Release v0.14.55 Mar 10, 2019
@RuslanShohanov
Copy link

Hi, @artf. We've faced a similar issue. It would be great to keep imported html structure as is. Should we wait for next releases of grapejs or this feature won't be implemented? Maybe we can implement it on our poject? Unfortunatelly, I haven't found any information in grapesjs doc. Could you provide more information? Thanks

@artf
Copy link
Member

artf commented Sep 24, 2019

Hi @RuslanShokhanov currently I have no ETA for this feature and not planning to do it soon

@wimurk
Copy link

wimurk commented Oct 11, 2019

+1 i'm stuck on this issue. when when importing an existing template with head,meta's etc. Grapesjs removed the head element but places the meta's, styles and title inside the body.

@artf
Copy link
Member

artf commented Oct 19, 2019

@wimurk you have to remove them manually right now

@wimurk
Copy link

wimurk commented Oct 21, 2019

@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 :-)

@artf artf changed the title [FEATURE REQUEST] Add Command to get actual template imported [Feature] Allow to import HTML documents Aug 10, 2023
@artf artf changed the title [Feature] Allow to import HTML documents [Feature]: Allow to import HTML documents Aug 10, 2023
@artf
Copy link
Member

artf commented May 21, 2024

5 Added the possibility of importing HTML documents https://github.com//pull/5895

@artf artf closed this as completed May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

4 participants