#Component inside slot permission drag is not working as expected

1 messages · Page 1 of 1 (latest)

lapis holly
#

Hi, I'd like to ask about locking drag inside slot.

I have text element inside container, even though I put drag false, it can still be dragged inside a slot,

Is this an issue in yours as well?
@median kiln @sharp elk

#

Forgot to mention, Puck 0.19.3

lapis holly
#

My use case:
I want to have a lock button in the action bar

When the user click on it, it will do this things

  1. Lock the drag of the current selected component. I just use drag false.
  2. If the current component have slots inside, it will also lock the drag on each of the component inside the slot. I use walkTree for this, and add lock true (hence drag false in the resolvePermission) for each element inside the slot
  3. No component should be able to be dragged inside the slot (I use allow "[]") for this.

I need this behavior so that user dont accidently drag item inside or drop item in the locked container.

But the problem is with the drag false inside the slot. I can still drag the item inside the slot,

sharp elk
#

Hey @lapis holly! Sorry for the delay.

#

I can replicate this, it only happens inside slots. I'll open an issue for it

#

This is a bug, it shouldn't be happening

lapis holly
sharp elk
lapis holly
#

Hey @sharp elk , I want to ask, If I were to set permission delete to false, the "native" puck delete action bar will be hidden right,,

But, what if I implement my own action bar,
is there a way to get the permission for the current selected component?

I see chris talk about filtering right here
https://github.com/puckeditor/puck/issues/1172
But, that's only for native puck action bar (duplicate & delete)

What if I have component like in my image, where I implement my own delete button, and my own duplicate btn inside popover,
I think having permission as props would be beneficial 🤔 Just to support puck native permission for my custom implementation?

This also applies in Field, if I have a custom field, I can't simply use "edit" permission true/false, because it only works for native component
Correct me if I'm wrong, or if there's a solution for this 😙

GitHub

Description There's currently no great way to filter or reorder the default actionBar items. I'd have to do something like this: const filteredChildren = React.Children.map(children, (child...