Make displaying of paths in Sort modal consistent with Transform modal

This commit is contained in:
jos 2019-06-22 16:27:12 +02:00
parent f83bb3e5cd
commit 8a95b5b640
1 changed files with 9 additions and 1 deletions

View File

@ -77,9 +77,17 @@ function showSortModal (container, json, onSort, options) {
var field = modal.modalElem().querySelector('#field'); var field = modal.modalElem().querySelector('#field');
var direction = modal.modalElem().querySelector('#direction'); var direction = modal.modalElem().querySelector('#direction');
function preprocessPath(path) {
return (path === '')
? '@'
: (path[0] === '.')
? path.slice(1)
: path;
}
paths.forEach(function (path) { paths.forEach(function (path) {
var option = document.createElement('option'); var option = document.createElement('option');
option.text = path || '.'; option.text = preprocessPath(path);
option.value = path; option.value = path;
field.appendChild(option); field.appendChild(option);
}); });