Proper way to update just rendered part of component #5519
Unanswered
aleksandar-kordic
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Using simply innerHTML will "skip" elements from the editor parsing/component creation, so you won't be able to "interact" with them as components. onRender({ model }) {
// ...
model.components('<div>New component</div>');
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I'm working on interesting problem, creating components that contain handlebars placeholders but are rendered for preview. Basically, when you add component it prefills with some default data but in the background MJML remains with placeholders and handlebars logic. So far, it works (example at the end) but issue is that using el.innerHTML to update content in onRender method kills Style Manager functionality for this component. Couldn't find any appropriate method to update content and keep full style functionality so decided to ask community for help, ty.
Example of component
`
grapesjs.plugins.add('test-components', (editor, opts = {}) => {
const blockManager = editor.BlockManager
const domc = editor.DomComponents
Beta Was this translation helpful? Give feedback.
All reactions