@hmcts/media-viewer 4.2.40-redaction-save-issue → 4.2.40
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/install-state.gz +0 -0
- package/fesm2022/hmcts-media-viewer.mjs +14 -8
- package/fesm2022/hmcts-media-viewer.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/package.tgz +0 -0
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
|
@@ -1426,9 +1426,9 @@ function redactionReducer(state = initialRedactionState, action) {
|
|
|
1426
1426
|
}
|
|
1427
1427
|
case REDACT_SUCCESS: {
|
|
1428
1428
|
const redactedDocumentInfo = action.payload;
|
|
1429
|
-
// Markers persist on the backend, so keep them in state to stay consistent with a reload
|
|
1430
1429
|
return {
|
|
1431
1430
|
...state,
|
|
1431
|
+
...initialRedactionState,
|
|
1432
1432
|
redactedDocumentInfo
|
|
1433
1433
|
};
|
|
1434
1434
|
}
|
|
@@ -2065,8 +2065,8 @@ class HighlightCreateDirective {
|
|
|
2065
2065
|
}
|
|
2066
2066
|
this.setPageProperties(page);
|
|
2067
2067
|
const range = selection.getRangeAt(0).cloneRange();
|
|
2068
|
-
const
|
|
2069
|
-
if (!
|
|
2068
|
+
const selectionRects = this.getSelectionRectangles(range);
|
|
2069
|
+
if (!selectionRects || selectionRects.length === 0) {
|
|
2070
2070
|
return [];
|
|
2071
2071
|
}
|
|
2072
2072
|
let textLayerElement = range.startContainer;
|
|
@@ -2078,7 +2078,7 @@ class HighlightCreateDirective {
|
|
|
2078
2078
|
return [];
|
|
2079
2079
|
}
|
|
2080
2080
|
this.removeEnhancedTextModeStyling(textLayerElement);
|
|
2081
|
-
return this.processClientRects(
|
|
2081
|
+
return this.processClientRects(selectionRects, textLayer);
|
|
2082
2082
|
}
|
|
2083
2083
|
onPdfViewerClick(event) {
|
|
2084
2084
|
this.store.dispatch(new SelectedAnnotation({
|
|
@@ -2096,14 +2096,17 @@ class HighlightCreateDirective {
|
|
|
2096
2096
|
this.removeEnhancedTextModeStyling(localElement);
|
|
2097
2097
|
if (selection.rangeCount && !selection.isCollapsed) {
|
|
2098
2098
|
const range = selection.getRangeAt(0).cloneRange();
|
|
2099
|
-
const
|
|
2100
|
-
if (
|
|
2099
|
+
const selectionRects = this.getSelectionRectangles(range);
|
|
2100
|
+
if (selectionRects) {
|
|
2101
2101
|
const textLayer = localElement.closest(".textLayer");
|
|
2102
|
-
return this.processClientRects(
|
|
2102
|
+
return this.processClientRects(selectionRects, textLayer);
|
|
2103
2103
|
}
|
|
2104
2104
|
}
|
|
2105
2105
|
}
|
|
2106
2106
|
}
|
|
2107
|
+
getSelectionRectangles(range) {
|
|
2108
|
+
return range.getClientRects();
|
|
2109
|
+
}
|
|
2107
2110
|
createTextRectangle(rect, parentRect) {
|
|
2108
2111
|
const height = rect.bottom - rect.top;
|
|
2109
2112
|
const width = rect.right - rect.left;
|
|
@@ -2136,7 +2139,10 @@ class HighlightCreateDirective {
|
|
|
2136
2139
|
const selectionRectangles = [];
|
|
2137
2140
|
for (let i = 0; i < clientRects.length; i++) {
|
|
2138
2141
|
const selectionRectangle = this.createTextRectangle(clientRects[i], parentRect);
|
|
2139
|
-
const findSelectionRectangle = selectionRectangles.find((rect) => rect.width === selectionRectangle.width
|
|
2142
|
+
const findSelectionRectangle = selectionRectangles.find((rect) => rect.width === selectionRectangle.width
|
|
2143
|
+
&& rect.height === selectionRectangle.height
|
|
2144
|
+
&& rect.x === selectionRectangle.x
|
|
2145
|
+
&& rect.y === selectionRectangle.y);
|
|
2140
2146
|
if (!findSelectionRectangle) {
|
|
2141
2147
|
selectionRectangles.push(selectionRectangle);
|
|
2142
2148
|
}
|