mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-21 14:27:05 +08:00
Fix export name
This commit is contained in:
parent
ef430e58ae
commit
9be066014e
@ -53,7 +53,7 @@ export class ComfyAppMenu {
|
|||||||
icon: "download",
|
icon: "download",
|
||||||
content: "Export",
|
content: "Export",
|
||||||
tooltip: "Export the current workflow as JSON",
|
tooltip: "Export the current workflow as JSON",
|
||||||
action: () => this.exportWorkflow("workflow", "workflow"),
|
action: () => this.exportWorkflow( "workflow", "workflow"),
|
||||||
}),
|
}),
|
||||||
new ComfyButton({
|
new ComfyButton({
|
||||||
icon: "api",
|
icon: "api",
|
||||||
@ -254,10 +254,14 @@ export class ComfyAppMenu {
|
|||||||
* @param { "workflow" | "output" } [promptProperty]
|
* @param { "workflow" | "output" } [promptProperty]
|
||||||
*/
|
*/
|
||||||
async exportWorkflow(filename, promptProperty) {
|
async exportWorkflow(filename, promptProperty) {
|
||||||
|
if(this.app.workflowManager.activeWorkflow?.path) {
|
||||||
|
filename = this.app.workflowManager.activeWorkflow.name;
|
||||||
|
}
|
||||||
const p = await this.app.graphToPrompt();
|
const p = await this.app.graphToPrompt();
|
||||||
const json = JSON.stringify(p[promptProperty], null, 2);
|
const json = JSON.stringify(p[promptProperty], null, 2);
|
||||||
const blob = new Blob([json], { type: "application/json" });
|
const blob = new Blob([json], { type: "application/json" });
|
||||||
const file = this.getFilename(filename);
|
const file = this.getFilename(filename);
|
||||||
|
if(!file) return;
|
||||||
downloadBlob(file, blob);
|
downloadBlob(file, blob);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user