Skip to content

Commit

Permalink
Try opening via a command
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski committed Nov 5, 2023
1 parent c106f0a commit 6ad691b
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions galata/src/helpers/notebook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,14 @@ export class NotebookHelper {
* @returns Action success status
*/
async open(name: string): Promise<boolean> {
const isListed = await this.filebrowser.isFileListedInBrowser(name);
if (!isListed) {
return false;
}

await this.filebrowser.open(name);

await this.page.evaluate(
async name => {
await window.jupyterapp.commands.execute('docmanager:open', {
path: name
});
},
[name]
);
return await this.isOpen(name);
}

Expand All @@ -88,7 +89,14 @@ export class NotebookHelper {
* @returns Action success status
*/
async openByPath(filePath: string): Promise<boolean> {
await this.filebrowser.open(filePath);
await this.page.evaluate(
async filePath => {
await window.jupyterapp.commands.execute('docmanager:open', {
path: filePath
});
},
[filePath]
);
const name = path.basename(filePath);
return await this.isOpen(name);
}
Expand Down

0 comments on commit 6ad691b

Please sign in to comment.