Releases: lishuai1993/attachment-location-manager
Release list
1.0.1
Full Changelog: 1.0.0...1.0.1
Attachment Location Manager 1.0.1 更新日志
本文按「发布定位 → 命名与发布配置 → 取值规则 → 附件范围与排除 → 特例校验 → 引用改写 → 批量重排 → 覆盖同步 → 可靠性」的顺序汇总本版全部变更:先交代更名与工程口径这类一次性事项,再依次说明用户可见的取值规则、附件范围、界面交互与稳定性改进。
English
Here's the English version, kept in changelog style:
-
Error & warning fixes
1.1 Added missingawaits, replacedfor...inarray iteration, applied type narrowing to error objects, and removed trailing regex assertions along with@ts-ignore— static analysis warnings are now at zero.
1.2 Modals and input fields no longer set element styles directly, redundant prefixes were stripped from command identifiers, and marketplace review warnings have been consolidated accordingly. -
Engineering baseline
Pinned the dependency to Obsidian 1.13.1 and raisedminAppVersionto 1.8.7; the build and lint toolchain now usesnode:moduleandimport-x. -
Settings page
Switched to the official declarative settings API as of 1.13, grouped settings by section and reset the layout to "one card per row," with titles and content left-aligned and spacing layered.
中文说明
- 错误与警告修复
1.1 补上遗漏的 await、修正以 for...in 遍历数组、给错误对象做类型收窄、移除正则后行断言与 @ts-ignore,静态检查告警清零。
1.2 弹窗与输入框不再直接写元素样式、命令标识去掉多余前缀,上架审查告警同步收口。 - 工程口径:依赖钉到 obsidian 1.13.1、minAppVersion 提到 1.8.7,构建与检查工具链改用 node:module 与 import-x。
- 设置页:1.13 起改用官方声明式设置接口,逐区块成组并复位为「一行一卡」,标题与内容左对齐、间距分层。
1.0.0
Full Changelog: https://github.com/lishuai1993/attachment-location-manager/commits/1.0.0
Attachment Location Manager 1.0.0 更新日志
本文按「发布定位 → 命名与发布配置 → 取值规则 → 附件范围与排除 → 特例校验 → 引用改写 → 批量重排 → 覆盖同步 → 可靠性」的顺序汇总本版全部变更:先交代更名与工程口径这类一次性事项,再依次说明用户可见的取值规则、附件范围、界面交互与稳定性改进。
English
This is the first release published under the new name Attachment Location Manager. It collects every change since the previous version, ordered from the outside in: naming and packaging first, then how a setting is resolved, what counts as an attachment, how special cases are validated, how links are matched and rewritten, how the rearrange commands behave, how overrides stay in sync with the vault, and finally the reliability hardening.
1. Renaming and Release Setup
- The plugin is now Attachment Location Manager, with the id
attachment-location-manager. The manifest name, id, description, package name, and license header were all updated to match. - All five command ids carry the new prefix. If you had hotkeys bound to the old command ids, you will need to rebind them once after updating.
- Derivative-work compliance: the original copyright line is retained, a new copyright line was added for this fork, and the original author's funding link was removed.
- The release workflow pins Node to the
24.xline and now publishes a draft GitHub release, so the release notes and assets can be reviewed before they are made public. - The previous changelog step was removed. It diffed against the latest published release, which does not exist on a first release, and would have failed the whole job.
2. How a Setting Is Resolved
- Terminology is now split by scope. Override is used only across layers (a file or a folder); special case is used only within a layer (a per-extension entry). The two words no longer overlap, and nothing is called an “extension override” any more.
- Resolution is pinned to two steps. First pick the layer: file override ▶ nearest ancestor folder override ▶ global default, first hit wins, with no fallback to another layer. Then read the value inside that layer. A layer's special cases are never compared against another layer's.
- Special cases changed from full takeover to delta inheritance: a special case rewrites only the fields you actually customize, and the remaining fields follow the layer it sits in. Existing entries all carried four values, so they read exactly as before — no migration is needed.
3. Attachment Scope and Exclusions
- Three settings were renamed to state what they actually govern: Excluded from attachments, Unmanaged note folders, and the subfolder option, which now reads “applies to subfolders of the folders above as well”. The two folder settings decide whether attachments under those note folders are managed at all — not merely whether they are renamed.
- The subfolder option now matches by path segment rather than a bare prefix. Sibling folders that merely share a prefix, such as
Notes-oldorNotes2, are no longer swept in. - Extension matching is now case-insensitive everywhere: attachment scope, special-case validation, duplicate detection, and the markdown/canvas checks all share one rule. An extension typed in the wrong case now behaves like the correctly cased one, instead of silently doing nothing.
- “Is this a note?” and “is this mine to manage?” were split into two separate predicates. The exclusion list now only decides whether an attachment is managed; it no longer influences whether a file is treated as a note.
- The image-type filter on the paste and drag-in path was removed. Attachment scope is decided once, at the moment a file lands in the vault.
4. Special-Case Validation
- Validation now uses the same regular-expression rules the plugin applies at runtime, so an entry that passes validation is an entry that will actually take effect.
- When the same extension appears twice, only the later, dead entry is flagged, instead of leaving you to guess which one is being ignored.
- A newly added card starts as a draft. Empty or invalid values are never written to disk, and the right-click modal re-validates before it confirms, rejecting input that does not pass. “Invalid values never persist” now holds across rendering, model, and storage.
5. Link Matching and Rewriting
- Reference matching was upgraded from an exact-substring test to anchor-regex matching with parameter tolerance: the target is anchored by
[[…]], and a trailing parameter segment such as|orig|center|144|100is tolerated as a whole. - Rewriting replaces only the target segment and preserves the parameters verbatim, so an image reference that another plugin has annotated is no longer missed — it is renamed and moved like any other.
- The rewriting logic shared by paste handling and rearrange was extracted into a single module, so both paths now behave identically.
6. Rearrange and Shared Attachments
- The two rearrange commands are no longer switched off by the Automatically rename attachment toggle. That check now belongs to the rename event path, which is where it actually applies.
- When no note or canvas is open, the command says so and returns, instead of running for nothing and still reporting success.
- Shared attachments are split on demand. Before anything moves, the whole vault is scanned and every note referencing the attachment is asked where it expects that attachment to live. If they all agree, one file is moved there. If they disagree, the original stays where the command was run (for the whole-vault command, the path that sorts first), a copy is placed at each other location, and every note is repointed at its own copy. No note is dragged into another note's folder merely because it was processed first, and running the command a second time changes nothing.
- Files the plugin itself moves or copies are registered upfront, so the file-creation event skips them and never mistakes them for a fresh paste to be relocated.
7. Override Synchronization
- Every override is identified solely by the path it applies to. Renaming or moving a file or folder now re-keys the override by path. The old depth-comparison logic and its fallback were deleted, so the sync is repeatable and no longer depends on the order in which rename events arrive within a folder.
- Deleting a file or folder now deletes the overrides of everything beneath it as well. A deleted folder can no longer leave behind an override that silently revives with the old settings the next time a note of the same name is created.
- At startup, every override is checked for whether it can still take effect. Both “the path no longer exists” and “something else now sits at this path” are written to the diagnostic log, so an override that is being ignored is no longer invisible.
- Settings gained an Overrides section listing every overridden path with its type, its four settings, and whether it is still live. Dead entries are shown in red and can be removed one by one — cross-layer overrides are no longer viewable only through the right-click menu.
8. Reliability
- The attachment queue now scans all pending entries instead of only the head, and isolates each one: an entry that stalls or throws is skipped while the rest proceed. Entries that never match are not retried, and they leave the queue after 60 seconds or 50 scans.
- A single failed move in a rearrange run no longer aborts the whole run. Failures are caught in place and counted, and the run ends with a summary of moved, skipped, and failed counts plus the elapsed time.
- Branches that used to fail silently now log: the toggle being off, an empty scan, a missing link target, and multiple notes sharing one attachment.
中文说明
本版是更名后的第一次发布,插件现名 Attachment Location Manager。以下汇总自上版以来的全部变更,按由外向内的顺序组织:先讲命名与发布配置这类一次性事项,再依次说明取值规则、附件范围、特例校验、引用改写、批量重排、覆盖同步与可靠性加固。
1. 更名与发布配置
- 插件更名为 Attachment Location Manager,标识符为
attachment-location-manager。清单中的名称、标识符、描述、包名与许可证署名均已同步更新。 - 五条命令的标识符统一更换为新前缀。若你此前把快捷键绑在旧标识符上,升级后需要重新绑定一次。
- 衍生作品合规:保留原作者的版权声明,为本分支新增一条版权声明,并移除原作者的个人赞助链接。
- 发布流程把 Node 固定到
24.x一行,并改为创建 草稿 发布,使更新说明与产物可以在公开前先行审阅。 - 原先的变更日志步骤已移除。该步骤需要与最近一次已发布的版本做差异比对,而首次发布时并不存在这样的版本,会导致整个发布任务失败。
2. 设置取值规则
- 术语按作用域切分:覆盖 只用于跨层(某个文件或某个文件夹),特例 只用于层内(某个扩展名条目)。两者不再重叠,也不再有任何设置叫「扩展名覆盖」。
- 取值钉为两步。先选层:本文件覆盖 ▶ 最近上层文件夹覆盖 ▶ 全局默认,命中即停,不跨层回退;再在选中层内取值。某一层的特例,不与其他层做比较。
- 特例由「全量接管」改为 差量继承:特例只改写你确实自定义的字段,其余字段跟随它所在的这一层。此前的条目四项都有值,解读结果与从前完全一致,无需迁移。
3. 附件范围与排除项
- 三项设置更名为它们真正管辖的内容:不计为附件的扩展名、不管理的笔记目录,以及子目录项——现表述为「子目录同此」。后两项管辖的是这些笔记目录下的附件整体不参与管理,而非仅免于重命名。
- 子目录项改为按 路径段 匹配,不再用裸前缀。仅因前缀相同而相似的兄弟目录,例如
Notes-old、Notes2,不再被连带豁免。 - 扩展名匹配统一为 不区分大小写:附件范围、特例校验、重复项判定与 markdown/canvas 判定四处同口径。大小写写错的扩展名从此与写对时行为一致,而不再出现「填了却没生效、也没有任何提示」。
- 把「是不是笔记」与「归不归我管」拆成两个独立判定。排除清单从此只决定某个附件是否参与管理,不再影响一个文件是否被当作笔记处理。
- 移除粘贴与拖入链路中按图片类型放行的窄口径筛选。附件范围只在文件刚落入仓库的那一刻判定一次。
4. 特例输入校验
- 校验改用与插件实际生效时同一套正则规则,因此通过校验的条目就是真的会生效的条目。
- 同一扩展名重复出现时,只标记排在后面的那条无效条目,不再让人猜测究竟哪一条被忽略。
- 新增卡片先以 草稿 形态存在。空值与非法值一律不落盘;右键弹窗在确认前二次校验,未通过的输入直接拦下。「非法值不得落盘」这条规则从此贯穿渲染、模型与持久化三处。
5. 引用匹配与改写
- 引用匹配由「整串精确子串」升级为 锚点正则匹配 + 参数容忍:以
[[…]]锚定目标,对形如|orig|center|144|100的尾部参数段整体容忍。 - 改写只替换目标段,并原样保留参数。经其他插件追加过参数的图片引用不再漏匹配——它同样会被改名并搬运。
- 粘贴处理与批量重排共用的改写逻辑已抽成单一模块,两条路径行为从此一致。
6. 重排与共享附件
- 两条重排命令不再被 自动重命名附件 开关停掉。该检查改由重命名事件链路负责,那才是它真正适用的位置。
- 没有打开笔记或画布时,命令会给出提示并直接返回,不再白跑一趟却仍提示成功。
- 共享附件按需拆分。 动手之前先扫描整个仓库,逐一向引用该附件的每篇笔记询问:你期望它存放在哪里。若各篇一致,就把这一个文件搬过去;若不一致,原文件留在执行命令时所在的位置(全仓库命令则取路径排序最靠前的位置),其余每个位置各放一份副本,并把每篇笔记的链接改指到属于它自己的那一份。被多篇引用的附件不会再被「谁先处理谁得到」地拖进某一篇笔记的目录,重复执行命令结果不变...