@igea/oac_frontend 1.0.87 → 1.0.88

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@igea/oac_frontend",
3
- "version": "1.0.87",
3
+ "version": "1.0.88",
4
4
  "description": "Frontend service for the OAC project",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -355,7 +355,8 @@ document.addEventListener('DOMContentLoaded', () => {
355
355
  clearInterval(intervalId);
356
356
  if(_this.inEditing)
357
357
  _this.inputIdentifizier();
358
-
358
+ else
359
+ _this.makeAttachmentClickable();
359
360
  _this.validForm = true;
360
361
  _this.serializedForm = _this.form.serialize();
361
362
 
@@ -418,6 +419,37 @@ document.addEventListener('DOMContentLoaded', () => {
418
419
  });
419
420
  return observer;
420
421
  },
422
+ getAttachmentElements(root = document){
423
+ var selector = 'a[href*="/backend/fuseki/attachment/"]'
424
+ const results = [...root.querySelectorAll(selector)];
425
+ // Cerca in tutti gli shadow root
426
+ const allElements = root.querySelectorAll('*');
427
+ for (const el of allElements) {
428
+ if (el.shadowRoot) {
429
+ results.push(...this.getAttachmentElements(el.shadowRoot));
430
+ }
431
+ }
432
+ return results;
433
+ },
434
+ makeAttachmentClickable(){
435
+ var links = this.getAttachmentElements();
436
+ console.log(links)
437
+ for(var i=0; i<links.length; i++){
438
+ var link = links[i];
439
+ var url = link.href;
440
+ link.removeAttribute('href'); // Rimuovi href
441
+ link.style.pointerEvents='auto';
442
+ link.style.cursor = 'pointer';
443
+ link.style.textDecoration = 'underline';
444
+ link.style.color = 'darkblue';
445
+ link.addEventListener('click', function(event) {
446
+ event.preventDefault();
447
+ event.stopPropagation();
448
+ event.stopImmediatePropagation();
449
+ window.open(url, '_blank');
450
+ }, true); // true = capture phase
451
+ }
452
+ },
421
453
  inputIdentifizier(){
422
454
  const form = this.form;
423
455
  const _this = this;