madeyourday / contao-rocksolid-custom-elements

RockSolid Custom Elements Contao Extension
http://rocksolidthemes.com/de/contao/plugins/custom-content-elements
MIT License
48 stars 12 forks source link

Unable to add new elements in list wizard in Contao 5.1 #160

Closed qzminski closed 1 year ago

qzminski commented 1 year ago

Hey Martin, the extension does not work properly in Contao 5.1. It is not possible to add new elements to the list wizard due to JS error being thrown here:

https://github.com/madeyourday/contao-rocksolid-custom-elements/blob/master/src/Resources/public/js/be_main.js#L228

CleanShot 2023-02-07 at 11 50 03

I am not sure what happens but the drag element is missing the rsce_list_toolbar_drag CSS class:

<img class="color-scheme--light" src="/system/themes/flexible/icons/drag.svg" width="16" height="16" alt="Move the item via drag and drop" loading="lazy" title="Move the item via drag and drop">

I wanted to create a pull request, but now I wonder whether we should just change the JS to match the selector:

-toolbar.getFirst('.rsce_list_toolbar_drag').setStyle('display', count < 2 ? 'none' : '');
+toolbar.getFirst('img[src$="drag.svg"]').setStyle('display', count < 2 ? 'none' : '');

… or shall we investigate what changed between Contao 4 and 5. Also, it seems that drag and drop no longer works at all (even with the fix above).

Please let me know if I should investigate it further myself, or if you already know what happened and how to fix it 🙂

ausi commented 1 year ago

So, only Contao 5.1.0-RC2 is affected and Contao 5.0 works fine, right?

qzminski commented 1 year ago

I did not test it on Contao 5.0 to be honest, the only Contao 5 setup I have right now is 5.1.0-RC2.

ausi commented 1 year ago

Should be fixed with b14c7142a016185f7da1298335170fc864e74c2c @qzminski please verify.

qzminski commented 1 year ago

Ah the markup has changed. It works like a charm now, thanks a lot Martin!