whitecube / nova-flexible-content

Flexible Content & Repeater Fields for Laravel Nova
MIT License
787 stars 234 forks source link

Added global emits for move-up, move-down and remove #337

Closed cooljet84 closed 2 years ago

cooljet84 commented 2 years ago

Added global emits for move-up, move-down and remove events.

voidgraphics commented 2 years ago

Hi @cooljet84, what is the purpose of these events? I am not familiar.

cooljet84 commented 2 years ago

@voidgraphics In my case i needed the events to update an live preview when moving / removing blocks (displayed as an custom tool)

voidgraphics commented 2 years ago

I'm a bit torn on this. It does not add much complexity, but at the same time, I think these events will never really be useful outside of your project. They are too vague (the event does not allow any way of knowing which layout was removed, or moved up/down), so they're essentially just a very unspecific trigger to re-render your live preview custom tool.

I would either make them very specific to increase their usefulness, with information about which layout was updated specifically, or make them all the same very generic "nova-flexible-content-updated" kind of thing.

As they are now, I'd rather not merge them because they will definitely confuse future me when going through the code. Feel free to implement one of my suggestions and open a new PR if you really need this functionality.