Removes the deferred `"off"` override and rewrites the 55 violations
(all in test/mocks/Node-script files) to use `window.*` instead of
`global.*`. Production code was already cleaned up in #2401.
- 18 test files + __mocks__/obsidian.js + jest.setup.js: mechanical
`global.X` → `window.X` (Jest runs under jsdom, so window === globalThis)
- scripts/printPromptDebugEntry.ts: inline eslint-disable — Node-only
debug script with no window available
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(popout): document ownership and selection listener fixes (W4/9)
Fifth of nine workspaces splitting #2397. Real popout-window
correctness fixes — semantic choices about which window owns a DOM
operation, plus selection-listener captured-document fixes.
- document → activeDocument where a generic active-window lookup is
correct (SourcesModal, ChatViewLayout, ItemView/Notice mocks,
TabContext, ChatInput keydown listener, CopilotView keyboard
observer, TypeaheadMenuPortal, AddImageModal, and ?? document
fallbacks across draggable-modal, menu-command-modal,
CustomCommandChatModal, use-draggable, use-resizable, and
QuickAskOverlay).
- document → root.ownerDocument in ChatSingleMessage's
linkInlineCitations so DOM nodes end up in the citation's window;
same pattern in the processMessage streaming block via
contentRef.current.ownerDocument.
- New getEditorDocument(editor) helper in BasePillNode. createDOM and
exportDOM now accept the LexicalEditor; pills create DOM in the
editor's window (correct popout behavior). All 6 pill subclasses
updated to match the new signature.
- main.ts: selectionListenerDocument captured at listener registration;
remove uses the same document (fixes leak when activeDocument has
drifted before unload).
- chatSelectionHighlightController.ts: getActiveViewOfType(MarkdownView)
replaces the brittle activeLeaf type comparison.
- Test setup: (window as any).activeDocument = window.document in
ChatSingleMessage.test; window.document.createElement in
AgentPrompt.test Notice mock.
Behavior fix: chat in a popout window now creates DOM nodes in the
popout's document, not the focused window's document.
W0, W1, and #2402 already merged.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* fix(popout): prefer element.doc/.win over ownerDocument and activeDocument
Switch popout-window-sensitive call sites to Obsidian's `.doc` / `.win`
augmentations so DOM ops, listeners, portals, and positioning follow the
element's actual owner window. Recreate Lexical root on view migration to
rebind input handling after a leaf moves between windows. Document the
decision order in AGENTS.md and polyfill `Node.doc` / `Node.win` in
jest.setup.js so tests still run under jsdom.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* improve image upload implementation
---------
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>