Skip to content

Commit c3038ba

Browse files
committed
Export to svg (see #93)
1 parent 7d94ba0 commit c3038ba

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

src/index.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -157,27 +157,15 @@ function activate(
157157
tracker.currentWidget !== null &&
158158
tracker.currentWidget === app.shell.currentWidget,
159159
execute: () => {
160-
const wdg = app.shell.currentWidget as DrawIODocumentWidget;
161-
const name =
162-
wdg.context.path
163-
.split('/')
164-
.pop()
165-
.split('.')[0] + '.svg';
166-
const path = wdg.context.path
167-
.split('/')
168-
.slice(0, -1)
169-
.join();
170-
160+
const cwd = browserFactory.defaultBrowser.model.path;
171161
commands
172162
.execute('docmanager:new-untitled', {
173-
name,
174-
path,
163+
path: cwd,
175164
type: 'file',
176165
ext: '.svg'
177166
})
178167
.then(model => {
179-
model.name = name;
180-
model.path = path ? path + '/' + name : name;
168+
const wdg = app.shell.currentWidget as any;
181169
model.content = wdg.getSVG();
182170
model.format = 'text';
183171
app.serviceManager.contents.save(model.path, model);

testfiles/test.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)