Skip to content

Commit 81ba1be

Browse files
authored
Merge pull request #12 from Tencent/Branch_dev
导出flow文件 支持自定义名称
2 parents fb097d9 + 160efc9 commit 81ba1be

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

javascript/state.core.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,9 +567,18 @@ state.core = (function () {
567567
let m = String(checkTime(nowdate.getMinutes()))
568568
let s = String(checkTime(nowdate.getSeconds()))
569569
let time_str = year+month+day+h+m+s
570-
state.utils.saveFile('flow-'+time_str, stored_config);
571570

572-
}).catch(error => console.error('[state]: Error getting JSON file:', error));
571+
filename = 'flow-'+time_str+'.flow'
572+
filename = prompt("Export workflow as:", filename);
573+
if (!filename) return;
574+
if (!filename.toLowerCase().endsWith(".flow")) {
575+
filename += ".flow";
576+
}
577+
if(filename != ".flow"){
578+
state.utils.saveFile(filename, stored_config);
579+
}
580+
581+
}).catch(error => console.error('[state]: Error getting Flow file:', error));
573582

574583
//config = JSON.stringify(store.getAll(), null, 4);
575584
//fetch(`/lightdiffusionflow/local/ExportLightDiffusionFlow?config=${config}`)

javascript/state.utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ state.utils = {
550550
console.log(url)
551551
const link = document.createElement('a');
552552
link.href = url;
553-
link.download = fileName + '.flow';
553+
link.download = fileName;
554554
document.body.appendChild(link);
555555
link.click();
556556
link.parentNode.removeChild(link);

0 commit comments

Comments
 (0)