-
Hello there, I would like to get the HTML content of the grapes JS editor with the grapes JS attributes of the components. When I load the editor, I add grapes' data attributes to the components e.g: editor.setComponents( When I get the HTML content to save by calling editor.getHtml(), I would like to get the components with their attributes. E.g: Calling editor.getHtml() should return Or when I get the HTML element of a component/model, it should also contain the grapes data attributes. E.g: let model = editor.getWrapper().find("#header_one") And if the model has any children, the data-gjs-* attributes of the children should also be in their respective HTML elements. Thank you in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
|
Beta Was this translation helpful? Give feedback.
-
You can probably use: // to get everything in the editor
editor.getWrapper().getEl().innerHTML
// to get specific component
component.getEl().outerHTML Although I'm not sure why you would load from html when you can load the JSON format? 🤔 |
Beta Was this translation helpful? Give feedback.
component.toHTML
allows you to passattributes
option as a function in order to add dynamically custom attributes (in this way you're able to attach model properties).