This is an automated email from the ASF dual-hosted git repository.
hugoferreira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new aa22fa2 save method from FileReference now operational with a default
file name
new 9602a8c Merge pull request #911 from SolidSoft-Lda/develop
aa22fa2 is described below
commit aa22fa2adaa3f728086d690a663bd49a5326fa5b
Author: Hugo <[email protected]>
AuthorDate: Sun Sep 13 01:56:21 2020 +0100
save method from FileReference now operational with a default file name
---
.../MXRoyale/src/main/royale/mx/net/FileReference.as | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git
a/frameworks/projects/MXRoyale/src/main/royale/mx/net/FileReference.as
b/frameworks/projects/MXRoyale/src/main/royale/mx/net/FileReference.as
index 2ef9931..b9b0abc 100644
--- a/frameworks/projects/MXRoyale/src/main/royale/mx/net/FileReference.as
+++ b/frameworks/projects/MXRoyale/src/main/royale/mx/net/FileReference.as
@@ -126,11 +126,19 @@ package mx.net
{
var a:HTMLAnchorElement = document.createElement("a") as
HTMLAnchorElement;
a.href = URL.createObjectURL(new Blob([data]));
- a.setAttribute("download", defaultFileName);
- a.text = defaultFileName;
- document.body.appendChild(a);
-// a.click();
-// document.body.removeChild(a);
+ if (defaultFileName == null)
+ {
+ a.setAttribute("download", "download.pdf");
+ a.text = "download.pdf";
+ }
+ else
+ {
+ a.setAttribute("download", defaultFileName);
+ a.text = defaultFileName;
+ }
+ document.body.appendChild(a);
+ a.click();
+ document.body.removeChild(a);
}
}