@arsedizioni/ars-utils 19.0.91 → 19.0.93

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.
@@ -1432,7 +1432,7 @@ class ClipperDocumentComponent extends ClipperDocumentManager {
1432
1432
  */
1433
1433
  select() {
1434
1434
  if (this.lastDocument) {
1435
- this.broadcastService.sendMessage(ClipperMessages.DOCUMENT_SELECTED, [this.lastDocument]);
1435
+ this.broadcastService.sendMessage(ClipperMessages.DOCUMENT_SELECTED_INNER, [this.lastDocument]);
1436
1436
  this.changeDetector.markForCheck();
1437
1437
  this.close();
1438
1438
  }
@@ -2958,6 +2958,14 @@ class ClipperBrowserComponent extends ClipperSearchResultManager {
2958
2958
  this.filterParams.modules = modules;
2959
2959
  return modules;
2960
2960
  }
2961
+ /**
2962
+ * Return the snapshot document by id
2963
+ * @param id : the document id
2964
+ * @returns the document or null
2965
+ */
2966
+ getSnapshotDocument(id) {
2967
+ return this.snapshot.items.find(x => x.documentId === id);
2968
+ }
2961
2969
  /**
2962
2970
  * Load tags
2963
2971
  */
@@ -3831,13 +3839,28 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.0", ngImpor
3831
3839
 
3832
3840
  class ClipperBrowserDialogComponent {
3833
3841
  constructor() {
3842
+ this.unsubscribe = new Subject();
3834
3843
  this.clipperBrowser = viewChild.required('clipperBrowser');
3835
- this.changeDetector = inject(ChangeDetectorRef);
3836
3844
  this.clipperService = inject(ClipperService);
3845
+ this.changeDetector = inject(ChangeDetectorRef);
3837
3846
  this.dialogData = inject(MAT_DIALOG_DATA);
3838
3847
  this.dialogRef = inject((MatDialogRef));
3839
3848
  this.broadcastService = inject(BroadcastService);
3840
3849
  }
3850
+ ngOnInit() {
3851
+ this.broadcastService.getMessage()
3852
+ .pipe(takeUntil(this.unsubscribe))
3853
+ .subscribe(message => {
3854
+ if (message.id === ClipperMessages.DOCUMENT_SELECTED_INNER) {
3855
+ const document = this.clipperBrowser().getSnapshotDocument(message.data.documentId || message.data.id);
3856
+ if (document) {
3857
+ this.broadcastService.sendMessage(ClipperMessages.DOCUMENT_SELECTED, document);
3858
+ this.changeDetector.markForCheck();
3859
+ this.dialogRef.close();
3860
+ }
3861
+ }
3862
+ });
3863
+ }
3841
3864
  /**
3842
3865
  * Checks if documents can be selected and returned as message
3843
3866
  */