add sorting in stlMesh files

This commit is contained in:
Simon Vieille 2021-10-20 14:39:40 +02:00
parent c6d9727966
commit f7975f704d
3 changed files with 30 additions and 5 deletions

View File

@ -1,3 +1,28 @@
import './admin/admin.js';
require('./admin_modules/simplemde')();
const $ = require('jquery')
const Sortable = require('sortablejs').Sortable
const gallerySorting = () => {
$('div[data-collection^="collection-stlfiles"]').each((i, list) => {
const element = $(list)
return new Sortable(list, {
handle: '*[data-collection-item]',
sort: true,
animation: 150,
fallbackTolerance: 3,
onEnd: (e) => {
const positions = element.find('*[data-collection-item] input[type=hidden]')
positions.each((order, v) => {
$(v).val(order)
})
}
})
})
}
gallerySorting()

View File

@ -41,7 +41,7 @@
"prismjs": "^1.23.0",
"qrcodejs": "^1.0.0",
"simplemde": "^1.11.2",
"sortablejs": "^1.13.0",
"sortablejs": "^1.14.0",
"tinymce": "^5.7.1",
"vanillajs-datepicker": "^1.1.4",
"vue": "^2.6.14",

View File

@ -6132,10 +6132,10 @@ sockjs@0.3.21:
uuid "^3.4.0"
websocket-driver "^0.7.4"
sortablejs@^1.13.0:
version "1.13.0"
resolved "https://registry.yarnpkg.com/sortablejs/-/sortablejs-1.13.0.tgz#3ab2473f8c69ca63569e80b1cd1b5669b51269e9"
integrity sha512-RBJirPY0spWCrU5yCmWM1eFs/XgX2J5c6b275/YyxFRgnzPhKl/TDeU2hNR8Dt7ITq66NRPM4UlOt+e5O4CFHg==
sortablejs@^1.14.0:
version "1.14.0"
resolved "https://registry.yarnpkg.com/sortablejs/-/sortablejs-1.14.0.tgz#6d2e17ccbdb25f464734df621d4f35d4ab35b3d8"
integrity sha512-pBXvQCs5/33fdN1/39pPL0NZF20LeRbLQ5jtnheIPN9JQAaufGjKdWduZn4U7wCtVuzKhmRkI0DFYHYRbB2H1w==
source-list-map@^2.0.0, source-list-map@^2.0.1:
version "2.0.1"