Skip to content

Commit

Permalink
🔖v1.2.4/ 2024.12.02
Browse files Browse the repository at this point in the history
- 🐛 发现脚注编号有重大bug,长文档可能会造成块丢失,暂时先改为耗时方法进行编号,保证原内容不丢失,但在插件编号过程中添加新内容依然会造成内容丢失,如无必要请勿开启脚注自动编号功能,有需要可以脚注添加完成之后,使用命令对脚注进行批量编号
  • Loading branch information
Achuan-2 committed Dec 2, 2024
1 parent 35f420a commit ef41e7a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 24 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v1.2.4/ 2024.12.02

- 🐛 发现脚注编号有重大bug,长文档可能会造成块丢失,暂时先改为耗时方法进行编号,保证原内容不丢失,但在插件编号过程中添加新内容依然会造成内容丢失,如无必要请勿开启脚注自动编号功能,有需要可以脚注添加完成之后,使用命令对脚注进行批量编号


## v1.2.3 / 2024.12.02

- 🐛 fix 命令【取消脚注编号】对index内容的重命名错误
Expand Down
4 changes: 4 additions & 0 deletions README_zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@

最近更新

v1.2.4/ 2024.12.02

- 🐛 发现脚注编号有重大bug,长文档可能会造成块丢失,暂时先改为耗时方法进行编号,保证原内容不丢失,但在插件编号过程中添加新内容依然会造成内容丢失,如无必要请勿开启脚注自动编号功能,有需要可以脚注添加完成之后,使用命令对脚注进行批量编号

v1.2.2 / 2024.12.02

- ✨ 脚注容器标题可以支持设置为段落块,不需要一定是标题了!
Expand Down
2 changes: 1 addition & 1 deletion plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "siyuan-plugin-blockref-footnote",
"author": "Achuan-2",
"url": "https://github.com/Achuan-2/siyuan-plugin-blockref-footnote",
"version": "1.2.3",
"version": "1.2.4",
"minAppVersion": "3.1.13",
"backends": [
"windows",
Expand Down
2 changes: 1 addition & 1 deletion public/i18n/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
},
"enableOrderedFootnotes": {
"title": "脚注自动数字编号",
"description": "使用数字编号(如[1], [2]等)替代自定义锚文本。开启后每次新建和删除脚注会自动对所有脚注重新排序编号。</br>注意:目前开启此项,当脚注数量越多,排序耗时越长,介意请勿开启。"
"description": "使用数字编号(如[1], [2]等)替代自定义锚文本。开启后每次新建和删除脚注会自动对所有脚注重新排序编号。</br>注意:目前开启此项,当脚注数量越多,文档内容越长,排序耗时越长,介意请勿开启。"
},
"template": {
"title": "脚注内容模版",
Expand Down
25 changes: 3 additions & 22 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1129,9 +1129,9 @@ export default class PluginFootnote extends Plugin {
await new Promise(resolve => setTimeout(resolve, 500));
if (this.settingUtils.get("saveLocation") == 4) {
//脚注内容块放在块后,不进行脚注内容块排序
await this.reorderFootnotes(protyle.block.id, false, protyle);
await this.reorderFootnotes(protyle.block.id, false);
} else {
await this.reorderFootnotes(protyle.block.id, true, protyle);
await this.reorderFootnotes(protyle.block.id, true);
}

} else {
Expand All @@ -1155,6 +1155,7 @@ export default class PluginFootnote extends Plugin {
let currentDom;
if (protyle) {
currentDom = protyle.wysiwyg.element;
console.log(currentDom);
} else {
const doc = await getDoc(docID);
if (!doc) return;
Expand Down Expand Up @@ -1267,26 +1268,6 @@ export default class PluginFootnote extends Plugin {
if (footnoteContainerDocID !== docID) {
await updateBlock("dom", footnoteContainerDom.body.innerHTML, footnoteContainerDocID);
}

// Update footnote block attributes
// await Promise.all(
// Array.from(blockRefs).map(async ref => {
// const blockId = ref.getAttribute('custom-footnote');
// const number = footnoteOrder.get(blockId);

// // Improved block existence check
// if (blockId && number) {
// // Query the database to check if block exists
// const blockExists = await sql(
// `SELECT id FROM blocks WHERE id = '${blockId}' LIMIT 1`
// );

// if (blockExists && blockExists.length > 0) {
// return setBlockAttrs(blockId, { "name": number.toString() });
// }
// }
// }).filter(Boolean)
// );
}

private async cancelReorderFootnotes(docID: string, reorderBlocks: boolean) {
Expand Down

0 comments on commit ef41e7a

Please sign in to comment.