Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
MuiseDestiny committed Jan 8, 2024
1 parent db444f3 commit e4c2b0c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,4 @@
"after:release": "echo Successfully released ${name} v${version} to ${repo.repository}."
}
}
}
}
28 changes: 14 additions & 14 deletions src/modules/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export default class Menu {
for (const item of getAttachmentItems()) {
try {
const attItem = await renameFile(item);
attItem && showAttachmentItem(attItem)
attItem && showAttachmentItem(attItem);
} catch (e) {
ztoolkit.log(e);
}
Expand All @@ -170,7 +170,7 @@ export default class Menu {
for (const item of getAttachmentItems()) {
try {
const attItem = await moveFile(item);
attItem && showAttachmentItem(attItem)
attItem && showAttachmentItem(attItem);
} catch (e) {
ztoolkit.log(e);
}
Expand Down Expand Up @@ -434,7 +434,7 @@ export async function moveFile(attItem: Zotero.Item) {
try {
await OS.File.move(sourcePath, destPath);
} catch (e) {
ztoolkit.log(e)
ztoolkit.log(e);
return await moveFile(attItem);
}
}
Expand All @@ -447,28 +447,28 @@ export async function moveFile(attItem: Zotero.Item) {
const newAttItem = await Zotero.Attachments.linkFromFile(options);
window.setTimeout(async () => {
// 迁移标注
ztoolkit.log("迁移标注")
ztoolkit.log("迁移标注");
await Zotero.DB.executeTransaction(async function () {
await Zotero.Items.moveChildItems(attItem, newAttItem);
});
// 迁移相关
ztoolkit.log("迁移相关")
ztoolkit.log("迁移相关");
await Zotero.Relations.copyObjectSubjectRelations(attItem, newAttItem);
// 迁移索引
ztoolkit.log("迁移索引")
ztoolkit.log("迁移索引");
await Zotero.DB.executeTransaction(async function () {
await Zotero.Fulltext.transferItemIndex(attItem, newAttItem);
});
// 迁移标签
ztoolkit.log("迁移标签")
newAttItem.setTags(attItem.getTags())
ztoolkit.log("迁移标签");
newAttItem.setTags(attItem.getTags());
// 迁移PDF笔记
ztoolkit.log("迁移PDF笔记")
newAttItem.setNote(attItem.getNote())
await newAttItem.saveTx()
ztoolkit.log("迁移PDF笔记");
newAttItem.setNote(attItem.getNote());
await newAttItem.saveTx();
removeEmptyFolder(OS.Path.dirname(sourcePath));
await attItem.eraseTx();
})
});
return newAttItem;
}

Expand Down Expand Up @@ -547,8 +547,8 @@ function getCollectionPathsOfItem(item: Zotero.Item) {
}
return OS.Path.normalize(
getCollectionPath(collection.parentID) +
addon.data.folderSep +
collection.name,
addon.data.folderSep +
collection.name,
) as string;
};
try {
Expand Down

0 comments on commit e4c2b0c

Please sign in to comment.