From 3c234ead5be8bdc4d22916b59f0c0d9487d4135e Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Fri, 13 Oct 2023 12:00:59 +0200 Subject: [PATCH] Add missing function after cherry-picking --- umap/static/umap/js/umap.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/umap/static/umap/js/umap.js b/umap/static/umap/js/umap.js index 7a0065e9..e762db14 100644 --- a/umap/static/umap/js/umap.js +++ b/umap/static/umap/js/umap.js @@ -832,6 +832,25 @@ L.U.Map.include({ document.body.removeChild(el) }, + processFileToImport: function (file, layer, type) { + type = type || L.Util.detectFileType(file) + if (!type) { + this.ui.alert({ + content: L._('Unable to detect format of file {filename}', { + filename: file.name, + }), + level: 'error', + }) + return + } + if (type === 'umap') { + this.importFromFile(file, 'umap') + } else { + if (!layer) layer = this.createDataLayer({ name: file.name }) + layer.importFromFile(file, type) + } + }, + importRaw: function (rawData) { const importedData = JSON.parse(rawData)