MCPcopy Create free account
hub / github.com/UNLINEARITY/Obsidian-CodeSpace / installPopupWindowHook

Function installPopupWindowHook

src/native_pdf_export_patch.ts:360–382  ·  view source on GitHub ↗
(session: NativeExportSession, plugin: CodeSpacePlugin)

Source from the content-addressed store, hash-verified

358}
359
360function installPopupWindowHook(session: NativeExportSession, plugin: CodeSpacePlugin) {
361 const win = session.ownerWindow;
362 const originalOpen = win.open.bind(win);
363
364 win.open = ((...args: Parameters<typeof window.open>) => {
365 debugNativePdf(session, "window.open intercepted", {
366 url: args[0] ?? "",
367 target: args[1] ?? "",
368 features: args[2] ?? "",
369 });
370 const popupWindow = originalOpen(...args);
371 if (activeNativeExportSession === session && popupWindow) {
372 session.popupOpened = true;
373 debugNativePdf(session, "popup window opened successfully");
374 installPopupPrintObserver(session, plugin, popupWindow);
375 }
376 return popupWindow;
377 }) as typeof window.open;
378
379 session.restoreWindowOpen = () => {
380 win.open = originalOpen as typeof window.open;
381 };
382}
383
384function beginNativeExportSession(
385 plugin: CodeSpacePlugin,

Callers 1

beginNativeExportSessionFunction · 0.85

Calls 2

debugNativePdfFunction · 0.85

Tested by

no test coverage detected