From 1d52954d2aec93713d05b42714e4a84dcfc561c4 Mon Sep 17 00:00:00 2001 From: Tron Date: Tue, 19 Nov 2024 13:02:10 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=96v1.0.2=20/=202024.11.19?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ✨对选中文本(变量:selection)进行过滤,不包含脚注锚文本,这样方便对重叠的内容进行脚注 --- CHANGELOG.md | 4 ++++ plugin.json | 2 +- src/index.ts | 6 +++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8080141..4514925 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ TODO - [ ] 参考,添加css样式 +## v1.0.2 / 2024.11.19 + +- ✨对选中文本(变量:selection)进行过滤,不包含脚注锚文本,这样方便对重叠的内容进行脚注 + ## v1.0.1 / 2024.11.19 - 📝更新README diff --git a/plugin.json b/plugin.json index cbc440d..f87c466 100644 --- a/plugin.json +++ b/plugin.json @@ -2,7 +2,7 @@ "name": "siyuan-plugin-blockref-footnote", "author": "Achuan-2", "url": "https://github.com/Achuan-2/siyuan-plugin-blockref-footnote", - "version": "1.0.1", + "version": "1.0.2", "minAppVersion": "3.1.12", "backends": [ "windows", diff --git a/src/index.ts b/src/index.ts index af246bc..4962478 100644 --- a/src/index.ts +++ b/src/index.ts @@ -285,10 +285,14 @@ export default class PluginMemo extends Plugin { } + // 获取脚注模板并替换为具体变量值 // 获取脚注模板并替换为具体变量值 const selection = await navigator.clipboard.readText(); // 获取选中文本 + // 过滤掉脚注文本 ((id "text")) + const cleanSelection = selection.replace(/\(\([^)]+\)\)<\/sup>/g, ''); + console.log(cleanSelection); let templates = this.settingUtils.get("templates"); - templates = templates.replace(/\$\{selection\}/g, selection); + templates = templates.replace(/\$\{selection\}/g, cleanSelection); templates = templates.replace(/\$\{content\}/g, zeroWhite); // 插入脚注