Replace html issue
You should change the model of the component, not its view
Read full answer below ↓Question
I defined new forum block like this. I want to replace resource class with ajax response html. Currently I did it like this. The problem is Hover is not working after this replacing. The data contains several div tags. I want to make hover action working correctly for the forum_directory class.
Answers (3)
You should change the model of the component, not its view
if (model) {
const resourceModel = model.find('.resource')[0];
resourceModel.components(data);
}
Thanks. It's working fine. But I want to add attribute something like data-gjs-selectable: false, data-gjs-editable:false to this resourceModel
You can resourceModel.set({ selectable: false, editable: false })
Related Questions and Answers
Continue research with similar issue discussions.
Issue #1817
Change HTML content while block is render in editor
Hello @artf I have one block into block manager like As per above script inside the block, i want to add dynamic HTML content while this bl...
Issue #1584
Not getting the Script of Block from editor.getComponents()
Below is the Component that I'm adding. this.editor.BlockManager.add('dob-mmyy-pii', { id: 'dob-mmyy', label: DOB (MM, YYYY) (PII), categor...
Issue #1471
[Question] Blockmanager and Image
Hi! I use this code to add a new block: blockManager.add("image", { label: 'Image', category: 'Basic', attributes: { class: "gjs-fonts gjs-...
Issue #1034
insert element or block inside parent element
Good day, i have component, have block i have Trait on listen changes, how can I add "h1 " inside that block "'<div class="container" style...
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.