collective / volto-hydra

A volto addon to let you edit content in realtime when you have many frontends written in any framework
2 stars 4 forks source link

I can Use DnD (inline) to move a block around in a page (line for droppoint and no shadow like tiles?) #65

Closed djay closed 3 months ago

djay commented 3 months ago

Similar to mosaic

Image

https://www.youtube.com/watch?v=e6IAAGtdtcc

djay commented 3 months ago

@MAX-786 not sure if this is helpful but this is the code that implimented the DND in mosaic as shown in the video. https://github.com/plone/plone.app.mosaic/blob/b6a9540189f105637ec551a96e741e850393cffa/resources/js/mosaic.layout.js#L1018

It is more complex than what you need since mosaic didn't use containers but had side-by-side layout built in. That means they had to handle dropping on all sides of a block where you only have to handle above and below another block.

There are also likely simple libraries you can use that make this easier than following that code. but just in case it's useful.