mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-15 13:38:26 +02:00
Use file blobs instead of data uri for saving
(This seems to be an easier path to IE11/Edge support)
This commit is contained in:
@@ -100,7 +100,8 @@ export function uiCommitChanges(context) {
|
||||
delete changeset.id; // Export without chnageset_id
|
||||
|
||||
var data = JXON.stringify(changeset.osmChangeJXON(changes)),
|
||||
uri = 'data:text/xml;charset=utf-8,' + encodeURIComponent(data);
|
||||
blob = new Blob([data], {type: 'text/xml;charset=utf-8;'}),
|
||||
fileName = 'changes.osc';
|
||||
|
||||
var linkEnter = container.selectAll('.download-changes')
|
||||
.data([0])
|
||||
@@ -108,28 +109,24 @@ export function uiCommitChanges(context) {
|
||||
.append('a')
|
||||
.attr('class', 'download-changes');
|
||||
|
||||
if (detected.download) { // all except IE11 and Edge
|
||||
linkEnter // download the data uri as a file
|
||||
.attr('href', uri)
|
||||
.attr('download', 'changes.osc')
|
||||
.call(svgIcon('#icon-load', 'inline'))
|
||||
.append('span')
|
||||
.text(t('commit.download_changes'));
|
||||
if (detected.download) { // All except IE11 and Edge
|
||||
linkEnter // download the data as a file
|
||||
.attr('href', window.URL.createObjectURL(blob))
|
||||
.attr('download', fileName);
|
||||
|
||||
} else { // IE11 and Edge
|
||||
linkEnter // open data uri in a new tab
|
||||
.attr('target', '_blank')
|
||||
.call(svgIcon('#icon-load', 'inline'))
|
||||
.append('span')
|
||||
.text(t('commit.download_changes'));
|
||||
|
||||
linkEnter
|
||||
.on('click.download', function() {
|
||||
var win = window.open(uri, '_blank');
|
||||
win.focus();
|
||||
navigator.msSaveBlob(blob, fileName);
|
||||
});
|
||||
}
|
||||
|
||||
linkEnter
|
||||
.call(svgIcon('#icon-load', 'inline'))
|
||||
.append('span')
|
||||
.text(t('commit.download_changes'));
|
||||
|
||||
|
||||
function mouseover(d) {
|
||||
if (d.entity) {
|
||||
|
||||
+12
-15
@@ -47,7 +47,8 @@ export function uiConflicts(context) {
|
||||
delete changeset.id; // Export without chnageset_id
|
||||
|
||||
var data = JXON.stringify(changeset.osmChangeJXON(origChanges)),
|
||||
uri = 'data:text/xml;charset=utf-8,' + encodeURIComponent(data);
|
||||
blob = new Blob([data], {type: 'text/xml;charset=utf-8;'}),
|
||||
fileName = 'changes.osc';
|
||||
|
||||
var linkEnter = conflictsHelp.selectAll('.download-changes')
|
||||
.data([0])
|
||||
@@ -55,28 +56,24 @@ export function uiConflicts(context) {
|
||||
.append('a')
|
||||
.attr('class', 'download-changes');
|
||||
|
||||
if (detected.download) { // all except IE11 and Edge
|
||||
linkEnter // download the data uri as a file
|
||||
.attr('href', uri)
|
||||
.attr('download', 'changes.osc')
|
||||
.call(svgIcon('#icon-load', 'inline'))
|
||||
.append('span')
|
||||
.text(t('save.conflict.download_changes'));
|
||||
if (detected.download) { // All except IE11 and Edge
|
||||
linkEnter // download the data as a file
|
||||
.attr('href', window.URL.createObjectURL(blob))
|
||||
.attr('download', fileName);
|
||||
|
||||
} else { // IE11 and Edge
|
||||
linkEnter // open data uri in a new tab
|
||||
.attr('target', '_blank')
|
||||
.call(svgIcon('#icon-load', 'inline'))
|
||||
.append('span')
|
||||
.text(t('save.conflict.download_changes'));
|
||||
|
||||
linkEnter
|
||||
.on('click.download', function() {
|
||||
var win = window.open(uri, '_blank');
|
||||
win.focus();
|
||||
navigator.msSaveBlob(blob, fileName);
|
||||
});
|
||||
}
|
||||
|
||||
linkEnter
|
||||
.call(svgIcon('#icon-load', 'inline'))
|
||||
.append('span')
|
||||
.text(t('save.conflict.download_changes'));
|
||||
|
||||
|
||||
body
|
||||
.append('div')
|
||||
|
||||
Reference in New Issue
Block a user