mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2024-12-19 20:12:52 +02:00
Allow searching for pasted icon
[why] There are cases that I find myself into sometimes when I have the glyph with me but not its name or codepoint. It would be nice to be able to search for the codepoint and/or name of a glyph by literally putting it into the search box of the cheat-sheet. There are several reasons to know the name of the glyph, to use it in a webpage, to look for alternatives when they get removed, etc. [how] Convert high codepoint-chars to codepoint text. Fixes: #1307 Authored-by: ad-chaos Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
parent
748ded8f52
commit
df6ab2c942
@ -125,14 +125,17 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
}
|
||||
|
||||
function searchGlyphs() {
|
||||
let searchTerm = elementGlyphSearch.value;
|
||||
// Convert high codepoint-chars to codepoint text - enabling search for pasted icon
|
||||
let searchTerm = [...elementGlyphSearch.value]
|
||||
.map((char) => char.codePointAt(0) > 255 ? char.codePointAt(0).toString(16) : char)
|
||||
.join("");
|
||||
|
||||
let prefixSearchEnabled = true;
|
||||
let emptyResultsMessage = `<span style="font-size: 30px;">No matches found</span>`;
|
||||
|
||||
if (searchTerm === "") {
|
||||
// MiniSearch doesn't allow empty searches and we want to show the bottom info
|
||||
emptyResultsMessage = "Enter (part) of a word to search for or enter space / blank (' ') to show all icons"
|
||||
emptyResultsMessage = "Enter (part) of a word to search for or paste the icon or enter space / blank (' ') to show all icons"
|
||||
} else {
|
||||
if (searchTerm === " ") {
|
||||
prefixSearchEnabled = false;
|
||||
|
Loading…
Reference in New Issue
Block a user