@hmcts/media-viewer 4.2.46 → 4.2.48

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.
@@ -4796,7 +4796,12 @@ class KeyboardBoxMoveDirective {
4796
4796
  element.dispatchEvent(stoppedEvent);
4797
4797
  if (wasFocused) {
4798
4798
  setTimeout(() => {
4799
- element.focus();
4799
+ try {
4800
+ element.focus({ preventScroll: true });
4801
+ }
4802
+ catch {
4803
+ element.focus();
4804
+ }
4800
4805
  }, 50);
4801
4806
  }
4802
4807
  }
@@ -4861,7 +4866,7 @@ class RectangleComponent {
4861
4866
  this.subscriptions.push(this.toolbarEvents.grabNDrag.subscribe(grabNDrag => this.enableGrabNDrag = grabNDrag));
4862
4867
  setTimeout(() => this.updateMovementBounds(), 0);
4863
4868
  if (this._selected && this.viewRect) {
4864
- this.viewRect.nativeElement.focus();
4869
+ this.focusWithoutScrolling();
4865
4870
  }
4866
4871
  }
4867
4872
  ngOnDestroy() {
@@ -4871,7 +4876,7 @@ class RectangleComponent {
4871
4876
  set selected(selected) {
4872
4877
  this._selected = selected;
4873
4878
  if (this._selected && this.viewRect) {
4874
- this.viewRect.nativeElement.focus();
4879
+ this.focusWithoutScrolling();
4875
4880
  }
4876
4881
  }
4877
4882
  get selected() {
@@ -4941,6 +4946,14 @@ class RectangleComponent {
4941
4946
  }
4942
4947
  this.tabToToolbar.emit(event);
4943
4948
  }
4949
+ focusWithoutScrolling() {
4950
+ try {
4951
+ this.viewRect.nativeElement.focus({ preventScroll: true });
4952
+ }
4953
+ catch {
4954
+ this.viewRect.nativeElement.focus();
4955
+ }
4956
+ }
4944
4957
  /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.31", ngImport: i0, type: RectangleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4945
4958
  /** @nocollapse */ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.31", type: RectangleComponent, isStandalone: false, selector: "mv-anno-rectangle", inputs: { color: "color", zoom: "zoom", rotate: "rotate", editable: "editable", pageHeight: "pageHeight", pageWidth: "pageWidth", rectangleTabIndex: "rectangleTabIndex", annoRect: "annoRect", selected: "selected" }, outputs: { selectEvent: "selectEvent", updateEvent: "updateEvent", deleteEvent: "deleteEvent", keyboardMovingChange: "keyboardMovingChange", tabToToolbar: "tabToToolbar" }, viewQueries: [{ propertyName: "viewRect", first: true, predicate: ["rectElement"], descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div *ngIf=\"editable; else nonEditable\">\n <div #rectElement\n class=\"rectangle\"\n draggable\n resizable\n mvKeyboardBoxMove\n [tabindex]=\"rectangleTabIndex\"\n [ngClass]=\"{ 'selected': selected, 'grabNDrag': enableGrabNDrag }\"\n [style.backgroundColor]=\"'#' + color\"\n [style.width]=\"width + 'px'\"\n [style.height]=\"height + 'px'\"\n [style.left]=\"left + 'px'\"\n [style.top]=\"top + 'px'\"\n [rotate]=\"0\"\n [selected]=\"selected\"\n [movementBounds]=\"movementBounds\"\n (click)=\"onClick()\"\n (focus)=\"onFocus()\"\n (keydown.tab)=\"onTab($event)\"\n (stopped)=\"onUpdate(rectElement)\"\n (keyboardMovingChange)=\"onKeyboardMovingChange($event)\"\n (boxDelete)=\"onDelete()\">\n </div>\n</div>\n<ng-template #nonEditable>\n <div #rectElement\n class=\"rectangle\"\n mvKeyboardBoxMove\n [tabindex]=\"rectangleTabIndex\"\n [ngClass]=\"{ 'selected': selected }\"\n [style.backgroundColor]=\"'#' + color\"\n [style.width]=\"width + 'px'\"\n [style.height]=\"height+ 'px'\"\n [style.left]=\"left + 'px'\"\n [style.top]=\"top + 'px'\"\n [enabled]=\"false\"\n (click)=\"onClick()\"\n (focus)=\"onFocus()\"\n (keydown.tab)=\"onTab($event)\"\n (boxDelete)=\"onDelete()\">\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.DraggableElementDirective, selector: "[draggable]", inputs: ["rotate"], outputs: ["coordinates", "stopped"] }, { kind: "directive", type: i2$1.ResizableElementDirective, selector: "[resizable]", inputs: ["rotate", "selected"], outputs: ["stopped"] }, { kind: "directive", type: KeyboardBoxMoveDirective, selector: "[mvKeyboardBoxMove]", inputs: ["enabled", "incrementSmall", "incrementLarge", "movementBounds"], outputs: ["keyboardMovingChange", "boxDelete"] }] }); }
4946
4959
  }
@@ -8199,6 +8212,7 @@ class ConvertibleContentViewerComponent {
8199
8212
  }
8200
8213
  // todo move this to common place for media viewer and pdf
8201
8214
  extractDMStoreDocId(url) {
8215
+ url = url.split(/[?#]/)[0];
8202
8216
  if (url.includes('/documents/')) {
8203
8217
  url = url.split('/documents/')[1];
8204
8218
  }
@@ -8479,6 +8493,7 @@ class MediaViewerComponent {
8479
8493
  }
8480
8494
  // If secure mode is enabled (which adds "documentsv2" to the documentId), get rid of it
8481
8495
  extractDMStoreDocId(url) {
8496
+ url = url.split(/[?#]/)[0];
8482
8497
  url = url.includes('/documents/') ? url.split('/documents/')[1] : url;
8483
8498
  url = url.includes('/documentsv2/') ? url.split('/documentsv2/')[1] : url;
8484
8499
  return url.replace('/binary', '');