add: open parent attachment from editor
This commit is contained in:
parent
afe46c8e39
commit
2ca70f9909
|
|
@ -85,4 +85,5 @@ editor.toolbar.settings.openWorkspace=Open Note Workspace
|
|||
editor.toolbar.settings.setWorkspace=Set as Workspace Note
|
||||
editor.toolbar.settings.insertTemplate=Insert Template to Cursor Line
|
||||
editor.toolbar.settings.copyLink=Copy Note Link
|
||||
editor.toolbar.settings.openParent=Open Attachment
|
||||
editor.toolbar.export.title=Export Note...
|
||||
|
|
|
|||
|
|
@ -85,4 +85,5 @@ editor.toolbar.settings.openWorkspace=打开笔记工作区
|
|||
editor.toolbar.settings.setWorkspace=设为工作区笔记
|
||||
editor.toolbar.settings.insertTemplate=插入模板到光标行
|
||||
editor.toolbar.settings.copyLink=复制笔记链接
|
||||
editor.toolbar.settings.openParent=打开附件
|
||||
editor.toolbar.export.title=导出笔记...
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ export async function initEditorToolbar(editor: Zotero.EditorInstance) {
|
|||
(e) => {}
|
||||
);
|
||||
|
||||
settingsButton.addEventListener("mouseenter", (ev) => {
|
||||
settingsButton.addEventListener("mouseenter", async (ev) => {
|
||||
const settingsMenu: PopupData[] = [
|
||||
{
|
||||
id: makeId("settings-openWorkspace"),
|
||||
|
|
@ -76,6 +76,18 @@ export async function initEditorToolbar(editor: Zotero.EditorInstance) {
|
|||
},
|
||||
];
|
||||
|
||||
const parentAttachment = await noteItem.parentItem?.getBestAttachment();
|
||||
if (parentAttachment) {
|
||||
settingsMenu.push({
|
||||
id: makeId("settings-openParent"),
|
||||
text: getString("editor.toolbar.settings.openParent"),
|
||||
callback: (e) => {
|
||||
ZoteroPane.viewAttachment([parentAttachment.id]);
|
||||
Zotero.Notifier.trigger("open", "file", parentAttachment.id);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const settingsPopup = registerEditorToolbarPopup(
|
||||
editor,
|
||||
settingsButton,
|
||||
|
|
|
|||
Loading…
Reference in New Issue