Proper HEAD support by having non-graphical components #6120
SamMousa
started this conversation in
Roadmap Suggestions
Replies: 1 comment 2 replies
-
I think I got the idea but I'm not sure about the addition you're suggesting. I mean, technically if you want to render the head and its elements + selecting and updating them, I'd expect it already to be possible. You should extend the view of those components and make them "displayable" (browsers hide them by default). |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I read in some issues (from 2018) that GrapesJS by default ignores anything outside body. The argument was that it is a page editor not a metadata editor.
Currently there is some code that gives partial support for full documents or other workarounds:
asDocument
import does some saving of thehead
content.head
to thebody
so it works properly.Currently components exist in the wild that model non-visible contents. Like a component for google tag manager (not a fan, just using it as an example).
Proposal
Use this as a base for discussion, it has holes and is not even 90% thought through.
What about just iterating over elements in the
<head>
just like elements in the body.Instead of rendering the components to the page canvas we just create an extra canvas (like a
metadata
tab in the editor).This is where these components could then render their UI, again via the normal API.
The main canvas would then render the head components' HTML.
This would enable interesting usages like using an image picker to pick a favicon. Or using a
LinkTagBlock
to include a stylesheet.From a framework perspective not a lot of changes are required as far as I can tell; the component API needs little to no changes.
In "userland" one could even implement this, simply but ugly:
Beta Was this translation helpful? Give feedback.
All reactions