Skip to content

Commit 758a243

Browse files
committed
saveWithotFileHandle added toload-save modified
1 parent 1bde16f commit 758a243

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

src/graph-builder/graph-core/5-load-save.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,26 @@ class GraphLoadSave extends GraphUndoRedo {
126126
}
127127
}
128128

129+
async saveWithoutFileHandle() {
130+
const str = graphmlBuilder(this.jsonifyGraph());
131+
const bytes = new TextEncoder().encode(str);
132+
const blob = new Blob([bytes], { type: 'application/json;charset=utf-8' });
133+
const options = {
134+
types: [
135+
{
136+
description: 'GraphMl Files',
137+
accept: {
138+
'text/graphml': ['.graphml'],
139+
},
140+
},
141+
],
142+
};
143+
const handle = await window.showSaveFilePicker(options);
144+
const stream = await handle.createWritable();
145+
await stream.write(blob);
146+
await stream.close();
147+
}
148+
129149
saveToFolder() {
130150
const str = graphmlBuilder(this.jsonifyGraph());
131151
return str;

0 commit comments

Comments
 (0)