Skip to content

Commit

Permalink
Export to svg (see #93)
Browse files Browse the repository at this point in the history
  • Loading branch information
hbcarlos committed Aug 24, 2021
1 parent 7d94ba0 commit c3038ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
18 changes: 3 additions & 15 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,27 +157,15 @@ function activate(
tracker.currentWidget !== null &&
tracker.currentWidget === app.shell.currentWidget,
execute: () => {
const wdg = app.shell.currentWidget as DrawIODocumentWidget;
const name =
wdg.context.path
.split('/')
.pop()
.split('.')[0] + '.svg';
const path = wdg.context.path
.split('/')
.slice(0, -1)
.join();

const cwd = browserFactory.defaultBrowser.model.path;
commands
.execute('docmanager:new-untitled', {
name,
path,
path: cwd,
type: 'file',
ext: '.svg'
})
.then(model => {
model.name = name;
model.path = path ? path + '/' + name : name;
const wdg = app.shell.currentWidget as any;
model.content = wdg.getSVG();
model.format = 'text';
app.serviceManager.contents.save(model.path, model);
Expand Down
1 change: 0 additions & 1 deletion testfiles/test.svg

This file was deleted.

0 comments on commit c3038ba

Please # to comment.