Skip to content

Commit ddaec59

Browse files
committed
Now opens editor and viewer
1 parent a6d1fd4 commit ddaec59

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

src/index.ts

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ const extension: JupyterFrontEndPlugin<void> = {
9898
tracker.save(widget);
9999
});
100100
tracker.add(widget);
101+
102+
// Open editor alongside viewer
103+
commands.execute('docmanager:open', {
104+
path: widget.context.path,
105+
factory: 'Editor'
106+
});
107+
101108
});
102109

103110
// Register widget and model factories
@@ -121,20 +128,23 @@ const extension: JupyterFrontEndPlugin<void> = {
121128
icon: urdf_icon,
122129
iconClass: 'jp-URDFIcon',
123130
caption: 'Create a new URDF',
124-
execute: () => {
131+
execute: async () => {
125132
const cwd = browserFactory.model.path;
126-
commands
127-
.execute('docmanager:new-untitled', {
128-
path: cwd,
129-
type: 'file',
130-
ext: '.urdf'
131-
})
132-
.then(model =>
133-
commands.execute('docmanager:open', {
134-
path: model.path,
135-
factory: FACTORY
136-
})
137-
);
133+
const model = await commands.execute('docmanager:new-untitled', {
134+
path: cwd,
135+
type: 'file',
136+
ext: '.urdf'
137+
});
138+
139+
await commands.execute('docmanager:open', {
140+
path: model.path,
141+
factory: FACTORY
142+
});
143+
144+
await commands.execute('docmanager:open', {
145+
path: model.path,
146+
factory: 'Editor'
147+
});
138148
}
139149
});
140150

0 commit comments

Comments
 (0)