[Question] How do I set <body> attributes
Question
Hi @artf,
On the previous issue #1132 about export <body my="attributes"> code, I think it's done using exportWrapper: true. But now experiencing constraints when it will import attributes from <body>, I try to set attributes does not work. I used importWrapper: true. Any solutions?
Please help and thank you :)
Figure 1: Import tag body with attributes, when I edit code, the attribute is missing

Answers (3)
Hi @agungaja , can you please point the documentation of exportWrapper: true, for some reason i cant find it , i think it may solve me the problem but curious to read its wiki ! Thanks
yes it is true, I also can not find it. I was only given info by @artf in issue #1132. Or maybe I have a less exploratory documentation 😄.
The point is, why when the content set uses
var initcontent = $('#import_html').val();
editor.setComponents(initcontent);
the body attribute background-color: #f3f3f3;" disappears
@agungaja there is no importWrapper option and you can't import tag <body>. GrapesJS expect the user to pass the CONTENT... not the WRAPPER (which in most cases is body), the wrapper should be defined by its configuration;
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1132
[Question] How do I get <body> tag and its attributes
I have set the background-color for body. But when it will be edit code or export data using command editor.runCommand ('gjs-get-inlined-ht...
Issue #842
How we can set array using editor.getSelected().set('attributes',array value)
Hi @artf, How we can set array values using editor.getSelected().set('attributes',array value); If we try to do so with the same code then...
Issue #493
[QUESTION] Can i set content dynamically from block API ?
Hi @artf , very great web builder framework and keep it up :+1: code : As you can see, can i make tag dynamically from my backend? i use EJ...
Issue #740
How to remove class from html
Hi @artf, We are updating the <i> tag class but it adds new class to this but previous class is not remove.please let us know how to remove...
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.