Skip to content

Commit a9d295c

Browse files
committed
Add share and download dropdown factories to view-only notebook
1 parent 3c6cc5a commit a9d295c

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

src/pages/notebook.tsx

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -138,24 +138,26 @@ export const notebookPlugin: JupyterFrontEndPlugin<void> = {
138138
app.shell.activateById(sidebarItem.id);
139139
app.restored.then(() => app.shell.activateById(sidebarItem.id));
140140

141-
toolbarRegistry.addFactory(
142-
'Notebook',
143-
'downloadDropdown',
144-
() => new DownloadDropdownButton(commands)
145-
);
146-
147-
toolbarRegistry.addFactory(
148-
'Notebook',
149-
'share',
150-
() =>
151-
new ToolbarButton({
152-
label: 'Share',
153-
icon: EverywhereIcons.link,
154-
tooltip: 'Share this notebook',
155-
onClick: () => {
156-
void commands.execute(Commands.shareNotebookCommand);
157-
}
158-
})
159-
);
141+
for (const toolbarName of ['Notebook', 'ViewOnlyNotebook']) {
142+
toolbarRegistry.addFactory(
143+
toolbarName,
144+
'downloadDropdown',
145+
() => new DownloadDropdownButton(commands)
146+
);
147+
148+
toolbarRegistry.addFactory(
149+
toolbarName,
150+
'share',
151+
() =>
152+
new ToolbarButton({
153+
label: 'Share',
154+
icon: EverywhereIcons.link,
155+
tooltip: 'Share this notebook',
156+
onClick: () => {
157+
void commands.execute(Commands.shareNotebookCommand);
158+
}
159+
})
160+
);
161+
}
160162
}
161163
};

0 commit comments

Comments
 (0)