Skip to content

Commit 48b8454

Browse files
haozhou-wonghaozhou.wong
andauthored
feat(menu): add export notes menu for collections (#1577)
Co-authored-by: haozhou.wong <haozhou.wong@gmail.com>
1 parent 5eb10a7 commit 48b8454

8 files changed

Lines changed: 45 additions & 0 deletions

File tree

addon/locale/de/mainWindow.ftl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ menuAddNote-newTemplateStandaloneNote =
1818
menuAddNote-newTemplateItemNote =
1919
.label = Neue Eintrags-Notiz aus Vorlage
2020
21+
menuCollection-exportNotes =
22+
.label = Export Notes in Collection...
23+
2124
menuTab-moveNewWindow =
2225
.label = In neues BN-Fenster verschieben
2326
menu-openNoteAsBNWindow =

addon/locale/en-US/mainWindow.ftl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ menuAddNote-newTemplateStandaloneNote =
1818
menuAddNote-newTemplateItemNote =
1919
.label = New Item Note from Template
2020
21+
menuCollection-exportNotes =
22+
.label = Export Notes in Collection...
23+
2124
menuTab-moveNewWindow =
2225
.label = Move to BN New Window
2326
menu-openNoteAsBNWindow =

addon/locale/it-IT/mainWindow.ftl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ menuAddNote-newTemplateStandaloneNote =
1818
menuAddNote-newTemplateItemNote =
1919
.label = Nuova Nota Elemento da Template
2020
21+
menuCollection-exportNotes =
22+
.label = Export Notes in Collection...
23+
2124
menuTab-moveNewWindow =
2225
.label = Move to BN New Window
2326
menu-openNoteAsBNWindow =

addon/locale/ru-RU/mainWindow.ftl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ menuAddNote-newTemplateStandaloneNote =
1818
menuAddNote-newTemplateItemNote =
1919
.label = Новая заметка элемента из шаблона
2020
21+
menuCollection-exportNotes =
22+
.label = Export Notes in Collection...
23+
2124
menuTab-moveNewWindow =
2225
.label = Move to BN New Window
2326
menu-openNoteAsBNWindow =

addon/locale/tr-TR/mainWindow.ftl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ menuAddNote-newTemplateStandaloneNote =
1818
menuAddNote-newTemplateItemNote =
1919
.label = Şablondan Yeni Öğe Notu
2020
21+
menuCollection-exportNotes =
22+
.label = Export Notes in Collection...
23+
2124
menuTab-moveNewWindow =
2225
.label = Move to BN New Window
2326
menu-openNoteAsBNWindow =

addon/locale/zh-CN/mainWindow.ftl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ menuAddNote-newTemplateStandaloneNote =
1818
menuAddNote-newTemplateItemNote =
1919
.label = 从模板新建条目笔记
2020
21+
menuCollection-exportNotes =
22+
.label = 导出分类中的笔记...
23+
2124
menuTab-moveNewWindow =
2225
.label = 移动到 BN 新窗口
2326
menu-openNoteAsBNWindow =

src/modules/menu.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,32 @@ export function registerMenus() {
8282
],
8383
});
8484

85+
Zotero.MenuManager.registerMenu({
86+
menuID: `${config.addonRef}-menuCollectionExportNotes`,
87+
pluginID: config.addonID,
88+
target: "main/library/collection",
89+
menus: [
90+
{
91+
menuType: "menuitem",
92+
l10nID: `${config.addonRef}-menuCollection-exportNotes`,
93+
icon: `chrome://${config.addonRef}/content/icons/favicon.png`,
94+
onShowing: (_, context) => {
95+
context.setVisible(context.collectionTreeRow?.type === "collection");
96+
},
97+
onCommand: (_, context) => {
98+
const collection = context.collectionTreeRow
99+
?.ref as Zotero.Collection | undefined;
100+
if (!collection) {
101+
return;
102+
}
103+
addon.hooks.onShowExportNoteOptions(
104+
collection.getChildItems(true, false),
105+
);
106+
},
107+
},
108+
],
109+
});
110+
85111
Zotero.MenuManager.registerMenu({
86112
menuID: `${config.addonRef}-menuHelp`,
87113
pluginID: config.addonID,

typings/i10n.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export type FluentMessageId =
113113
| 'menuAddNote-importMD'
114114
| 'menuAddNote-newTemplateItemNote'
115115
| 'menuAddNote-newTemplateStandaloneNote'
116+
| 'menuCollection-exportNotes'
116117
| 'menuEditor-copy'
117118
| 'menuEditor-copyLine'
118119
| 'menuEditor-copySection'

0 commit comments

Comments
 (0)