feat(shell): open documents dropped onto the window (#161)

Dropping a local file from Explorer/Finder anywhere over the app previously
did nothing visible: the navigation guard blocks Chromium's default
navigate-to-file, so drops were silently swallowed.

Add a preload-side bridge (@genoffice/electron-utils/drop-open, installed by
every surface's preload) that resolves dropped files via webUtils and forwards
recognized documents to the shell over one IPC channel. The shell routes each
path through the normal File > Open pipeline, reveals its window when the drop
landed in a detached editor, and shows the existing "not supported" dialog for
known legacy formats. Page-level drop zones that cancel their events (AI
attachment panels, slides image insert) keep priority.

While files hover, Home shows a pointer-events-none drop overlay (tokens only,
i18n key in all 19 locales).

The bridge module gets its own package subpath export so sandboxed preloads
bundle only it — importing the barrel would pull node builtins into sandboxed
preloads (bundled) or leave a bare require (externalized), both fatal there.

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
konghaojie-k2
2026-08-27 18:14:28 +08:00
committed by GitHub
co-authored by Claude
parent 0a2c25d483
commit 607c77086f
22 changed files with 693 additions and 8 deletions
+2 -1
View File
@@ -6,7 +6,8 @@
"type": "module",
"description": "Shared helpers for the Electron main processes (no Electron dependency, pure TS)",
"exports": {
".": "./src/index.ts"
".": "./src/index.ts",
"./drop-open": "./src/drop-open.ts"
},
"scripts": {
"typecheck": "tsc --noEmit",