cicy-desktop 2.1.93 → 2.1.94

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cicy-desktop",
3
- "version": "2.1.93",
3
+ "version": "2.1.94",
4
4
  "description": "CiCy - AI-powered operating system browser",
5
5
  "main": "src/main.js",
6
6
  "bin": {
@@ -133,11 +133,11 @@
133
133
  "//optionalDependencies": "Runtime Bundle v1 (主人指令): platform binaries delivered by `npm i -g cicy-desktop` itself — npm installs only the current-platform subpackage (os/cpu pinned in each), so first start seeds the runtime store with ZERO network, ZERO npx. Windows packages are named *-windows-* (npm spam filter 403s new names containing win32). cicy-msys2 added once published.",
134
134
  "optionalDependencies": {
135
135
  "electron": "41.0.3",
136
- "cicy-code-darwin-x64": "2.3.12",
137
- "cicy-code-darwin-arm64": "2.3.12",
138
- "cicy-code-linux-x64": "2.3.12",
139
- "cicy-code-linux-arm64": "2.3.12",
140
- "cicy-code-windows-x64": "2.3.12",
136
+ "cicy-code-darwin-x64": "2.3.13",
137
+ "cicy-code-darwin-arm64": "2.3.13",
138
+ "cicy-code-linux-x64": "2.3.13",
139
+ "cicy-code-linux-arm64": "2.3.13",
140
+ "cicy-code-windows-x64": "2.3.13",
141
141
  "cicy-mihomo-darwin-x64": "1.10.4",
142
142
  "cicy-mihomo-darwin-arm64": "1.10.4",
143
143
  "cicy-mihomo-linux-x64": "1.10.4",
package/src/main.js CHANGED
@@ -20,7 +20,25 @@ const appUpdater = require("./app-updater");
20
20
  // and guests fell back to the OS-native menu; this unifies them and adds 重新加载
21
21
  // + 切换开发者工具 + 检查元素 everywhere (see utils/context-menu-options.js).
22
22
  const { attachContextMenu } = require("./utils/context-menu-options");
23
- electronApp.on("web-contents-created", (_e, wc) => attachContextMenu(wc));
23
+ electronApp.on("web-contents-created", (_e, wc) => {
24
+ attachContextMenu(wc);
25
+ // Ctrl/Cmd+C inside a <webview> guest: on Windows the application menu's
26
+ // role:"copy" accelerator doesn't reach the focused guest, so a selection
27
+ // couldn't be copied with the keyboard (right-click 复制 is fixed separately via
28
+ // attachContextMenu). Wire copy directly on the guest. COPY-ONLY and WITHOUT
29
+ // preventDefault, so the gotty terminal's Ctrl+C=SIGINT and any web app's own
30
+ // copy handler still fire; wc.copy() is a no-op when there's no selection.
31
+ try {
32
+ if (wc.getType && wc.getType() === "webview") {
33
+ wc.on("before-input-event", (_ev, input) => {
34
+ if (input.type === "keyDown" && (input.control || input.meta) &&
35
+ !input.alt && !input.shift && (input.key === "c" || input.key === "C")) {
36
+ try { wc.copy(); } catch (_) {}
37
+ }
38
+ });
39
+ }
40
+ } catch (_) {}
41
+ });
24
42
 
25
43
  // Setup Electron flags IMMEDIATELY after require
26
44
  electronApp.commandLine.appendSwitch("ignore-certificate-errors");
@@ -58,17 +58,19 @@ const OPTIONS = {
58
58
  },
59
59
  };
60
60
 
61
- // Attach the menu to the host window + BrowserView tabs only. <webview> guests
62
- // are EXCLUDED on purpose: they carry their OWN custom context menu (e.g.
63
- // cicy-code's WebFrame / the gotty terminal), and an ecm native menu would cover
64
- // it. Idempotent via __cicyCtxMenu so the web-contents-created hook + the
65
- // tab-browser's per-tab call never double-pop.
61
+ // Attach the menu to the host window, BrowserView tabs AND <webview> guests, so
62
+ // right-click 复制/粘贴 works on EVERY surface. Webviews used to be excluded on
63
+ // the assumption they carry their own copy menu, but on Windows that left
64
+ // selections uncopyable: the app menu's Ctrl+C / role:"copy" doesn't reach the
65
+ // focused <webview> guest, and no own-menu filled the gap. Giving guests the ecm
66
+ // 复制/粘贴 menu fixes copy cross-platform. Idempotent via __cicyCtxMenu so the
67
+ // web-contents-created hook + the tab-browser's per-tab call never double-pop.
66
68
  function attachContextMenu(wc) {
67
69
  try {
68
70
  if (!wc || (wc.isDestroyed && wc.isDestroyed())) return;
69
71
  if (wc.__cicyCtxMenu) return;
70
72
  const t = wc.getType && wc.getType();
71
- if (t !== "window" && t !== "browserView") return; // skip <webview> + others
73
+ if (t !== "window" && t !== "browserView" && t !== "webview") return; // host + tabs + <webview>
72
74
  wc.__cicyCtxMenu = true;
73
75
  contextMenu({ ...OPTIONS, window: wc });
74
76
  } catch (e) {}