Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
b8a44d99
Unverified
Commit
b8a44d99
authored
Jun 12, 2023
by
NGPixel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: search kbd shortcut + fix logo upload
parent
bb4a1e6b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
18 deletions
+41
-18
site.mjs
server/graph/resolvers/site.mjs
+4
-6
HeaderNav.vue
ux/src/components/HeaderNav.vue
+37
-12
No files found.
server/graph/resolvers/site.mjs
View file @
b8a44d99
...
...
@@ -184,8 +184,7 @@ export default {
const
imgBuffer
=
await
fs
.
readFile
(
destPath
)
await
WIKI
.
db
.
knex
(
'assets'
).
insert
({
id
:
site
.
config
.
assets
.
logo
,
filename
:
`_logo.
${
destFormat
}
`
,
hash
:
'_logo'
,
fileName
:
`_logo.
${
destFormat
}
`
,
fileExt
:
`.
${
destFormat
}
`
,
isSystem
:
true
,
kind
:
'image'
,
...
...
@@ -245,12 +244,11 @@ export default {
const
imgBuffer
=
await
fs
.
readFile
(
destPath
)
await
WIKI
.
db
.
knex
(
'assets'
).
insert
({
id
:
site
.
config
.
assets
.
favicon
,
filename
:
`_favicon.
${
destFormat
}
`
,
hash
:
'_favicon'
,
ext
:
`.
${
destFormat
}
`
,
fileName
:
`_favicon.
${
destFormat
}
`
,
fileExt
:
`.
${
destFormat
}
`
,
isSystem
:
true
,
kind
:
'image'
,
mime
:
(
destFormat
===
'svg'
)
?
'image/svg'
:
'image/png'
,
mime
Type
:
(
destFormat
===
'svg'
)
?
'image/svg'
:
'image/png'
,
fileSize
:
Math
.
ceil
(
imgBuffer
.
byteLength
/
1024
),
data
:
imgBuffer
,
authorId
:
context
.
req
.
user
.
id
,
...
...
ux/src/components/HeaderNav.vue
View file @
b8a44d99
...
...
@@ -49,18 +49,19 @@ q-header.bg-header.text-white.site-header(
:color='$q.dark.isActive ? `blue` : `grey-4`'
)
q-badge.q-ml-sm(
label='
v3 Preview
'
color='
pink
'
label='
Ctrl+K
'
color='
grey-7
'
outline
)
q-btn.q-ml-md(
flat
round
dense
icon='las la-tags'
color='grey'
to='/_tags'
)
@click='searchField.focus()'
)
//- q-btn.q-ml-md(
//- flat
//- round
//- dense
//- icon='las la-tags'
//- color='grey'
//- to='/_tags'
//- )
q-toolbar(
style='height: 64px;'
dark
...
...
@@ -128,7 +129,7 @@ import NewMenu from './PageNewMenu.vue'
import
{
useI18n
}
from
'vue-i18n'
import
{
useQuasar
}
from
'quasar'
import
{
reactive
}
from
'vue'
import
{
onBeforeUnmount
,
onMounted
,
reactive
,
ref
}
from
'vue'
import
{
useCommonStore
}
from
'src/stores/common'
import
{
useSiteStore
}
from
'src/stores/site'
...
...
@@ -154,11 +155,35 @@ const state = reactive({
search
:
''
})
const
searchField
=
ref
(
null
)
// METHODS
function
openFileManager
()
{
siteStore
.
openFileManager
()
}
function
handleKeyPress
(
ev
)
{
if
(
siteStore
.
features
.
search
)
{
if
(
ev
.
ctrlKey
&&
ev
.
key
===
'k'
)
{
ev
.
preventDefault
()
searchField
.
value
.
focus
()
}
}
}
// MOUNTED
onMounted
(()
=>
{
if
(
process
.
env
.
CLIENT
)
{
window
.
addEventListener
(
'keydown'
,
handleKeyPress
)
}
})
onBeforeUnmount
(()
=>
{
if
(
process
.
env
.
CLIENT
)
{
window
.
removeEventListener
(
'keydown'
,
handleKeyPress
)
}
})
</
script
>
<
style
lang=
"scss"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment