I am trying to create extension where once in voila preview if i click a link to notebooks , it should open in voila preview again but in a new tab with jupyter lab and not a complete new browser tab.
part code in extension:
// Function to handle notebook links in the rendered Voila output
const handleNotebookLinkClick = async (event: MouseEvent) => {
const target = event.target as HTMLElement;
// Check if the clicked element is a link to a notebook (.ipynb)
if (target.tagName === 'A' && target.getAttribute('href')?.endsWith('.ipynb')) {
event.preventDefault(); // Prevent the default link behavior
const notebookPath = target.getAttribute('href')!;
console.log("Here");
// Open the clicked notebook in Voila preview
const widget = await docManager.open(notebookPath, 'Voila Preview');
// Add the widget in 'split-right' mode
if (widget) {
app.shell.add(widget, 'right'); // Use 'right' to split the widget to the right
}
}
};
but i get the error - shared module @jupyterlab/docmanager doesn’t exist in shared scope default
How i can i fix this?