refs-cli-nilnon
Advanced tools
Comparing version 1.2.19 to 1.2.20
{ | ||
"name": "refs-cli-nilnon", | ||
"version": "1.2.19", | ||
"version": "1.2.20", | ||
"description": "Command line tool to generate Quick Reference website.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/nilnon/", |
@@ -45,2 +45,11 @@ import path from 'path'; | ||
const svgSearchNode = getSVGNode(ICONS_SEARCH_PATH); | ||
const githubEditButton = options.githubURL ? [ | ||
{ | ||
menu: true, | ||
href: options.githubURL, | ||
target: '__blank', | ||
label: options.config.editor?.label || 'Edit', | ||
children: [editor], | ||
} | ||
] : []; | ||
const data: (MenuData)[] = [ | ||
@@ -81,9 +90,3 @@ { | ||
...getReferrals(options), | ||
{ | ||
menu: true, | ||
href: options.githubURL, | ||
target: '__blank', | ||
label: options.config.editor?.label || 'Edit', | ||
children: [editor], | ||
}, | ||
...githubEditButton, | ||
...darkMode(options), | ||
@@ -90,0 +93,0 @@ ]; |
@@ -34,2 +34,3 @@ import fs from 'fs-extra'; | ||
label: string; | ||
disabled?: boolean; | ||
}, | ||
@@ -85,5 +86,5 @@ github?: { | ||
++num; | ||
const githubURL = `https://github.com/nilnon/index/blob/main/${path | ||
const githubURL = opts.config.github?.url && opts.config.editor?.disabled !== true ? `${opts.config.github.url || opts.config.github}/blob/main/${path | ||
.relative(process.cwd(), dataFile.path) | ||
.replace(path.sep, '/')}`; | ||
.replace(path.sep, '/')}` : ''; | ||
@@ -112,3 +113,3 @@ const mdstr = await fs.readFile(dataFile.path); | ||
data.path = path.relative(opts.output, outputHTMLPath).replace(/[\\/]/g, '/'); | ||
searchData[options.filename] = data; | ||
searchData[options.filename] = data; | ||
searchData.name = options.filename; | ||
@@ -115,0 +116,0 @@ await fs.writeJSON(SEARCH_DATA_CACHE, searchData); |
@@ -81,2 +81,5 @@ /** ==========anchor============== */ | ||
document.addEventListener('keydown', (ev) => { | ||
if (ev.key.toLocaleLowerCase() === 'escape') { | ||
hideSearch(); | ||
} | ||
if (ev.metaKey && ev.key.toLocaleLowerCase() === 'k') { | ||
@@ -83,0 +86,0 @@ searchBox.classList.contains('show') ? hideSearch() : showSearch(); |
1278729
5297