@eeacms/volto-arcgis-block 0.1.405 → 0.1.406

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
+ ### [0.1.406](https://github.com/eea/volto-arcgis-block/compare/0.1.405...0.1.406) - 19 November 2025
8
+
9
+ #### :hammer_and_wrench: Others
10
+
11
+ - CLMS-293307+CLMS-289791+CLMS-289790 (bug): Download button creation correction [Urkorue - [`d3684ca`](https://github.com/eea/volto-arcgis-block/commit/d3684ca9cb6ae617fa8c9fd1c1cf286f5fe8910f)]
7
12
  ### [0.1.405](https://github.com/eea/volto-arcgis-block/compare/0.1.404...0.1.405) - 12 November 2025
8
13
 
9
14
  ### [0.1.404](https://github.com/eea/volto-arcgis-block/compare/0.1.403...0.1.404) - 5 November 2025
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eeacms/volto-arcgis-block",
3
- "version": "0.1.405",
3
+ "version": "0.1.406",
4
4
  "description": "volto-arcgis-block: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: CodeSyntax",
@@ -290,7 +290,81 @@ class BookmarkWidget extends React.Component {
290
290
  download_button.innerText = '⭳';
291
291
  download_button.bookmarkName = bookmark.innerText;
292
292
  download_button.addEventListener('click', (e) => {
293
- this.downloadBookmark(e.currentTarget.bookmarkName);
293
+ const name = e.currentTarget.bookmarkName;
294
+ let storageKey;
295
+ if (document.querySelector('.fa-user')) {
296
+ storageKey =
297
+ 'user_' +
298
+ document.querySelector('.fa-user').nextSibling
299
+ .textContent;
300
+ } else {
301
+ storageKey = 'user_anonymous';
302
+ }
303
+ let userObj;
304
+ try {
305
+ userObj =
306
+ JSON.parse(localStorage.getItem(storageKey)) || {};
307
+ } catch (e) {
308
+ userObj = {};
309
+ }
310
+ let bookmarks =
311
+ userObj &&
312
+ userObj.bookmarks &&
313
+ typeof userObj.bookmarks === 'object'
314
+ ? userObj.bookmarks
315
+ : null;
316
+ if (!bookmarks) {
317
+ try {
318
+ bookmarks = JSON.parse(
319
+ localStorage.getItem(
320
+ storageKey + '_bookmarks_backup',
321
+ ),
322
+ );
323
+ } catch (e) {
324
+ return;
325
+ }
326
+ }
327
+ if (!bookmarks) return;
328
+ let index = 0;
329
+ for (index; index < bookmarks.items.length; index++) {
330
+ if (bookmarks.items[index].name === name) {
331
+ break;
332
+ }
333
+ }
334
+ let selectedBookmark = {
335
+ items: Array.isArray(bookmarks.items)
336
+ ? bookmarks.items[index]
337
+ : [],
338
+ layers: Array.isArray(bookmarks.layers)
339
+ ? bookmarks.layers[index]
340
+ : [],
341
+ opacity: Array.isArray(bookmarks.opacity)
342
+ ? bookmarks.opacity[index]
343
+ : [],
344
+ visible: Array.isArray(bookmarks.visible)
345
+ ? bookmarks.visible[index]
346
+ : [],
347
+ hotspot: Array.isArray(bookmarks.hotspot)
348
+ ? bookmarks.hotspot[index]
349
+ : [],
350
+ selectedHotspotFilter:
351
+ bookmarks.selectedHotspotFilter != null
352
+ ? bookmarks.selectedHotspotFilter
353
+ : null,
354
+ };
355
+ let filename = 'bookmark_' + selectedBookmark.items.name;
356
+ const blob = new Blob(
357
+ [JSON.stringify(selectedBookmark)],
358
+ {
359
+ type: 'application/json',
360
+ },
361
+ );
362
+ const url = URL.createObjectURL(blob);
363
+ const a = document.createElement('a');
364
+ a.href = url;
365
+ a.download = `${filename}.json`;
366
+ a.click();
367
+ URL.revokeObjectURL(url);
294
368
  });
295
369
  bookmark.insertBefore(tooltip, bookmark.childNodes[2]);
296
370
  }