Issue #1868πŸ’¬ AnsweredOpened March 7, 2019by sakshigarg91 reactions

How to enable functionality only for specific image component, not all

Quick answerby arthuralmeidap❀ 1

You are on the right path. Yes, you have to create a new component for that but you can't override the Image component type otherwise, as you have seen, all the images will get that. What makes those images unique? How could you differentiate between a regular image and a specific image? That logic you will need to ad...

Read full answer below ↓

Question

I've enabled the fa fa-pencil icon into my image components, but I want it to be enabled only in specific image components, not all of them. How can I achieve that? This is my code

Answers (3)

arthuralmeidapβ€’ March 7, 2019

You are on the right path. Yes, you have to create a new component for that but you can't override the Image component type otherwise, as you have seen, all the images will get that. What makes those images unique? How could you differentiate between a regular image and a specific image? That logic...

sakshigarg9β€’ March 12, 2019

I tried this and removed gjs-data-type="image" from the img tag where i want the functionality to be applied. But, neither does it implement the functionality on it and but also messes with the rest of component properties.

artfβ€’ March 22, 2019

@sakshigarg9 to prevent messes use the new addType (in your case you miss the view property and this breaks stuff in the old declaration) BTW I suggest to create a NEW component type by extending the image instead of just extending the current one (in this way you're editing all images)

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins β†’
Premium option

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.

All tutorials β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.