Editor opens in native windows (one per file)
Real BrowserWindow per edited file with its own RPC instance, deduped by sessionId+path. The same Angular bundle boots an editor-only root via preload globals. Native close isn't cancellable in electrobun, so the editor mirrors its draft to bun; traffic-light closes get a native Save/Discard prompt after the fact, and failed saves park the draft in the edit-leftovers dir. In-window closes (Cmd+W, Close) use a styled prompt; the quit guard now also counts unsaved editors. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -134,6 +134,21 @@ export class EditManager {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Park unsaveable editor content (window closed, session dead) in the
|
||||
* leftovers dir so the next-boot prompt offers it back to the user.
|
||||
*/
|
||||
async rescueDraft(name: string, content: string): Promise<void> {
|
||||
const dir = path.join(this.editsDir, crypto.randomUUID().slice(0, 8));
|
||||
await fs.mkdir(dir, { recursive: true });
|
||||
await fs.writeFile(
|
||||
path.join(dir, "meta.json"),
|
||||
JSON.stringify({ name, rescuedAt: new Date().toISOString() }),
|
||||
);
|
||||
await fs.writeFile(path.join(dir, name), content, "utf8");
|
||||
console.log(`[edit] rescued unsaved draft of ${name} -> ${dir}`);
|
||||
}
|
||||
|
||||
/** Session gone (disconnect, tab close, death): stop its watchers, drop temps. */
|
||||
stopForSession(sessionId: string): void {
|
||||
const [mine, rest] = [
|
||||
|
||||
Reference in New Issue
Block a user