Files
genoffice/packages/electron-utils/package.json
T
konghaojie-k2andClaude 607c77086f 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>
2026-08-27 18:14:28 +08:00

25 lines
551 B
JSON

{
"name": "@genoffice/electron-utils",
"version": "0.1.0",
"license": "Apache-2.0",
"private": true,
"type": "module",
"description": "Shared helpers for the Electron main processes (no Electron dependency, pure TS)",
"exports": {
".": "./src/index.ts",
"./drop-open": "./src/drop-open.ts"
},
"scripts": {
"typecheck": "tsc --noEmit",
"test": "vitest run",
"test:watch": "vitest"
},
"devDependencies": {
"typescript": "^5.9.3",
"vitest": "^4.1.0"
},
"dependencies": {
"parse5": "^8.0.1"
}
}