@hmcts/ccd-case-ui-toolkit 7.4.13-hdpi-8362 → 7.4.14-5337-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.
@@ -15975,13 +15975,16 @@ class WriteCaseFlagFieldComponent extends AbstractFieldWriteJourneyComponent {
15975
15975
  if (!this.selectedFlag.originalStatus) {
15976
15976
  this.selectedFlag.originalStatus = flagDetailToUpdate.value?.status;
15977
15977
  }
15978
- // If the description FormControls don't exist, it means these fields weren't visited as part of the "Update Flag"
15979
- // journey, so do *not* update their values (otherwise they will become undefined)
15980
- if (this.caseFlagParentFormGroup.get(CaseFlagFormFields.OTHER_FLAG_DESCRIPTION)) {
15981
- flagDetailToUpdate.value.otherDescription = this.caseFlagParentFormGroup.get(CaseFlagFormFields.OTHER_FLAG_DESCRIPTION).value;
15982
- }
15983
- if (this.caseFlagParentFormGroup.get(CaseFlagFormFields.OTHER_FLAG_DESCRIPTION_WELSH)) {
15984
- flagDetailToUpdate.value.otherDescription_cy = this.caseFlagParentFormGroup.get(CaseFlagFormFields.OTHER_FLAG_DESCRIPTION_WELSH).value;
15978
+ // Update description fields only if flag type is "Other" (flag code OT0001); these fields apply only to that flag type
15979
+ // If their FormControls don't exist, it means these fields weren't visited as part of the "Update Flag" journey, so do
15980
+ // *not* update their values (otherwise they will become undefined)
15981
+ if (flagDetailToUpdate.value?.flagCode === this.otherFlagTypeCode) {
15982
+ if (this.caseFlagParentFormGroup.get(CaseFlagFormFields.OTHER_FLAG_DESCRIPTION)) {
15983
+ flagDetailToUpdate.value.otherDescription = this.caseFlagParentFormGroup.get(CaseFlagFormFields.OTHER_FLAG_DESCRIPTION).value;
15984
+ }
15985
+ if (this.caseFlagParentFormGroup.get(CaseFlagFormFields.OTHER_FLAG_DESCRIPTION_WELSH)) {
15986
+ flagDetailToUpdate.value.otherDescription_cy = this.caseFlagParentFormGroup.get(CaseFlagFormFields.OTHER_FLAG_DESCRIPTION_WELSH).value;
15987
+ }
15985
15988
  }
15986
15989
  // Ensure that any comments entered with language set to Welsh do not end up in the English comments field
15987
15990
  if (this.rpxTranslationService.language !== 'cy') {
@@ -26649,7 +26652,18 @@ const richTextNodes = {
26649
26652
  }, 0]
26650
26653
  }
26651
26654
  };
26652
- 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 });
26653
26667
  class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
26654
26668
  editorHost;
26655
26669
  editor;
@@ -27487,6 +27501,7 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
27487
27501
  this.removeUnsupportedMarkup(documentElement);
27488
27502
  this.normaliseDateRangeSpacing(documentElement);
27489
27503
  this.removeUnsupportedAttributes(documentElement);
27504
+ this.normaliseDocmosisInlineFormatting(documentElement);
27490
27505
  const hasMeaningfulContent = this.hasMeaningfulRichTextContent(documentElement);
27491
27506
  if (hasMeaningfulContent) {
27492
27507
  this.preserveDocmosisBlankParagraphs(documentElement);
@@ -27512,6 +27527,7 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
27512
27527
  this.removeUnsupportedMarkup(documentElement);
27513
27528
  this.normaliseDateRangeSpacing(documentElement);
27514
27529
  this.removeUnsupportedAttributes(documentElement);
27530
+ this.normaliseDocmosisInlineFormatting(documentElement);
27515
27531
  const hasMeaningfulContent = this.hasMeaningfulRichTextContent(documentElement);
27516
27532
  if (hasMeaningfulContent) {
27517
27533
  this.preserveDocmosisBlankParagraphs(documentElement);
@@ -27528,6 +27544,24 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
27528
27544
  preserveDocmosisBlankParagraphs(documentElement) {
27529
27545
  this.replaceBlankParagraphContent(documentElement, '\u00a0');
27530
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
+ }
27531
27565
  hasMeaningfulRichTextContent(documentElement) {
27532
27566
  const visibleText = (documentElement.body.textContent || '')
27533
27567
  .replace(/[\s\u00a0\u200b-\u200d\ufeff]/g, '');
@@ -29263,7 +29297,7 @@ class WriteRichTextAreaFieldComponent extends AbstractFieldWriteComponent {
29263
29297
  type: ViewChild,
29264
29298
  args: ['editorHost']
29265
29299
  }] }); })();
29266
- (() => { (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 }); })();
29267
29301
 
29268
29302
  class ReadTextFieldComponent extends AbstractFieldReadComponent {
29269
29303
  static ɵfac = /*@__PURE__*/ (() => { let ɵReadTextFieldComponent_BaseFactory; return function ReadTextFieldComponent_Factory(__ngFactoryType__) { return (ɵReadTextFieldComponent_BaseFactory || (ɵReadTextFieldComponent_BaseFactory = i0.ɵɵgetInheritedFactory(ReadTextFieldComponent)))(__ngFactoryType__ || ReadTextFieldComponent); }; })();