feat: support opening file in its containing folder (#900)

This commit is contained in:
ayangweb
2025-09-26 14:14:59 +08:00
committed by GitHub
parent 29442826c5
commit 01c51d83d6
6 changed files with 70 additions and 18 deletions

View File

@@ -10,6 +10,7 @@ Information about release notes of Coco App is provided here.
## Latest (In development) ## Latest (In development)
### ❌ Breaking changes ### ❌ Breaking changes
- chore: update request accesstoken api #866 - chore: update request accesstoken api #866
### 🚀 Features ### 🚀 Features
@@ -26,7 +27,7 @@ Information about release notes of Coco App is provided here.
- feat: file search for Linux/KDE #886 - feat: file search for Linux/KDE #886
- feat: extension Window Management for macOS #892 - feat: extension Window Management for macOS #892
- feat: new extension type View #894 - feat: new extension type View #894
- feat: support opening file in its containing folder #900
### 🐛 Bug fix ### 🐛 Bug fix

View File

@@ -26,7 +26,7 @@
"@tauri-apps/plugin-global-shortcut": "~2.0.0", "@tauri-apps/plugin-global-shortcut": "~2.0.0",
"@tauri-apps/plugin-http": "~2.0.2", "@tauri-apps/plugin-http": "~2.0.2",
"@tauri-apps/plugin-log": "~2.4.0", "@tauri-apps/plugin-log": "~2.4.0",
"@tauri-apps/plugin-opener": "^2.2.7", "@tauri-apps/plugin-opener": "^2.5.0",
"@tauri-apps/plugin-os": "^2.2.1", "@tauri-apps/plugin-os": "^2.2.1",
"@tauri-apps/plugin-process": "^2.2.1", "@tauri-apps/plugin-process": "^2.2.1",
"@tauri-apps/plugin-shell": "^2.2.1", "@tauri-apps/plugin-shell": "^2.2.1",

63
pnpm-lock.yaml generated
View File

@@ -33,8 +33,8 @@ importers:
specifier: ~2.4.0 specifier: ~2.4.0
version: 2.4.0 version: 2.4.0
'@tauri-apps/plugin-opener': '@tauri-apps/plugin-opener':
specifier: ^2.2.7 specifier: ^2.5.0
version: 2.2.7 version: 2.5.0
'@tauri-apps/plugin-os': '@tauri-apps/plugin-os':
specifier: ^2.2.1 specifier: ^2.2.1
version: 2.2.1 version: 2.2.1
@@ -790,6 +790,9 @@ packages:
resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==}
engines: {node: '>=12'} engines: {node: '>=12'}
'@jridgewell/gen-mapping@0.3.13':
resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==}
'@jridgewell/gen-mapping@0.3.8': '@jridgewell/gen-mapping@0.3.8':
resolution: {integrity: sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==} resolution: {integrity: sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==}
engines: {node: '>=6.0.0'} engines: {node: '>=6.0.0'}
@@ -802,15 +805,21 @@ packages:
resolution: {integrity: sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==} resolution: {integrity: sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==}
engines: {node: '>=6.0.0'} engines: {node: '>=6.0.0'}
'@jridgewell/source-map@0.3.6': '@jridgewell/source-map@0.3.11':
resolution: {integrity: sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==} resolution: {integrity: sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==}
'@jridgewell/sourcemap-codec@1.5.0': '@jridgewell/sourcemap-codec@1.5.0':
resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==} resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==}
'@jridgewell/sourcemap-codec@1.5.5':
resolution: {integrity: sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==}
'@jridgewell/trace-mapping@0.3.25': '@jridgewell/trace-mapping@0.3.25':
resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==}
'@jridgewell/trace-mapping@0.3.31':
resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==}
'@mermaid-js/parser@0.4.0': '@mermaid-js/parser@0.4.0':
resolution: {integrity: sha512-wla8XOWvQAwuqy+gxiZqY+c7FokraOTHRWMsbB4AgRx9Sy7zKslNyejy7E+a77qHfey5GXw/ik3IXv/NHMJgaA==} resolution: {integrity: sha512-wla8XOWvQAwuqy+gxiZqY+c7FokraOTHRWMsbB4AgRx9Sy7zKslNyejy7E+a77qHfey5GXw/ik3IXv/NHMJgaA==}
@@ -1153,6 +1162,9 @@ packages:
'@tauri-apps/api@2.5.0': '@tauri-apps/api@2.5.0':
resolution: {integrity: sha512-Ldux4ip+HGAcPUmuLT8EIkk6yafl5vK0P0c0byzAKzxJh7vxelVtdPONjfgTm96PbN24yjZNESY8CKo8qniluA==} resolution: {integrity: sha512-Ldux4ip+HGAcPUmuLT8EIkk6yafl5vK0P0c0byzAKzxJh7vxelVtdPONjfgTm96PbN24yjZNESY8CKo8qniluA==}
'@tauri-apps/api@2.8.0':
resolution: {integrity: sha512-ga7zdhbS2GXOMTIZRT0mYjKJtR9fivsXzsyq5U3vjDL0s6DTMwYRm0UHNjzTY5dh4+LSC68Sm/7WEiimbQNYlw==}
'@tauri-apps/cli-darwin-arm64@2.5.0': '@tauri-apps/cli-darwin-arm64@2.5.0':
resolution: {integrity: sha512-VuVAeTFq86dfpoBDNYAdtQVLbP0+2EKCHIIhkaxjeoPARR0sLpFHz2zs0PcFU76e+KAaxtEtAJAXGNUc8E1PzQ==} resolution: {integrity: sha512-VuVAeTFq86dfpoBDNYAdtQVLbP0+2EKCHIIhkaxjeoPARR0sLpFHz2zs0PcFU76e+KAaxtEtAJAXGNUc8E1PzQ==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
@@ -1242,8 +1254,8 @@ packages:
'@tauri-apps/plugin-log@2.4.0': '@tauri-apps/plugin-log@2.4.0':
resolution: {integrity: sha512-j7yrDtLNmayCBOO2esl3aZv9jSXy2an8MDLry3Ys9ZXerwUg35n1Y2uD8HoCR+8Ng/EUgx215+qOUfJasjYrHw==} resolution: {integrity: sha512-j7yrDtLNmayCBOO2esl3aZv9jSXy2an8MDLry3Ys9ZXerwUg35n1Y2uD8HoCR+8Ng/EUgx215+qOUfJasjYrHw==}
'@tauri-apps/plugin-opener@2.2.7': '@tauri-apps/plugin-opener@2.5.0':
resolution: {integrity: sha512-uduEyvOdjpPOEeDRrhwlCspG/f9EQalHumWBtLBnp3fRp++fKGLqDOyUhSIn7PzX45b/rKep//ZQSAQoIxobLA==} resolution: {integrity: sha512-B0LShOYae4CZjN8leiNDbnfjSrTwoZakqKaWpfoH6nXiJwt6Rgj6RnVIffG3DoJiKsffRhMkjmBV9VeilSb4TA==}
'@tauri-apps/plugin-os@2.2.1': '@tauri-apps/plugin-os@2.2.1':
resolution: {integrity: sha512-cNYpNri2CCc6BaNeB6G/mOtLvg8dFyFQyCUdf2y0K8PIAKGEWdEcu8DECkydU2B+oj4OJihDPD2de5K6cbVl9A==} resolution: {integrity: sha512-cNYpNri2CCc6BaNeB6G/mOtLvg8dFyFQyCUdf2y0K8PIAKGEWdEcu8DECkydU2B+oj4OJihDPD2de5K6cbVl9A==}
@@ -1464,6 +1476,11 @@ packages:
engines: {node: '>=0.4.0'} engines: {node: '>=0.4.0'}
hasBin: true hasBin: true
acorn@8.15.0:
resolution: {integrity: sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==}
engines: {node: '>=0.4.0'}
hasBin: true
agent-base@7.1.3: agent-base@7.1.3:
resolution: {integrity: sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==} resolution: {integrity: sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==}
engines: {node: '>= 14'} engines: {node: '>= 14'}
@@ -4230,6 +4247,12 @@ snapshots:
wrap-ansi: 8.1.0 wrap-ansi: 8.1.0
wrap-ansi-cjs: wrap-ansi@7.0.0 wrap-ansi-cjs: wrap-ansi@7.0.0
'@jridgewell/gen-mapping@0.3.13':
dependencies:
'@jridgewell/sourcemap-codec': 1.5.5
'@jridgewell/trace-mapping': 0.3.31
optional: true
'@jridgewell/gen-mapping@0.3.8': '@jridgewell/gen-mapping@0.3.8':
dependencies: dependencies:
'@jridgewell/set-array': 1.2.1 '@jridgewell/set-array': 1.2.1
@@ -4240,19 +4263,28 @@ snapshots:
'@jridgewell/set-array@1.2.1': {} '@jridgewell/set-array@1.2.1': {}
'@jridgewell/source-map@0.3.6': '@jridgewell/source-map@0.3.11':
dependencies: dependencies:
'@jridgewell/gen-mapping': 0.3.8 '@jridgewell/gen-mapping': 0.3.13
'@jridgewell/trace-mapping': 0.3.25 '@jridgewell/trace-mapping': 0.3.31
optional: true optional: true
'@jridgewell/sourcemap-codec@1.5.0': {} '@jridgewell/sourcemap-codec@1.5.0': {}
'@jridgewell/sourcemap-codec@1.5.5':
optional: true
'@jridgewell/trace-mapping@0.3.25': '@jridgewell/trace-mapping@0.3.25':
dependencies: dependencies:
'@jridgewell/resolve-uri': 3.1.2 '@jridgewell/resolve-uri': 3.1.2
'@jridgewell/sourcemap-codec': 1.5.0 '@jridgewell/sourcemap-codec': 1.5.0
'@jridgewell/trace-mapping@0.3.31':
dependencies:
'@jridgewell/resolve-uri': 3.1.2
'@jridgewell/sourcemap-codec': 1.5.5
optional: true
'@mermaid-js/parser@0.4.0': '@mermaid-js/parser@0.4.0':
dependencies: dependencies:
langium: 3.3.1 langium: 3.3.1
@@ -4546,6 +4578,8 @@ snapshots:
'@tauri-apps/api@2.5.0': {} '@tauri-apps/api@2.5.0': {}
'@tauri-apps/api@2.8.0': {}
'@tauri-apps/cli-darwin-arm64@2.5.0': '@tauri-apps/cli-darwin-arm64@2.5.0':
optional: true optional: true
@@ -4617,9 +4651,9 @@ snapshots:
dependencies: dependencies:
'@tauri-apps/api': 2.5.0 '@tauri-apps/api': 2.5.0
'@tauri-apps/plugin-opener@2.2.7': '@tauri-apps/plugin-opener@2.5.0':
dependencies: dependencies:
'@tauri-apps/api': 2.5.0 '@tauri-apps/api': 2.8.0
'@tauri-apps/plugin-os@2.2.1': '@tauri-apps/plugin-os@2.2.1':
dependencies: dependencies:
@@ -4876,6 +4910,9 @@ snapshots:
acorn@8.14.1: {} acorn@8.14.1: {}
acorn@8.15.0:
optional: true
agent-base@7.1.3: {} agent-base@7.1.3: {}
ahooks@3.8.4(react@18.3.1): ahooks@3.8.4(react@18.3.1):
@@ -7232,8 +7269,8 @@ snapshots:
terser@5.40.0: terser@5.40.0:
dependencies: dependencies:
'@jridgewell/source-map': 0.3.6 '@jridgewell/source-map': 0.3.11
acorn: 8.14.1 acorn: 8.15.0
commander: 2.20.3 commander: 2.20.3
source-map-support: 0.5.21 source-map-support: 0.5.21
optional: true optional: true

View File

@@ -111,7 +111,7 @@ const ContextMenu = ({ formatUrl }: ContextMenuProps) => {
return []; return [];
} }
const { id, url, category, type, payload } = selectedSearchContent; const { id, url, category, type, payload, source } = selectedSearchContent;
const { query, result } = payload ?? {}; const { query, result } = payload ?? {};
if (category === "AI Overview") { if (category === "AI Overview") {
@@ -177,6 +177,18 @@ const ContextMenu = ({ formatUrl }: ContextMenuProps) => {
copyToClipboard(`${query.value} = ${result.value}`); copyToClipboard(`${query.value} = ${result.value}`);
}, },
}, },
{
name: t("search.contextMenu.openFileLocation"),
icon: <SquareArrowOutUpRight />,
keys: isMac ? ["⌘", "↩︎"] : ["Ctrl", "Enter"],
shortcut: isMac ? "meta.enter" : "ctrl.enter",
hide: source?.id !== "File Search",
clickEvent: async () => {
await platformAdapter.revealItemInDir(url);
platformAdapter.hideWindow();
},
},
]; ];
}, [selectedSearchContent, selectedExtension]); }, [selectedSearchContent, selectedExtension]);

View File

@@ -379,7 +379,8 @@
"details": "Details", "details": "Details",
"install": "Install", "install": "Install",
"uninstall": "Uninstall", "uninstall": "Uninstall",
"configureExtension": "Configure Extension" "configureExtension": "Configure Extension",
"openFileLocation": "Open File Location"
}, },
"askCocoAi": { "askCocoAi": {
"title": "{{0}} {{1}}", "title": "{{0}} {{1}}",

View File

@@ -379,7 +379,8 @@
"details": "详情", "details": "详情",
"install": "安装", "install": "安装",
"uninstall": "卸载", "uninstall": "卸载",
"configureExtension": "配置扩展" "configureExtension": "配置扩展",
"openFileLocation": "打开所在文件夹"
}, },
"askCocoAi": { "askCocoAi": {
"title": "{{0}}{{1}}", "title": "{{0}}{{1}}",