lossless-group_image-gin/versions.json
mpstaton b6e7d7f6ed feat(drop-gate): confirm modal for every dragged or pasted image — v0.2.0
Image Gin now intercepts every image dropped or pasted into a markdown
note and asks where it should go: vault attachments, ImageKit, or
Imgur. Built for writers who handle private client imagery and don't
want a default-on third-party uploader silently shipping screenshots
to a public CDN. Default is the vault. ImageKit is the recommended
destination for less-public information that still wants a CDN. Imgur
is there when something is genuinely shareable.

Off by default. Enable in Settings → Image Gin → "Drag-Drop / Paste
Confirmation Gate". Two policy modes:

- always-confirm — modal on every image drop or paste
- external-only — vault drops fall through silently; modal only
  appears when at least one external destination is enabled

Per-session "remember choice" checkbox in the modal skips the gate for
subsequent drops in the same note, resets on active-leaf-change, and
never persists across Obsidian restarts. A reset command is registered
under "Drop Gate: Reset session-remembered destination."

Three destinations behind a small DropGateDestination interface:

- VaultDestination — re-dispatches a synthetic event copy into
  Obsidian's internal view.currentMode.clipboardManager so the default
  attachment-handling code runs cleanly. Falls back to
  Vault.createBinary + FileManager.generateMarkdownLink if the
  internal surface ever disappears.
- ImageKitDestination — thin adapter over the existing
  ImageKitService.uploadFile pipeline image-gin already uses for
  "Convert Local Images to Remote." Honors a drop-gate-specific folder
  setting (settings.dropGate.imageKitFolder) that overrides the main
  upload folder when set, so ad-hoc dropped images can be routed
  somewhere different from generated images. Inherits the main folder
  when blank.
- ImgurDestination — anonymous client-ID upload to
  api.imgur.com/3/image. Hand-rolled multipart body because Obsidian's
  requestUrl doesn't accept FormData.

The modal is widened correctly (modalEl, not contentEl, per the
perplexed widening reminder), shows all three destinations every time
— configured ones selectable, un-configured ones greyed-out with a
hint pointing at the right setting — and captures cursor position
synchronously at drop-time, threading it through DropGateContext as
insertPos so editor.replaceRange lands the markdown link where the
user dropped, not wherever the cursor drifted while the modal was
open.

Conflict detection: if the third-party obsidian-imgur-plugin is also
enabled, both plugins handle every drop and the user gets two modals
back-to-back — preventDefault() blocks the browser default, not other
plugins. We surface a persistent Notice on plugin load telling the
user to disable the other one and configure Imgur from inside Image
Gin.

Bumps version to 0.2.0 (manifest.json, package.json, versions.json).

Plan + design rationale:
content-farm/context-v/plans/Image-Drop-Confirmation-Gate.md
Ship note:
plugin-modules/image-gin/changelog/2026-05-09_01.md
Interception pattern adapted from gavvvr/obsidian-imgur-plugin (MIT).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 02:03:00 -05:00

6 lines
83 B
JSON

{
"0.0.9": "1.8.10",
"0.1.0": "1.8.10",
"0.1.1": "1.8.10",
"0.2.0": "1.8.10"
}