Releases: lmce72/obsidian-close-reflect
Release list
1.2.0 — interactive content in the prompt
What's new
The prompt's body is live. It is rendered Markdown, so it can hold wikilinks, external
links, embeds, Meta Bind controls, task checkboxes — anything the renderer produces. Two
things were missing and are now fixed.
Embeds are clickable. Obsidian renders an embed as an element carrying its src
linktext and only handles navigation for regular links, so clicking an embedded note's body
did nothing at all. The whole embed now navigates to its target.
Using any of it keeps you in Obsidian. Clicking content that does something now cancels
the quit and steps the prompt aside, instead of leaving you with the quit held and the
prompt still covering the screen. You are going somewhere, not leaving.
The detection is structural rather than a list of plugin-specific classes — a link, a
button, a form control, a data-href, an embed. A wikilink, an external link, a Meta Bind
control and a task checkbox all qualify without this plugin knowing anything about them.
Notes
- Where the content does its own work (a link), the click is left untouched so Obsidian
still handles it; where it does nothing on its own (an embed), the plugin opens the
target itself. - Because the whole embed is clickable, a click that follows selecting text inside an embed
will also navigate. That is the cost of making the entire block clickable. - The settings modal's preview gets the same embed behaviour, but its buttons stay inert —
they would otherwise drive the quit.
No settings changes.
1.1.2 — try every require, not just window.require
Fixed
A cannot load @codemirror/view / cannot load @codemirror/state error could still appear,
and the edit modal fall back to a plain textarea.
@codemirror/* was resolved through window.require alone. That is not always the right
one — it may be Electron's own require, or a patched one that does not carry the CodeMirror
modules — and giving up after the first failure meant a module that was perfectly reachable
through the plugin's own require (which goes through Obsidian's module table) never got
tried. Both are now attempted in turn.
Verified by stubbing window.require to reject every @codemirror/* request and leaving it
stubbed for the whole session: the modal still opens with a real editor and logs nothing.
No settings changes; this only affects the editor inside the edit modal.
1.1.1 — fix the CodeMirror load race
Fixed
The embedded Markdown editor could fail to start with a cannot load @codemirror/state
error, leaving the edit modal with a plain textarea until Obsidian was restarted.
@codemirror/* is resolved through window.require, which is patched in by another plugin.
Both the resolved modules and the require function itself were being captured once, when the
plugin loaded — so if that happened before the patch landed, the failure stuck for the rest
of the session. Both are now resolved on first use, so the editor comes up on the first open
and a failed attempt is simply retried.
No settings changes; this only affects the editor inside the edit modal.
1.1.0 — action buttons and the edit modal
What's new
Action buttons. The two fixed buttons become an editable list. Each button has a label
and an action: cancel the quit, let the app close, open a note, run a command, or open a
URL. Only "let the app close" closes the app — everything else cancels the quit and then
does its own thing. Add and remove buttons freely; if you remove every one, the overlay
falls back to a single "cancel the quit" button so it can never be left unanswerable.
A dedicated edit modal. Content editing has moved out of the settings page, which no
longer carries a textarea or a preview. The modal puts a real Obsidian Markdown editor on
the left — live preview, [[ completion — and a live preview of the overlay on the right,
with Save and Cancel at the bottom. Everything is edited on a draft, so Cancel really
discards.
In linked note mode the editor holds the note's body and Save writes it back, keeping
the note's frontmatter intact. It only writes when the body actually changed, and never
when the note could not be read.
What's fixed
Three separate obstacles were defeating the interception entirely, all established by
reading Obsidian 1.13.7's own bundle:
- Obsidian's quit hook erases itself on first run, so a session only ever got one
quitevent — the prompt appeared on the first close and never again. The hook is now
captured before its first run and reinstalled after a cancelled quit. - Obsidian force-destroys any window still alive three seconds after a close, and a
renderer'sbeforeunloadcancellation does not stop it — that check reads a flag only a
main-process listener can set. The plugin now marks the main window'scloseevent
through the@electron/remotehandle Obsidian's bootstrap leaves on the renderer. - Holding the quit stranded Obsidian's "Saving..." screen, because the only thing that
takes it down is the verywindow.close()the plugin swallows.
Upgrading
Existing settings migrate automatically — your labelStay and labelLeave labels become
the first two buttons, unchanged.
The plugin is desktop-only: the interception depends on Obsidian's Electron processes, and
there is no equivalent cancellable event on mobile.