Propagate different value
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: 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 propaga...
Read full answer below ↓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)
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
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.
Issue #3137
When I select an particular element I'm not getting its styles. This issue happens only with some elements.
Not getting styles of the selected element Here is my code, const model = editor.StyleManager.getModelToStyle(component); let styleObject =...
Issue #3457
Custom trait input not working
Hi @artf ! Version: 0.17.3 Are you able to reproduce the bug from the demo?[ ] Yes[x] No What is the expected behavior? The input is create...
Issue #3389
MultiSelect some elements and change styles only work on the last selected element
Hi, when I MultiSelect some elements using shift, and change style in styleManager. Only the last clicked element will update the style. Ca...
Issue #3731
Text element not able to be selected twice after extended with events
Version: 0.17.25 Are you able to reproduce the bug from the demo?[ ] Yes[x] No What is the expected behavior? Update a existing component o...
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 →Browse Plugin Categories
Jump directly to plugin category pages on the marketplace.