Skip to content
This repository was archived by the owner on Oct 21, 2025. It is now read-only.

Commit 7e5b5c6

Browse files
committed
prompt file name emtry
1 parent e3b212d commit 7e5b5c6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/features/serialize/saveDFDandDD.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,20 @@ export class SaveDFDandDD {
104104
* Method to save both XML files by creating Blob objects and triggering downloads.
105105
*/
106106
public saveDiagramAsDFD(): void {
107-
this.saveFile(this.dfdString, ".dataflowdiagram");
108-
this.saveFile(this.ddString, ".datadictionary");
107+
const name = window.prompt("Enter file name:", getModelFileName());
108+
this.saveFile(this.dfdString, ".dataflowdiagram", name);
109+
this.saveFile(this.ddString, ".datadictionary", name);
109110
}
110111

111-
private saveFile(file: string, ending: string) {
112+
private saveFile(file: string, ending: string, name?: string | null): void {
112113
const blob = new Blob([file], { type: "application/xml" });
113114
const url = URL.createObjectURL(blob);
114115
const link = document.createElement("a");
115116
link.href = url;
116-
link.setAttribute("download", getModelFileName() + ending);
117+
if (!name) {
118+
name = getModelFileName();
119+
}
120+
link.setAttribute("download", name + ending);
117121
document.body.appendChild(link); // Append link to the body
118122
link.click(); // Programmatically click to trigger download
119123
URL.revokeObjectURL(url); // Revoke the URL after download

0 commit comments

Comments
 (0)