What am I missing ?
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.
Read full answer below ↓Question
What am I missing to make the tag "div" named as "Div" by default ? (Override the default)
const domc = this.editor.DomComponents;
const defaultType = domc.getType('default');
const defaultModel = defaultType.model;
const defaultView = defaultType.view;
domc.addType('default', {
model: defaultModel.extend({
defaults: Object.assign({}, defaultModel.prototype.defaults, {
// True if the component is removable from the canvas
removable: true,
// Indicates if it's possible to drag the component inside other
// Tip: Indicate an array of selectors where it could be dropped inside
draggable: true,
// Indicates if it's possible to drop other components inside
// Tip: Indicate an array of selectors which could be dropped inside
droppable: true,
// Set false if don't want to see the badge (with the name) over the component
badgable: true,
// True if it's possible to style it
// Tip: Indicate an array of CSS properties which is possible to style
stylable: true,
// Highlightable with 'dotted' style if true
highlightable: true,
// True if it's possible to clone the component
copyable: true,
// Indicates if it's possible to resize the component (at the moment implemented only on Image Components)
resizable: false,
// Allow to edit the content of the component (used on Text components)
editable: false,
}),
},
{
isComponent: function (el) {
if (el.tagName == 'div') {
return {type: 'Div'};
}
},
}),
view: defaultView,
});
Answers (1)
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 #1155
Custom component used as HTML in block
I've extended the default image component Then I've got a block where I'm going to use the extended image. The following works fine. Howeve...
Issue #818
[QUESTION] Open different Panel's view on click text element
How can I make "click" event on texts open different panel's view than StyleManager? I'm trying this:
Issue #1947
Updating data-gjs properties on label and form type results in weird behaviour
I'm applying the following settings to label data-gjs-type and on doing that some of the label tag are not visible anymore. Similar things...
Issue #1722
[QUESTION] how to make my custom tag as selectable and editable inside of canvas ?
Hi, I try to change my custom tag of ion-item has div in view properties but It doesn't work for me as I expected. my custom Blocks is my c...
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.