popup-menu-sort
https://gyazo.com/ea8f39e516928b4d523ece9b0665298e
dependencies
Ascending order
code:script.js
scrapbox.PopupMenu.addButton({
title: '\uf15d',
onClick: (text) => {
const re = /^(\s*)/
const b = re.exec(text)1.length const lines = text.split(/\n/)
let sorting = [],
chLines = []
for (var i = 0; i < lines.length; i++) {
if (0 < chLines.length) chLines.unshift('')
sorting.push(line + chLines.join('@n@'))
chLines = []
}
return sorting
.sort(function (a, b) {
var A = a.toUpperCase()
var B = b.toUpperCase()
if (A < B) {
return -1
}
if (A > B) {
return 1
}
return 0
})
.join('\n')
.replace(/@n@/g, '\n')
},
})