Skip to content

Commit 0f528bc

Browse files
committed
clean up
1 parent abd1307 commit 0f528bc

File tree

6 files changed

+312
-475
lines changed

6 files changed

+312
-475
lines changed

src/index.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,20 @@ function activate(
157157
tracker.currentWidget !== null &&
158158
tracker.currentWidget === app.shell.currentWidget,
159159
execute: () => {
160-
const cwd = browserFactory.defaultBrowser.model.path;
160+
const wdg = app.shell.currentWidget as DrawIODocumentWidget;
161+
const name = wdg.context.path.split('/').pop().split('.')[0] + ".svg";
162+
let path = wdg.context.path.split('/').slice(0, -1).join();
163+
161164
commands
162165
.execute('docmanager:new-untitled', {
163-
path: cwd,
166+
name,
167+
path,
164168
type: 'file',
165169
ext: '.svg'
166170
})
167-
.then(model => {
168-
const wdg = app.shell.currentWidget as any;
171+
.then( model => {
172+
model.name = name
173+
model.path = path ? path + "/" + name : name;
169174
model.content = wdg.getSVG();
170175
model.format = 'text';
171176
app.serviceManager.contents.save(model.path, model);

0 commit comments

Comments
 (0)