mirror of
https://github.com/moyf/easy-copy.git
synced 2026-07-22 05:43:47 +00:00
Previously the paste handler only fired when linkFormat was "Follow Obsidian settings". Users on explicit Wiki or Markdown got no paste-time cleanup — pasting a heading into the same file produced the verbose [[Filename#Heading|Heading]] instead of [[#Heading]]. Drop the OBSIDIAN-only gate in shouldRegisterPasteHandler and decidePasteResolution. handlePaste branches by linkFormat: OBSIDIAN keeps using app.fileManager.generateMarkdownLink (full newLinkFormat support); explicit Wiki/Markdown uses app.metadataCache.fileToLinktext (shortest-unique paths only). The same-file alias-redundancy fix from the previous commit applies to both branches. Add buildExplicitPasteLink in linkBuilder.ts as a pure string-producer for the explicit-format branch — caller decides omitAlias via shouldOmitAliasForSameFile, formatter consumes the boolean. Toggle now shown for all three linkFormat options; description updated to reflect format-aware behavior across en/zh/zh-tw. Tests: new buildExplicitPasteLink suite covering wiki/md, same-file vs cross-file, block links, and encoding behavior. pasteResolution tests updated for the broadened gate (linkFormat field removed from PasteResolutionInput; OBSIDIAN-only assertions dropped). Trade-off: explicit Wiki/Markdown get shortest-path-only resolution; users wanting relative/absolute path styles keep using "Follow Obsidian settings" (which honors the vault's newLinkFormat config). Designed, carefully reviewed, and edited by @lightmotive in collaboration with Claude Code. |
||
|---|---|---|
| .. | ||
| blockIdModal.ts | ||
| copyMetadata.test.ts | ||
| copyMetadata.ts | ||
| i18n.ts | ||
| linkBuilder.test.ts | ||
| linkBuilder.ts | ||
| main.ts | ||
| pasteResolution.test.ts | ||
| pasteResolution.ts | ||
| settingTab.ts | ||
| type.ts | ||