make alternative class names searchable in FontAwesome icon picker
| @@ -2039,7 +2039,10 @@ export async function fetchFaFile(name) { | ||
| 2039 | 2039 | document.head.append(style); |
| 2040 | 2040 | const sheet = style.sheet; |
| 2041 | 2041 | style.remove(); |
| 2042 | - return [...sheet.cssRules].filter(it => it.style?.content).map(it => it.selectorText.split('::').shift().slice(1)); | |
| 2042 | + return [...sheet.cssRules] | |
| 2043 | + .filter(rule => rule.style?.content) | |
| 2044 | + .map(rule => rule.selectorText.split(/,\s*/).map(selector=>selector.split('::').shift().slice(1))) | |
| 2045 | + ; | |
| 2043 | 2046 | } |
| 2044 | 2047 | export async function fetchFa() { |
| 2045 | 2048 | return [...new Set((await Promise.all([ |
| @@ -2065,7 +2068,7 @@ export async function showFontAwesomePicker(customList = null) { | ||
| 2065 | 2068 | qry.placeholder = 'Filter icons'; |
| 2066 | 2069 | qry.autofocus = true; |
| 2067 | 2070 | const qryDebounced = debounce(() => { |
| 2068 | 2071 | const result = faList.filter(itfa => itfa.find(className=>className.includes(qry.value))); |
| 2069 | 2072 | for (const fa of faList) { |
| 2070 | 2073 | if (!result.includes(fa)) { |
| 2071 | 2074 | fas[fa].classList.add('hidden'); |
| @@ -2086,10 +2089,10 @@ export async function showFontAwesomePicker(customList = null) { | ||
| 2086 | 2089 | fas[fa] = opt; |
| 2087 | 2090 | opt.classList.add('menu_button'); |
| 2088 | 2091 | opt.classList.add('fa-solid'); |
| 2089 | 2092 | opt.classList.add(fa[0]); |
| 2090 | 2093 | opt.title = fa.map(it=>it.slice(3)).join(', '); |
| 2091 | 2094 | opt.dataset.result = POPUP_RESULT.AFFIRMATIVE.toString(); |
| 2092 | 2095 | opt.addEventListener('click', () => value = fa[0]); |
| 2093 | 2096 | grid.append(opt); |
| 2094 | 2097 | } |
| 2095 | 2098 | } |