atk4 / ui

Robust and easy to use PHP Framework for Web Apps
https://atk4-ui.readthedocs.io
MIT License
439 stars 104 forks source link

Draggable inclusion is hardcoded - make it part of $app->cdn #2169

Closed bedengler closed 4 months ago

bedengler commented 4 months ago

When adding a drag handler via $grid->addDraghandler(); \Atk4\Ui\JsSortable is loaded.

In this file we can find the line $this->getApp()->requireJs('https://cdn.jsdelivr.net/npm/@shopify/draggable@1.0.0-beta.5/lib/draggable.bundle.js'); hardcoded.

I am often programming in the plane, so I'm offline. Therefore I use the variable $app->cdn to load all assets offline in this case. Works pretty well so far. But there's no chance of loading draggable.js without (heavy) tweaking.

The problem is, that if I go offline and reload the page, it throws a JS error (in console) and messes up the app. The only "solution" / workaround for now is to remove the draghandler from the grid when going offline. Therefore the functionality can't be tested offline.

Steps to reproduce:

Therefore I suggest making draggable part of $app->cdn.

Thoughts?

mvorisek commented 4 months ago

done in https://github.com/atk4/ui/pull/1874#discussion_r985152987 / https://github.com/atk4/ui/pull/1874/commits/3e786a095d5d9425c047aa5730784395d392cdae already, released since v4.0

bedengler commented 4 months ago

You are awesome @mvorisek - I must look at newer versions before posting, sorry for the inconvenience...