From 0388d3eb6c7e05228359ee06fab4c71b6d029bfa Mon Sep 17 00:00:00 2001 From: LenAnderson Date: Fri, 6 Sep 2024 10:07:50 -0400 Subject: [PATCH 1/3] make alternative class names searchable in FontAwesome icon picker --- public/scripts/utils.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/public/scripts/utils.js b/public/scripts/utils.js index fc83b4a50..8fb591c95 100644 --- a/public/scripts/utils.js +++ b/public/scripts/utils.js @@ -2039,7 +2039,10 @@ export async function fetchFaFile(name) { document.head.append(style); const sheet = style.sheet; style.remove(); - return [...sheet.cssRules].filter(it => it.style?.content).map(it => it.selectorText.split('::').shift().slice(1)); + return [...sheet.cssRules] + .filter(rule => rule.style?.content) + .map(rule => rule.selectorText.split(/,\s*/).map(selector=>selector.split('::').shift().slice(1))) + ; } export async function fetchFa() { return [...new Set((await Promise.all([ @@ -2065,7 +2068,7 @@ export async function showFontAwesomePicker(customList = null) { qry.placeholder = 'Filter icons'; qry.autofocus = true; const qryDebounced = debounce(() => { - const result = faList.filter(it => it.includes(qry.value)); + const result = faList.filter(fa => fa.find(className=>className.includes(qry.value))); for (const fa of faList) { if (!result.includes(fa)) { fas[fa].classList.add('hidden'); @@ -2086,10 +2089,10 @@ export async function showFontAwesomePicker(customList = null) { fas[fa] = opt; opt.classList.add('menu_button'); opt.classList.add('fa-solid'); - opt.classList.add(fa); - opt.title = fa.slice(3); + opt.classList.add(fa[0]); + opt.title = fa.map(it=>it.slice(3)).join(', '); opt.dataset.result = POPUP_RESULT.AFFIRMATIVE.toString(); - opt.addEventListener('click', () => value = fa); + opt.addEventListener('click', () => value = fa[0]); grid.append(opt); } } From bcd8a28367cbc0b4a3be8a9a6da6e47bf789913d Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 6 Sep 2024 14:22:36 +0000 Subject: [PATCH 2/3] Case-insensitive icon search --- public/scripts/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/scripts/utils.js b/public/scripts/utils.js index 8fb591c95..7e4deed0f 100644 --- a/public/scripts/utils.js +++ b/public/scripts/utils.js @@ -2068,7 +2068,7 @@ export async function showFontAwesomePicker(customList = null) { qry.placeholder = 'Filter icons'; qry.autofocus = true; const qryDebounced = debounce(() => { - const result = faList.filter(fa => fa.find(className=>className.includes(qry.value))); + const result = faList.filter(fa => fa.find(className=>className.includes(qry.value.toLowerCase()))); for (const fa of faList) { if (!result.includes(fa)) { fas[fa].classList.add('hidden'); From a5bf15ccdc166d2cb59370ca0bd158555b9b3ee3 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Fri, 6 Sep 2024 14:27:08 +0000 Subject: [PATCH 3/3] Wider 'No icons found' text --- public/style.css | 1 + 1 file changed, 1 insertion(+) diff --git a/public/style.css b/public/style.css index 189bc39cd..68a62dfbb 100644 --- a/public/style.css +++ b/public/style.css @@ -5453,6 +5453,7 @@ body:not(.movingUI) .drawer-content.maximized { content: 'No icons found'; color: var(--SmartThemeBodyColor); opacity: 0.7; + width: max-content; } #AdvancedFormatting .autoSetHeight {