Adding html once canvas is cleared.
editor.setComponents(<section>...</section>) Use the API Reference
Read full answer below βQuestion
Hey Artur I'd like to add some default html code when users click clear button.
for instance 1 section by default.
for clear command, i'm doing const comps = this.editor.DomComponents.clear();
what should i do after this..?
Thank you
Answers (2)
editor.setComponents(<section>...</section>)
Use the API Reference
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1540
[Question] Is it possible to add event for preview?
I'd like to convert some texts when a user clicks the preview button. for instance, ((name)) (in the editor) should be 'David' (in preview...
Issue #1522
[Question] is it possible to add some text to content body where the cursor is ?
I'd like to have a button that is outside the editor and if i click this button, some text should be generated in the body where my cursor...
Issue #1831
[Question] How to run command for a block component?
I'd like to do something like this. so once a user drops the test component into the canvas, I'd like to open up asset manager modal where...
Issue #1230
[Question]: Doctype in the canvas iframe
Hey @artf, I noticed the canvas iframe doesn't appear to have any doctype set on it, which causes it to be in quirks mode. Is this intentio...
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins βPremium plugins ship with support, regular updates, and production-ready features β save days of integration work.
Browse premium plugins βRelated tutorials
In-depth guides on the same topic.
Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.