update
This commit is contained in:
parent
50956fefff
commit
a26f5fd0a9
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
|
|
@ -0,0 +1,4 @@
|
|||
itemPaneSection-header =
|
||||
.label = 翻译
|
||||
itemPaneSection-sidenav =
|
||||
.tooltiptext = 翻译
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
itemPaneSection-header =
|
||||
.label = 翻译
|
||||
itemPaneSection-sidenav =
|
||||
.tooltiptext = 翻译
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
},
|
||||
"homepage": "https://github.com/syt2/zotero-tldr#readme",
|
||||
"dependencies": {
|
||||
"zotero-plugin-toolkit": "^2.3.25"
|
||||
"zotero-plugin-toolkit": "^2.3.29"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.4.2",
|
||||
|
|
@ -58,6 +58,6 @@
|
|||
"release-it": "^16.1.0",
|
||||
"replace-in-file": "^7.0.1",
|
||||
"typescript": "^5.1.6",
|
||||
"zotero-types": "^1.0.16"
|
||||
"zotero-types": "^1.3.11"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -73,6 +73,46 @@ export class UIFactory {
|
|||
|
||||
// tldr行
|
||||
static async registerTLDRItemBoxRow() {
|
||||
const registeredID = Zotero.ItemPaneManager.registerSection({
|
||||
paneID: config.addonRef,
|
||||
pluginID: config.addonID,
|
||||
header: {
|
||||
l10nID: `${config.addonRef}-itemPaneSection-header`,
|
||||
icon: `chrome://${config.addonRef}/content/icons/favicon@16.png`,
|
||||
},
|
||||
sidenav: {
|
||||
l10nID: `${config.addonRef}-itemPaneSection-sidenav`,
|
||||
icon: `chrome://${config.addonRef}/content/icons/favicon@20.png`,
|
||||
},
|
||||
onRender: ({ body, item, editable, tabType }: any) => {
|
||||
const noteKey = tldrs.get()[item.key];
|
||||
let str = "";
|
||||
if (noteKey) {
|
||||
const obj = Zotero.Items.getByLibraryAndKey(item.libraryID, noteKey);
|
||||
if (
|
||||
obj &&
|
||||
obj instanceof Zotero.Item &&
|
||||
item.getNotes().includes(obj.id)
|
||||
) {
|
||||
str = obj.getNote();
|
||||
if (str.startsWith("<p>TL;DR</p>\n<p>")) {
|
||||
str = str.slice("<p>TL;DR</p>\n<p>".length);
|
||||
}
|
||||
if (str.endsWith("</p>")) {
|
||||
str = str.slice(0, -4);
|
||||
}
|
||||
}
|
||||
}
|
||||
body.textContent = str;
|
||||
// body.textContent
|
||||
// = JSON.stringify({
|
||||
// id: item?.id,
|
||||
// editable,
|
||||
// tabType,
|
||||
// });
|
||||
},
|
||||
});
|
||||
return;
|
||||
await ztoolkit.ItemBox.register(
|
||||
"TLDR",
|
||||
getString("itembox-tldrlabel"),
|
||||
|
|
|
|||
Loading…
Reference in New Issue