File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ window.__page.onPluginInit((data: {
4747 alwaysOnTop: boolean
4848 }
4949}) => {
50- console .log (' main.onPluginInit' , data )
50+ // console.log('main.onPluginInit', data)
5151 manager .setActivePlugin (data .plugin )
5252 manager .setSubInput ({
5353 placeholder: ' ' ,
Original file line number Diff line number Diff line change @@ -27,8 +27,11 @@ export const StringUtil = {
2727}
2828
2929export const TimeUtil = {
30+ timestamp ( ) {
31+ return Math . floor ( Date . now ( ) / 1000 )
32+ } ,
3033 timestampMS ( ) {
31- return new Date ( ) . getTime ( )
34+ return Date . now ( )
3235 } ,
3336 format ( time : number , format : string = 'YYYY-MM-DD HH:mm:ss' ) {
3437 return dayjs ( time ) . format ( format )
Original file line number Diff line number Diff line change 11import { useManagerStore } from "../../../store/modules/manager" ;
22import { ClipboardDataType , SelectedContent } from "../../../types/Manager" ;
3+ import { TimeUtil } from "../../../lib/util" ;
34
45const manager = useManagerStore ( )
56
@@ -18,6 +19,14 @@ export const EntryListener = {
1819
1920 // console.log('EntryListener.prepareSearch', option)
2021
22+ // 清除搜索框
23+ if ( manager . searchValue ) {
24+ // 如果10分钟未变化,清空搜索框
25+ if ( manager . searchValueUpdateTimestamp > 0 && manager . searchValueUpdateTimestamp < TimeUtil . timestamp ( ) - 10 * 60 ) {
26+ manager . searchValue = ''
27+ }
28+ }
29+
2130 let searchValue = manager . searchValue
2231
2332 // 选中,只有快捷面板才获取
@@ -29,7 +38,12 @@ export const EntryListener = {
2938 const clipboardContent : ClipboardDataType | null = await window . $mapi . manager . getClipboardContent ( )
3039 const clipboardChangeTime = await window . $mapi . manager . getClipboardChangeTime ( )
3140 // 最近6秒内的剪切板变更才会被视为有效
32- const useClipboard = clipboardChangeTime > Date . now ( ) / 1000 - 6
41+ let useClipboard = false
42+ if ( manager . searchValueUpdateTimestamp > 0 && ! manager . searchValue ) {
43+ if ( clipboardChangeTime > TimeUtil . timestamp ( ) - 6 ) {
44+ useClipboard = true
45+ }
46+ }
3347
3448 // 文件
3549 manager . setCurrentFiles ( [ ] )
Original file line number Diff line number Diff line change 99import debounce from "lodash/debounce" ;
1010import { WindowConfig } from "../../../electron/config/window" ;
1111import { computed , toRaw } from "vue" ;
12+ import { TimeUtil } from "../../lib/util" ;
1213
1314const searchFastPanelActionDebounce = debounce ( ( query , cb ) => {
1415 window . $mapi . manager . searchFastPanelAction ( query )
@@ -33,6 +34,7 @@ export const managerStore = defineStore("manager", {
3334 config : { } as ConfigRecord ,
3435 searchLoading : false ,
3536 searchLastKeywords : '' ,
37+ searchValueUpdateTimestamp : 0 ,
3638 searchValue : '' ,
3739 searchPlaceholder : 'FocusAny,让您的工作专注高效' ,
3840 searchSubPlaceholder : '' ,
@@ -141,6 +143,7 @@ export const managerStore = defineStore("manager", {
141143 }
142144 this . searchLoading = true
143145 this . searchValue = keywords
146+ this . searchValueUpdateTimestamp = TimeUtil . timestamp ( )
144147 this . viewActions = [ ]
145148 searchDebounce ( {
146149 keywords,
You can’t perform that action at this time.
0 commit comments