@hmcts/media-viewer 4.2.39 → 4.2.40-exui-4316-rc1
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/.yarn/cache/engine.io-client-npm-6.6.7-505818a2b5-18201a4109.zip +0 -0
- package/.yarn/cache/moment-timezone-npm-0.6.5-1746b59ce3-2ab437fa7a.zip +0 -0
- package/.yarn/cache/socket.io-client-npm-4.8.4-cb678c2836-9b39697b00.zip +0 -0
- package/.yarn/install-state.gz +0 -0
- package/fesm2022/hmcts-media-viewer.mjs +38 -13
- package/fesm2022/hmcts-media-viewer.mjs.map +1 -1
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/package.tgz +0 -0
- package/.yarn/cache/engine.io-client-npm-6.6.6-fd14f4b531-9fe1af84a1.zip +0 -0
- package/.yarn/cache/moment-timezone-npm-0.6.4-78ea3bd92a-efa60fc46c.zip +0 -0
- package/.yarn/cache/socket.io-client-npm-4.8.3-6800638250-ee83c08cb3.zip +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
|
@@ -19,7 +19,6 @@ import * as pdfjsViewer from 'pdfjs-dist/web/pdf_viewer.mjs';
|
|
|
19
19
|
import { PDFLinkService } from 'pdfjs-dist/web/pdf_viewer.mjs';
|
|
20
20
|
import * as pdfjs from 'pdfjs-dist';
|
|
21
21
|
import 'pdfjs-dist/build/pdf.worker';
|
|
22
|
-
import { some } from 'lodash';
|
|
23
22
|
import * as i4$1 from 'ngx-chips';
|
|
24
23
|
import { TagInputModule } from 'ngx-chips';
|
|
25
24
|
import * as i3 from '@angular/router';
|
|
@@ -2065,8 +2064,8 @@ class HighlightCreateDirective {
|
|
|
2065
2064
|
}
|
|
2066
2065
|
this.setPageProperties(page);
|
|
2067
2066
|
const range = selection.getRangeAt(0).cloneRange();
|
|
2068
|
-
const
|
|
2069
|
-
if (!
|
|
2067
|
+
const selectionRects = this.getSelectionRectangles(range);
|
|
2068
|
+
if (!selectionRects || selectionRects.length === 0) {
|
|
2070
2069
|
return [];
|
|
2071
2070
|
}
|
|
2072
2071
|
let textLayerElement = range.startContainer;
|
|
@@ -2078,7 +2077,7 @@ class HighlightCreateDirective {
|
|
|
2078
2077
|
return [];
|
|
2079
2078
|
}
|
|
2080
2079
|
this.removeEnhancedTextModeStyling(textLayerElement);
|
|
2081
|
-
return this.processClientRects(
|
|
2080
|
+
return this.processClientRects(selectionRects, textLayer);
|
|
2082
2081
|
}
|
|
2083
2082
|
onPdfViewerClick(event) {
|
|
2084
2083
|
this.store.dispatch(new SelectedAnnotation({
|
|
@@ -2096,14 +2095,17 @@ class HighlightCreateDirective {
|
|
|
2096
2095
|
this.removeEnhancedTextModeStyling(localElement);
|
|
2097
2096
|
if (selection.rangeCount && !selection.isCollapsed) {
|
|
2098
2097
|
const range = selection.getRangeAt(0).cloneRange();
|
|
2099
|
-
const
|
|
2100
|
-
if (
|
|
2098
|
+
const selectionRects = this.getSelectionRectangles(range);
|
|
2099
|
+
if (selectionRects) {
|
|
2101
2100
|
const textLayer = localElement.closest(".textLayer");
|
|
2102
|
-
return this.processClientRects(
|
|
2101
|
+
return this.processClientRects(selectionRects, textLayer);
|
|
2103
2102
|
}
|
|
2104
2103
|
}
|
|
2105
2104
|
}
|
|
2106
2105
|
}
|
|
2106
|
+
getSelectionRectangles(range) {
|
|
2107
|
+
return range.getClientRects();
|
|
2108
|
+
}
|
|
2107
2109
|
createTextRectangle(rect, parentRect) {
|
|
2108
2110
|
const height = rect.bottom - rect.top;
|
|
2109
2111
|
const width = rect.right - rect.left;
|
|
@@ -2136,7 +2138,10 @@ class HighlightCreateDirective {
|
|
|
2136
2138
|
const selectionRectangles = [];
|
|
2137
2139
|
for (let i = 0; i < clientRects.length; i++) {
|
|
2138
2140
|
const selectionRectangle = this.createTextRectangle(clientRects[i], parentRect);
|
|
2139
|
-
const findSelectionRectangle = selectionRectangles.find((rect) => rect.width === selectionRectangle.width
|
|
2141
|
+
const findSelectionRectangle = selectionRectangles.find((rect) => rect.width === selectionRectangle.width
|
|
2142
|
+
&& rect.height === selectionRectangle.height
|
|
2143
|
+
&& rect.x === selectionRectangle.x
|
|
2144
|
+
&& rect.y === selectionRectangle.y);
|
|
2140
2145
|
if (!findSelectionRectangle) {
|
|
2141
2146
|
selectionRectangles.push(selectionRectangle);
|
|
2142
2147
|
}
|
|
@@ -3152,7 +3157,8 @@ class RedactionSearchBarComponent {
|
|
|
3152
3157
|
const selectedHighLightedElements = document.getElementsByClassName('highlight selected');
|
|
3153
3158
|
if (selectedHighLightedElements && selectedHighLightedElements.length > 0) {
|
|
3154
3159
|
const docRange = document.createRange();
|
|
3155
|
-
|
|
3160
|
+
const isMultiElementHighlight = Array.from(selectedHighLightedElements).some(element => element.classList?.contains('begin') || element.classList?.contains('end'));
|
|
3161
|
+
if (isMultiElementHighlight) {
|
|
3156
3162
|
docRange.setStart(selectedHighLightedElements[0], 0);
|
|
3157
3163
|
const endNode = selectedHighLightedElements[selectedHighLightedElements.length - 1];
|
|
3158
3164
|
docRange.setEnd(endNode, endNode.childNodes.length);
|
|
@@ -3170,8 +3176,14 @@ class RedactionSearchBarComponent {
|
|
|
3170
3176
|
const parentRect = HtmlTemplatesHelper.getAdjustedBoundingRect(selectedHighLightedElements[0]?.parentElement?.parentElement);
|
|
3171
3177
|
const selectionRectangles = [];
|
|
3172
3178
|
for (let i = 0; i < clientRects.length; i++) {
|
|
3179
|
+
if (clientRects[i].width <= 0 || clientRects[i].height <= 0) {
|
|
3180
|
+
continue;
|
|
3181
|
+
}
|
|
3173
3182
|
const selectionRectangle = this.createTextRectangle(clientRects[i], parentRect);
|
|
3174
|
-
const findSelecttionRectangle = selectionRectangles.find((rect) => rect.width === selectionRectangle.width
|
|
3183
|
+
const findSelecttionRectangle = selectionRectangles.find((rect) => rect.width === selectionRectangle.width
|
|
3184
|
+
&& rect.height === selectionRectangle.height
|
|
3185
|
+
&& rect.x === selectionRectangle.x
|
|
3186
|
+
&& rect.y === selectionRectangle.y);
|
|
3175
3187
|
if (!findSelecttionRectangle) {
|
|
3176
3188
|
selectionRectangles.push(selectionRectangle);
|
|
3177
3189
|
}
|
|
@@ -4785,7 +4797,12 @@ class KeyboardBoxMoveDirective {
|
|
|
4785
4797
|
element.dispatchEvent(stoppedEvent);
|
|
4786
4798
|
if (wasFocused) {
|
|
4787
4799
|
setTimeout(() => {
|
|
4788
|
-
|
|
4800
|
+
try {
|
|
4801
|
+
element.focus({ preventScroll: true });
|
|
4802
|
+
}
|
|
4803
|
+
catch {
|
|
4804
|
+
element.focus();
|
|
4805
|
+
}
|
|
4789
4806
|
}, 50);
|
|
4790
4807
|
}
|
|
4791
4808
|
}
|
|
@@ -4850,7 +4867,7 @@ class RectangleComponent {
|
|
|
4850
4867
|
this.subscriptions.push(this.toolbarEvents.grabNDrag.subscribe(grabNDrag => this.enableGrabNDrag = grabNDrag));
|
|
4851
4868
|
setTimeout(() => this.updateMovementBounds(), 0);
|
|
4852
4869
|
if (this._selected && this.viewRect) {
|
|
4853
|
-
this.
|
|
4870
|
+
this.focusWithoutScrolling();
|
|
4854
4871
|
}
|
|
4855
4872
|
}
|
|
4856
4873
|
ngOnDestroy() {
|
|
@@ -4860,7 +4877,7 @@ class RectangleComponent {
|
|
|
4860
4877
|
set selected(selected) {
|
|
4861
4878
|
this._selected = selected;
|
|
4862
4879
|
if (this._selected && this.viewRect) {
|
|
4863
|
-
this.
|
|
4880
|
+
this.focusWithoutScrolling();
|
|
4864
4881
|
}
|
|
4865
4882
|
}
|
|
4866
4883
|
get selected() {
|
|
@@ -4930,6 +4947,14 @@ class RectangleComponent {
|
|
|
4930
4947
|
}
|
|
4931
4948
|
this.tabToToolbar.emit(event);
|
|
4932
4949
|
}
|
|
4950
|
+
focusWithoutScrolling() {
|
|
4951
|
+
try {
|
|
4952
|
+
this.viewRect.nativeElement.focus({ preventScroll: true });
|
|
4953
|
+
}
|
|
4954
|
+
catch {
|
|
4955
|
+
this.viewRect.nativeElement.focus();
|
|
4956
|
+
}
|
|
4957
|
+
}
|
|
4933
4958
|
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.31", ngImport: i0, type: RectangleComponent, deps: [{ token: ToolbarEventService }, { token: HighlightCreateService }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4934
4959
|
/** @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: i4.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i4$2.DraggableElementDirective, selector: "[draggable]", inputs: ["rotate"], outputs: ["coordinates", "stopped"] }, { kind: "directive", type: i4$2.ResizableElementDirective, selector: "[resizable]", inputs: ["rotate", "selected"], outputs: ["stopped"] }, { kind: "directive", type: KeyboardBoxMoveDirective, selector: "[mvKeyboardBoxMove]", inputs: ["enabled", "incrementSmall", "incrementLarge", "movementBounds"], outputs: ["keyboardMovingChange", "boxDelete"] }] }); }
|
|
4935
4960
|
}
|