@hmcts/ccd-case-ui-toolkit 7.4.13 → 7.4.14-5337-rc2

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.
@@ -26652,7 +26652,18 @@ const richTextNodes = {
26652
26652
  }, 0]
26653
26653
  }
26654
26654
  };
26655
- const richTextSchema = new Schema({ nodes: richTextNodes, marks: marks });
26655
+ const richTextMarks = {
26656
+ ...marks,
26657
+ em: {
26658
+ ...marks.em,
26659
+ toDOM: () => ['i', 0]
26660
+ },
26661
+ strong: {
26662
+ ...marks.strong,
26663
+ toDOM: () => ['b', 0]
26664
+ }
26665
+ };
26666
+ const richTextSchema = new Schema({ nodes: richTextNodes, marks: richTextMarks });
26656
26667
  class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
26657
26668
  editorHost;
26658
26669
  editor;
@@ -27490,6 +27501,7 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
27490
27501
  this.removeUnsupportedMarkup(documentElement);
27491
27502
  this.normaliseDateRangeSpacing(documentElement);
27492
27503
  this.removeUnsupportedAttributes(documentElement);
27504
+ this.normaliseDocmosisInlineFormatting(documentElement);
27493
27505
  const hasMeaningfulContent = this.hasMeaningfulRichTextContent(documentElement);
27494
27506
  if (hasMeaningfulContent) {
27495
27507
  this.preserveDocmosisBlankParagraphs(documentElement);
@@ -27515,6 +27527,7 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
27515
27527
  this.removeUnsupportedMarkup(documentElement);
27516
27528
  this.normaliseDateRangeSpacing(documentElement);
27517
27529
  this.removeUnsupportedAttributes(documentElement);
27530
+ this.normaliseDocmosisInlineFormatting(documentElement);
27518
27531
  const hasMeaningfulContent = this.hasMeaningfulRichTextContent(documentElement);
27519
27532
  if (hasMeaningfulContent) {
27520
27533
  this.preserveDocmosisBlankParagraphs(documentElement);
@@ -27531,6 +27544,24 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
27531
27544
  preserveDocmosisBlankParagraphs(documentElement) {
27532
27545
  this.replaceBlankParagraphContent(documentElement, '\u00a0');
27533
27546
  }
27547
+ /**
27548
+ * Uses the presentational tags supported by Docmosis while continuing to
27549
+ * accept the equivalent semantic tags when existing content is loaded.
27550
+ */
27551
+ normaliseDocmosisInlineFormatting(documentElement) {
27552
+ this.replaceElements(documentElement, 'strong', 'b');
27553
+ this.replaceElements(documentElement, 'em', 'i');
27554
+ }
27555
+ replaceElements(documentElement, sourceTag, targetTag) {
27556
+ const elements = Array.prototype.slice.call(documentElement.body.querySelectorAll(sourceTag));
27557
+ elements.forEach((element) => {
27558
+ const replacement = documentElement.createElement(targetTag);
27559
+ while (element.firstChild) {
27560
+ replacement.appendChild(element.firstChild);
27561
+ }
27562
+ element.replaceWith(replacement);
27563
+ });
27564
+ }
27534
27565
  hasMeaningfulRichTextContent(documentElement) {
27535
27566
  const visibleText = (documentElement.body.textContent || '')
27536
27567
  .replace(/[\s\u00a0\u200b-\u200d\ufeff]/g, '');
@@ -29266,7 +29297,7 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
29266
29297
  type: ViewChild,
29267
29298
  args: ['editorHost']
29268
29299
  }] }); })();
29269
- (() => { (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 }); })();
29300
+ (() => { (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 }); })();
29270
29301
 
29271
29302
  class ReadTextFieldComponent extends AbstractFieldReadComponent {
29272
29303
  static ɵfac = /*@__PURE__*/ (() => { let ɵReadTextFieldComponent_BaseFactory; return function ReadTextFieldComponent_Factory(__ngFactoryType__) { return (ɵReadTextFieldComponent_BaseFactory || (ɵReadTextFieldComponent_BaseFactory = i0.ɵɵgetInheritedFactory(ReadTextFieldComponent)))(__ngFactoryType__ || ReadTextFieldComponent); }; })();