Skip to content

v0.2.1 — Fix Ctrl+P TypeError + right-click menu + command prefix

Choose a tag to compare

@atbeta atbeta released this 25 Jul 03:43
33a0a78

Fixes

1. Ctrl+P TypeError (and silent right-click menu disappearance)

TypeError: Cannot read properties of undefined (reading 'trim')
  at P (plugin:picfast-image-uploader:13:2837)
  at Object.editorCheckCallback (plugin:picfast-image-uploader:14:6492)

Root cause: the shared matchAll helper assumed both regexes had m[1] and m[2] capture groups. The wikilink regex /![[path]]/g only has m[1], so every wikilink hit came back with path: undefined.

That caused two visible symptoms:

  • Ctrl+P TypeError: editorCheckCallback called isRemotePath(match.rawPath)undefined.trim() crashed. Obsidian builds the command palette list by calling every command's editorCheckCallback(checking=true) at startup, so the crash prevented the command from appearing.
  • Right-click menu missing: the editor-menu workspace handler also called isRemotePath on the same bad rawPath. When it threw, the menu flow aborted before menu.addItem was reached, so the item never appeared in the menu.

Fix: split into matchMarkdown() (uses m[1]=alt, m[2]=path) and matchWikilink() (uses m[1]=path, no alt). Also hardened isRemotePath to return false on undefined input.

2. Command names prefixed with PicFast:

  • PicFast: Upload image from clipboard
  • PicFast: Upload selected image file
  • PicFast: Upload image at cursor

(Chinese: PicFast: 从剪贴板上传图片 / PicFast: 上传选中的图片文件 / PicFast: 上传光标处的图片)

This makes them group together in the command palette and visually separates them from similar commands in other plugins.

Install

Same path: download the 3 files from this release and overwrite the v0.2.0 files in .obsidian/plugins/picfast-image-uploader/. Settings forward-compatible.