Merge branch 'v1.1.4'

This commit is contained in:
ZiuChen 2022-08-20 11:51:43 +08:00
commit 1113a7717e
7 changed files with 43 additions and 4 deletions

View File

@ -1,5 +1,5 @@
{ {
"version": "1.1.3", "version": "1.1.4",
"pluginName": "超级剪贴板", "pluginName": "超级剪贴板",
"description": "强大的剪贴板管理工具", "description": "强大的剪贴板管理工具",
"author": "ZiuChen", "author": "ZiuChen",

View File

@ -197,6 +197,7 @@ utools.onPluginEnter(() => {
utools.copyText('ImageOverSized') utools.copyText('ImageOverSized')
globalOverSize = false globalOverSize = false
} }
document.querySelector('.clip-search input').select() // 进入插件将搜索框内容全选
focus() focus()
toTop() toTop()
resetNav() resetNav()

View File

@ -16,6 +16,7 @@
<script setup> <script setup>
import FileList from './FileList.vue' import FileList from './FileList.vue'
import { onMounted } from 'vue'
const props = defineProps({ const props = defineProps({
isShow: { isShow: {
@ -30,6 +31,17 @@ const props = defineProps({
const emit = defineEmits(['onOverlayClick']) const emit = defineEmits(['onOverlayClick'])
const onOverlayClick = () => emit('onOverlayClick') const onOverlayClick = () => emit('onOverlayClick')
onMounted(() => {
document.addEventListener('keydown', (e) => {
const { key } = e
if (key === 'Escape' && props.fullData.data) {
// 退 Overlay
emit('onOverlayClick')
e.stopPropagation()
}
})
})
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

View File

@ -1,6 +1,7 @@
<template> <template>
<div class="clip-search"> <div class="clip-search">
<input v-model="filterText" type="text" placeholder="🔍 检索剪贴板历史" /> <input v-model="filterText" type="text" placeholder="🔍 检索剪贴板历史" />
<span v-show="filterText" @click="clear" class="clip-search-suffix"></span>
</div> </div>
</template> </template>
@ -16,11 +17,14 @@ const filterText = ref('')
const emit = defineEmits(['update:modelValue']) const emit = defineEmits(['update:modelValue'])
// filterText modelValue // filterText modelValue
watch(filterText, (val) => emit('update:modelValue', val)) watch(filterText, (val) => emit('update:modelValue', val))
// modelValue filterText // modelValue filterText
watch( watch(
() => props.modelValue, () => props.modelValue,
(val) => (filterText.value = val) (val) => (filterText.value = val)
) )
const clear = () => emit('update:modelValue', '')
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>

View File

@ -18,4 +18,20 @@
color: @text-color-lighter; color: @text-color-lighter;
} }
} }
.clip-search-suffix {
text-align: center;
position: absolute;
right: 20px;
top: 18px;
font-size: 13px;
padding: 2px;
width: 20px;
height: 20px;
background-color: @nav-bg-color;
border-radius: 20px;
cursor: pointer;
&:hover {
background-color: @nav-hover-bg-color;
}
}
} }

View File

@ -1,4 +1,5 @@
.import() { .import() {
/* 导入全部涉及到变量的样式文件 */
@import (multiple) './cpns/clip-full-data.less'; @import (multiple) './cpns/clip-full-data.less';
@import (multiple) './cpns/clip-item-list.less'; @import (multiple) './cpns/clip-item-list.less';
@import (multiple) './cpns/clip-search.less'; @import (multiple) './cpns/clip-search.less';

View File

@ -123,7 +123,7 @@ onMounted(() => {
// //
document.addEventListener('keydown', (e) => { document.addEventListener('keydown', (e) => {
const { key, ctrlKey } = e const { key, ctrlKey, metaKey } = e
const isTab = key === 'Tab' const isTab = key === 'Tab'
const isSearch = const isSearch =
key === '/' || key === '/' ||
@ -139,8 +139,13 @@ onMounted(() => {
} else if (isSearch) { } else if (isSearch) {
window.focus() window.focus()
} else if (isExit) { } else if (isExit) {
filterText.value = '' if (filterText.value) {
} else if (ctrlKey) { filterText.value = ''
e.stopPropagation()
}
} else if (ctrlKey || metaKey) {
// Ctrl
// utools
} else { } else {
window.focus() // window.focus() //
} }