mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2024-12-19 20:12:52 +02:00
cheat-sheet: Allow click to copy on hex value
[why] We removed the functionality with the previous commit and replaced it with 'copy the UTF16 code' (needed for codepoints > u_FFFF). But people might want to have the possibility to easily (by click) copy the codepoint hex number. [how] Add highlighting on the hex number and allow clicking to copy the value. [note] The tooltip will be added in the cheat-sheet generator. Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
parent
bae34d36a1
commit
6e361d40ca
@ -150,6 +150,11 @@ a.nerd-font-button:before {
|
||||
border-color: #0fbfcf;
|
||||
}
|
||||
|
||||
#main .nerd-font-cheat-sheet .column .codepoint:hover {
|
||||
background: #767260;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
#main .nerd-font-cheat-sheet .column:hover .class-name {
|
||||
color: #0fbfcf;
|
||||
}
|
||||
|
6
site.js
6
site.js
@ -318,8 +318,6 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
if (parent.className === 'glyph-popout-copy-clipboard') {
|
||||
if (target.className === 'copy-class') {
|
||||
textToCopy = parent.parentNode.querySelector('.class-name').innerText;
|
||||
} else if (target.className === 'copy-hex') {
|
||||
textToCopy = parent.parentNode.querySelector('.codepoint').innerText;
|
||||
} else if (target.className === 'copy-glyph') {
|
||||
textToCopy = window
|
||||
.getComputedStyle(document.querySelector(`.${parent.parentNode.querySelector('.class-name').innerText}`), ':before')
|
||||
@ -340,6 +338,10 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
textToCopy += glyph.charCodeAt(i++).toString(16);
|
||||
}
|
||||
}
|
||||
} else if (parent.className.startsWith('column') && target.className === 'codepoint') {
|
||||
textToCopy = parent.parentNode.querySelector('.codepoint').innerText;
|
||||
}
|
||||
if (textToCopy.length > 0) {
|
||||
gtag('event', event.target.className, {
|
||||
event_category: 'clipboard-copy',
|
||||
event_label: 'Copy To Clipboard : ' + textToCopy,
|
||||
|
Loading…
Reference in New Issue
Block a user