Component recognition
Hi Jeremy, might this https://github.com/artf/grapesjs/wiki/Components#hints be the case?
Read full answer below ↓Question
Hi. Hi,
I created an "img-link" component that as its name indicates is a link that contains an image.
When I insert my component into the editor everything works perfectly. But when I want to edit my template afterwards. It no longer recognizes my component as an "img-link" but as a simple image, and therefore no longer has the behaviors I defined for it (custom traits).
I tried to use a specific isComponent function :
isComponent: function ( el ) {
if ( el.classList && el.classList.contains( 'img-link' ) ) {
return { type: 'img-link' };
}
}
But it doesn't work.
Any idea ?
Answers (3)
Hi Jeremy, might this https://github.com/artf/grapesjs/wiki/Components#hints be the case?
Thank with a plugin it's works !
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 #665
Custom component and save
Sorry, me again ! I'm trying to save my template with my new component "img-link" : But when I save my template using the gjs-get-inlined-h...
Issue #1906
Components & Js - Load Template
Hey, I have a component which has a JS attached to it. Everything is created using the JS. When I drag and drop my block for the first time...
Issue #1493
[QUESTION] render() works on the first time but not on subsequent calls
Hello, I've created a custom component that shows images using background-image on a <div> instead of using an <img> element. It's mostly w...
Issue #460
When the component's view modifies the HTML, text components are no longer editable
I'm trying to build a custom component that contains some lorem ipsum text in the content, for editing once it's on the canvas. But I also...
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.