Issue #1536Opened October 23, 2018by dlorenzo0 reactions

[Question] Propagate different value

Question

Hi:

I'm trying to prevent children elements from being selected so only the top parent can be selected (so as to prevent removing children and only being able to work with whole blocks). I created a component that defines the parent with a selectable false and propagate: ['selectable']. This works ok but, of course, the parent can't be selected.

Any way I can add selectable: true to the parent and propagate a false value?

And, in a similar vein, is it possible to override propagation down the line? In the same experiment, I tried setting 'selectable: true' in a child component with no effect.

Thanks!

Answers (2)

artfOctober 30, 20180 reactions

Any way I can add selectable: true to the parent and propagate a false value?

I'd say that the only way is to create a wrapper in the middle:

<parent> <-- selectable
	<div data-gjs-selectable="false" propagate..> <-- not selectable
		<child>
		...

And, in a similar vein, is it possible to override propagation down the line?

No, you can't stop the propagation only via props

If you need, you all the stuff, about the propagation, happens here: https://github.com/artf/grapesjs/blob/dev/src/dom_components/model/Component.js#L125-L135

imanubhardwajMay 24, 20190 reactions

I'm also facing this issue, where I have created a custom components with image wrapped inside a <a> tag, when I click on the component, image tag click is triggered rather than <a> tag click. Is there any solution to this?

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...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.