diff --git a/README.md b/README.md index ef31b34..650786b 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,8 @@ http://doc.arcgis.com/en/web-appbuilder/create-apps/widget-draw.htm ## configuration : -4 options : +5 options : +- export file name. - Confirm on delete. A confirm dialog when user delete drawing(s) ? - Enable import/export. Let the user import or export drawings ? - Enable local storage. enable auto-saving in local storage and loading saved drawings on widget load. diff --git a/Widget.js b/Widget.js index 811345e..85a6fb4 100644 --- a/Widget.js +++ b/Widget.js @@ -657,6 +657,7 @@ define([ if(!has("ie") && (!navigator.appName || navigator.appName != 'Microsoft Internet Explorer')){ this.exportButton.href = 'data:application/json;charset=utf-8,'+this.drawingsAsJson(true); this.exportButton.target = "_BLANK"; + this.exportButton.download = this.config.exportFileName; return true; } @@ -671,7 +672,7 @@ define([ iframe.document.write(this.drawingsAsJson(true)); iframe.document.close(); iframe.focus(); - iframe.document.execCommand('SaveAs', true, 'myDraw.json'); + iframe.document.execCommand('SaveAs', true, this.config.exportFileName); return false; } diff --git a/config.json b/config.json index aff5fa8..e8e44a9 100644 --- a/config.json +++ b/config.json @@ -1,4 +1,5 @@ { + "exportFileName":"myDrawings.json", "confirmOnDelete":true, "allowImportExport":true, "allowLocalStorage":true, diff --git a/setting/Setting.html b/setting/Setting.html index d681e59..d892099 100644 --- a/setting/Setting.html +++ b/setting/Setting.html @@ -2,32 +2,39 @@