feat: search kbd shortcut + fix logo upload

pull/6775/head
NGPixel 1 year ago
parent bb4a1e6b15
commit b8a44d99ae
No known key found for this signature in database
GPG Key ID: B755FB6870B30F63

@ -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',
mimeType: (destFormat === 'svg') ? 'image/svg' : 'image/png',
fileSize: Math.ceil(imgBuffer.byteLength / 1024),
data: imgBuffer,
authorId: context.req.user.id,

@ -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
@click='searchField.focus()'
)
q-btn.q-ml-md(
flat
round
dense
icon='las la-tags'
color='grey'
to='/_tags'
)
//- 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">

Loading…
Cancel
Save