Skip to content

v0.1.4 — No more double insert, i18n complete

Choose a tag to compare

@atbeta atbeta released this 25 Jul 03:01
b5faa8d

Fixes

1. Double-insert (paste/drop created 2 images)

Root cause: evt.preventDefault() was called inside a .then() callback. By then the event had already finished propagating and Obsidian's default handler had already inserted ![[attachment.png]]. Our async upload then finished and inserted ![](url) next to it — you got two images per paste.

Fix: handleEditorImage() now decides synchronously inside the capture-phase listener and calls preventDefault() + stopPropagation() immediately when it commits to handling the image. The upload stays async — that's fine, what matters is that the event is swallowed before it reaches Obsidian's own listener.

Side effect for ask mode: when the user picks Save locally, Obsidian no longer creates the attachment for us (we already swallowed the event). So we emulate it: app.fileManager.getAvailablePathForAttachment + app.vault.createBinary + insert ![[name]]. Upload / Cancel paths unchanged.

2. Settings i18n gaps

  • Upload-behavior dropdown options were hard-coded English ("Off (Obsidian default)" / "Ask each time (recommended)" / "Always upload"). Now sourced from the i18n module.
  • API token placeholder "optional" was hard-coded English. Now sourced.
  • 4 new i18n keys (settingUploadBehaviorOption{Off,Ask,On} + settingApiTokenPlaceholder) added to both en and zh-CN.

Install

Same path: download the 3 files from this release and overwrite the v0.1.3 files in .obsidian/plugins/picfast-image-uploader/. Settings.json is forward-compatible (no schema changes).