@hmcts/ccd-case-ui-toolkit 7.4.16 → 7.4.17

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.
@@ -26674,7 +26674,18 @@ const richTextNodes = {
26674
26674
  }, 0]
26675
26675
  }
26676
26676
  };
26677
- const richTextSchema = new Schema({ nodes: richTextNodes, marks: marks });
26677
+ const richTextMarks = {
26678
+ ...marks,
26679
+ em: {
26680
+ ...marks.em,
26681
+ toDOM: () => ['i', 0]
26682
+ },
26683
+ strong: {
26684
+ ...marks.strong,
26685
+ toDOM: () => ['b', 0]
26686
+ }
26687
+ };
26688
+ const richTextSchema = new Schema({ nodes: richTextNodes, marks: richTextMarks });
26678
26689
  class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
26679
26690
  editorHost;
26680
26691
  editor;
@@ -27512,6 +27523,7 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
27512
27523
  this.removeUnsupportedMarkup(documentElement);
27513
27524
  this.normaliseDateRangeSpacing(documentElement);
27514
27525
  this.removeUnsupportedAttributes(documentElement);
27526
+ this.normaliseDocmosisInlineFormatting(documentElement);
27515
27527
  const hasMeaningfulContent = this.hasMeaningfulRichTextContent(documentElement);
27516
27528
  if (hasMeaningfulContent) {
27517
27529
  this.preserveDocmosisBlankParagraphs(documentElement);
@@ -27537,6 +27549,7 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
27537
27549
  this.removeUnsupportedMarkup(documentElement);
27538
27550
  this.normaliseDateRangeSpacing(documentElement);
27539
27551
  this.removeUnsupportedAttributes(documentElement);
27552
+ this.normaliseDocmosisInlineFormatting(documentElement);
27540
27553
  const hasMeaningfulContent = this.hasMeaningfulRichTextContent(documentElement);
27541
27554
  if (hasMeaningfulContent) {
27542
27555
  this.preserveDocmosisBlankParagraphs(documentElement);
@@ -27553,6 +27566,24 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
27553
27566
  preserveDocmosisBlankParagraphs(documentElement) {
27554
27567
  this.replaceBlankParagraphContent(documentElement, '\u00a0');
27555
27568
  }
27569
+ /**
27570
+ * Uses the presentational tags supported by Docmosis while continuing to
27571
+ * accept the equivalent semantic tags when existing content is loaded.
27572
+ */
27573
+ normaliseDocmosisInlineFormatting(documentElement) {
27574
+ this.replaceElements(documentElement, 'strong', 'b');
27575
+ this.replaceElements(documentElement, 'em', 'i');
27576
+ }
27577
+ replaceElements(documentElement, sourceTag, targetTag) {
27578
+ const elements = Array.prototype.slice.call(documentElement.body.querySelectorAll(sourceTag));
27579
+ elements.forEach((element) => {
27580
+ const replacement = documentElement.createElement(targetTag);
27581
+ while (element.firstChild) {
27582
+ replacement.appendChild(element.firstChild);
27583
+ }
27584
+ element.replaceWith(replacement);
27585
+ });
27586
+ }
27556
27587
  hasMeaningfulRichTextContent(documentElement) {
27557
27588
  const visibleText = (documentElement.body.textContent || '')
27558
27589
  .replace(/[\s\u00a0\u200b-\u200d\ufeff]/g, '');
@@ -29288,7 +29319,7 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
29288
29319
  type: ViewChild,
29289
29320
  args: ['editorHost']
29290
29321
  }] }); })();
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 }); })();
29322
+ (() => { (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
29323
 
29293
29324
  class ReadTextFieldComponent extends AbstractFieldReadComponent {
29294
29325
  static ɵfac = /*@__PURE__*/ (() => { let ɵReadTextFieldComponent_BaseFactory; return function ReadTextFieldComponent_Factory(__ngFactoryType__) { return (ɵReadTextFieldComponent_BaseFactory || (ɵReadTextFieldComponent_BaseFactory = i0.ɵɵgetInheritedFactory(ReadTextFieldComponent)))(__ngFactoryType__ || ReadTextFieldComponent); }; })();