Hi Paweł,
As far as i know, there is no built in way to change the sorting.
I'd go with prefixing categories, as you've already have described.
You could also go with a javascript solution, something like this:
const list = document.querySelector('#attachments > * ul'); // this will get unordered list of attachments
// this function is responsible for sorting - you could tweak it, data-drop contains attachment category in format id#name.
let compare = (a, b) => {
let aAttr = a.getAttribute('data-drop');
let bAttr = b.getAttribute('data-drop');
if (aAttr < bAttr) return -1;
return 1;
}
// Here we change list childrens (so attachments) to array, sort it, and based on that reordering them in the ui using list.append.
[...list.children]
.sort(compare)
.forEach(node => list.appendChild(node));