@hmcts/ccd-case-ui-toolkit 7.4.17-exceljs-update → 7.4.18-broken-access

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.
@@ -14874,7 +14874,7 @@ class CaseFileViewFieldComponent {
14874
14874
  }
14875
14875
  setMediaViewerFile(document) {
14876
14876
  const documentDetails = {
14877
- document_binary_url: document.document_binary_url,
14877
+ document_binary_url: this.withLegacyDocumentAccessContext(this.documentManagementService.getDocumentBinaryUrl(document)),
14878
14878
  document_filename: document.document_filename,
14879
14879
  content_type: document.content_type
14880
14880
  };
@@ -14889,6 +14889,19 @@ class CaseFileViewFieldComponent {
14889
14889
  const mediaViewerInfo = this.documentManagementService.getMediaViewerInfo(documentDetails);
14890
14890
  this.currentDocument = JSON.parse(mediaViewerInfo);
14891
14891
  }
14892
+ withLegacyDocumentAccessContext(documentBinaryUrl) {
14893
+ if (!documentBinaryUrl || !this.caseId) {
14894
+ return documentBinaryUrl;
14895
+ }
14896
+ const [path, query = ''] = documentBinaryUrl.split('?');
14897
+ if (!/^\/documents\/[^/]+\/binary\/?$/.test(path)) {
14898
+ return documentBinaryUrl;
14899
+ }
14900
+ // XUI validates legacy document access against the case before proxying the binary request.
14901
+ const searchParams = new URLSearchParams(query);
14902
+ searchParams.set('caseId', this.caseId);
14903
+ return `${path}?${searchParams.toString()}`;
14904
+ }
14892
14905
  moveDocument(data) {
14893
14906
  const cid = this.route.snapshot.paramMap.get(CaseFileViewFieldComponent.PARAM_CASE_ID);
14894
14907
  const loadingToken = this.loadingService.register();
@@ -26674,7 +26687,18 @@ const richTextNodes = {
26674
26687
  }, 0]
26675
26688
  }
26676
26689
  };
26677
- const richTextSchema = new Schema({ nodes: richTextNodes, marks: marks });
26690
+ const richTextMarks = {
26691
+ ...marks,
26692
+ em: {
26693
+ ...marks.em,
26694
+ toDOM: () => ['i', 0]
26695
+ },
26696
+ strong: {
26697
+ ...marks.strong,
26698
+ toDOM: () => ['b', 0]
26699
+ }
26700
+ };
26701
+ const richTextSchema = new Schema({ nodes: richTextNodes, marks: richTextMarks });
26678
26702
  class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
26679
26703
  editorHost;
26680
26704
  editor;
@@ -27512,6 +27536,7 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
27512
27536
  this.removeUnsupportedMarkup(documentElement);
27513
27537
  this.normaliseDateRangeSpacing(documentElement);
27514
27538
  this.removeUnsupportedAttributes(documentElement);
27539
+ this.normaliseDocmosisInlineFormatting(documentElement);
27515
27540
  const hasMeaningfulContent = this.hasMeaningfulRichTextContent(documentElement);
27516
27541
  if (hasMeaningfulContent) {
27517
27542
  this.preserveDocmosisBlankParagraphs(documentElement);
@@ -27537,6 +27562,7 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
27537
27562
  this.removeUnsupportedMarkup(documentElement);
27538
27563
  this.normaliseDateRangeSpacing(documentElement);
27539
27564
  this.removeUnsupportedAttributes(documentElement);
27565
+ this.normaliseDocmosisInlineFormatting(documentElement);
27540
27566
  const hasMeaningfulContent = this.hasMeaningfulRichTextContent(documentElement);
27541
27567
  if (hasMeaningfulContent) {
27542
27568
  this.preserveDocmosisBlankParagraphs(documentElement);
@@ -27553,6 +27579,24 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
27553
27579
  preserveDocmosisBlankParagraphs(documentElement) {
27554
27580
  this.replaceBlankParagraphContent(documentElement, '\u00a0');
27555
27581
  }
27582
+ /**
27583
+ * Uses the presentational tags supported by Docmosis while continuing to
27584
+ * accept the equivalent semantic tags when existing content is loaded.
27585
+ */
27586
+ normaliseDocmosisInlineFormatting(documentElement) {
27587
+ this.replaceElements(documentElement, 'strong', 'b');
27588
+ this.replaceElements(documentElement, 'em', 'i');
27589
+ }
27590
+ replaceElements(documentElement, sourceTag, targetTag) {
27591
+ const elements = Array.prototype.slice.call(documentElement.body.querySelectorAll(sourceTag));
27592
+ elements.forEach((element) => {
27593
+ const replacement = documentElement.createElement(targetTag);
27594
+ while (element.firstChild) {
27595
+ replacement.appendChild(element.firstChild);
27596
+ }
27597
+ element.replaceWith(replacement);
27598
+ });
27599
+ }
27556
27600
  hasMeaningfulRichTextContent(documentElement) {
27557
27601
  const visibleText = (documentElement.body.textContent || '')
27558
27602
  .replace(/[\s\u00a0\u200b-\u200d\ufeff]/g, '');
@@ -29288,7 +29332,7 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
29288
29332
  type: ViewChild,
29289
29333
  args: ['editorHost']
29290
29334
  }] }); })();
29291
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(WriteRichTextAreaFieldComponent, { className: "WriteRichTextAreaFieldComponent", filePath: "lib/shared/components/palette/rich-text-area/write-rich-text-area-field.component.ts", lineNumber: 139 }); })();
29335
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(WriteRichTextAreaFieldComponent, { className: "WriteRichTextAreaFieldComponent", filePath: "lib/shared/components/palette/rich-text-area/write-rich-text-area-field.component.ts", lineNumber: 151 }); })();
29292
29336
 
29293
29337
  class ReadTextFieldComponent extends AbstractFieldReadComponent {
29294
29338
  static ɵfac = /*@__PURE__*/ (() => { let ɵReadTextFieldComponent_BaseFactory; return function ReadTextFieldComponent_Factory(__ngFactoryType__) { return (ɵReadTextFieldComponent_BaseFactory || (ɵReadTextFieldComponent_BaseFactory = i0.ɵɵgetInheritedFactory(ReadTextFieldComponent)))(__ngFactoryType__ || ReadTextFieldComponent); }; })();