@kirisame325 @no5110 自己再测试一下确认没问题再用。
还有什么小需求可以问 AI 自己改改。
基本配置参 QuickAdd JS & Templater JS 简介及相互修改“QuickAdd Capture 加载内部代码”。
效果 GIF,点击展开
js quickadd 代码
const { editor: Editor, file } = app.workspace.activeEditor
, b = await this.quickAddApi.yesNoPrompt('清空当前文档附件'); if (!b) return
app.fileManager.iterateAllRefs(async (rPath, rbj)=> {
const path = app.metadataCache.getFirstLinkpathDest(rbj.link.split('#')[0], rPath)?.path
if (!path || rPath != file.path) return; const s = rbj.position.start, ed = rbj.position.end
Editor.replaceRange('', {line: s.line, ch: s.col}, {line: ed.line, ch: ed.col})
await app.vault.trash(app.vault.getAbstractFileByPath(path), true) })