@orangelogic/design-system 3.54.0 → 3.55.0

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.
@@ -95064,26 +95064,34 @@ var WTe = [
95064
95064
  let n = `${e}_${this.mappedDefaultLanguage}`;
95065
95065
  return t.getRecords().some((e) => String(e.id).toLowerCase() === n);
95066
95066
  }
95067
+ canBackfillDefaultLanguageTextRecord(e) {
95068
+ let t = this.dsm?.get(Qi.TranslatableTexts);
95069
+ if (!t) return !0;
95070
+ let n = `${e}_${this.mappedDefaultLanguage}`, r = t.getRecords().find((e) => String(e.id).toLowerCase() === n);
95071
+ return !r || r.get("isAutoBackfilled") === !0;
95072
+ }
95067
95073
  hasDefaultLanguageAttributeRecord(e) {
95068
95074
  let t = this.dsm?.get(Qi.TranslatableAttributes);
95069
95075
  if (!t) return !1;
95070
95076
  let n = `${e}_${this.mappedDefaultLanguage}`;
95071
95077
  return t.getRecords().some((e) => String(e.id).toLowerCase() === n);
95072
95078
  }
95073
- storeTranslatableText(e, t) {
95079
+ storeTranslatableText(e, t, n = {}) {
95074
95080
  if (!this.dsm) return;
95075
- let n = this.dsm.get(Qi.TranslatableTexts);
95076
- if (n) {
95077
- let r = n.getRecords().find((t) => t.id === e);
95078
- r ? r.set("content", t) : n.addRecord({
95081
+ let r = this.dsm.get(Qi.TranslatableTexts);
95082
+ if (r) {
95083
+ let i = r.getRecords().find((t) => t.id === e);
95084
+ i ? (i.set("content", t), n.isAutoBackfilled === !0 ? i.set("isAutoBackfilled", !0) : n.isAutoBackfilled === !1 && i.unset("isAutoBackfilled")) : r.addRecord({
95079
95085
  content: t,
95080
- id: e
95086
+ id: e,
95087
+ ...n.isAutoBackfilled === !0 ? { isAutoBackfilled: !0 } : {}
95081
95088
  });
95082
95089
  } else this.dsm.add({
95083
95090
  id: Qi.TranslatableTexts,
95084
95091
  records: [{
95085
95092
  content: t,
95086
- id: e
95093
+ id: e,
95094
+ ...n.isAutoBackfilled === !0 ? { isAutoBackfilled: !0 } : {}
95087
95095
  }]
95088
95096
  });
95089
95097
  }
@@ -95783,9 +95791,11 @@ var WTe = [
95783
95791
  }), this.contentBuilder?.on("custom:child-selected", (e) => {
95784
95792
  this.childSelected = e;
95785
95793
  }), this.contentBuilder?.on("custom:backfill-translatable-text", ({ content: e, id: t }) => {
95786
- t && this.mappedDefaultLanguage && this.lang.toLowerCase() !== this.mappedDefaultLanguage && !this.hasDefaultLanguageTextRecord(t) && this.storeTranslatableText(`${t}_${this.mappedDefaultLanguage}`, e);
95794
+ t && this.mappedDefaultLanguage && this.lang.toLowerCase() !== this.mappedDefaultLanguage && !this.hasDefaultLanguageTextRecord(t) && this.storeTranslatableText(`${t}_${this.mappedDefaultLanguage}`, e, { isAutoBackfilled: !0 });
95787
95795
  }), this.contentBuilder?.on("custom:save-translatable-text", ({ content: e, id: t }) => {
95788
- t && this.storeTranslatableText(`${t}_${this.lang.toLowerCase()}`, e);
95796
+ if (!t) return;
95797
+ let n = this.lang.toLowerCase();
95798
+ this.storeTranslatableText(`${t}_${n}`, e, n === this.mappedDefaultLanguage ? { isAutoBackfilled: !1 } : void 0), n !== this.mappedDefaultLanguage && this.canBackfillDefaultLanguageTextRecord(t) && this.storeTranslatableText(`${t}_${this.mappedDefaultLanguage}`, e, { isAutoBackfilled: !0 });
95789
95799
  }), this.contentBuilder?.on("custom:save-translatable-attribute", ({ content: e, id: t }) => {
95790
95800
  t && this.storeTranslatableAttribute(t, e);
95791
95801
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orangelogic/design-system",
3
3
  "type": "module",
4
- "version": "3.54.0",
4
+ "version": "3.55.0",
5
5
  "license": "UNLICENSED",
6
6
  "types": "library/types.d.ts",
7
7
  "scripts": {
@@ -10,6 +10,9 @@ import { TemplateResult } from 'lit';
10
10
  import { CxBlockPicker } from './components/block-picker';
11
11
  import { CxConfigManager } from './components/config-manager';
12
12
  import { CxRTEBubbleMenu, CxRTETableGenerator } from './plugins';
13
+ type TranslatableTextRecordOptions = {
14
+ isAutoBackfilled?: boolean;
15
+ };
13
16
  /**
14
17
  * @summary The `cx-content-builder` component is used to create and manage content blocks in a CMS.
15
18
  *
@@ -304,8 +307,9 @@ export default class CxContentBuilder extends CortexElement {
304
307
  private ensureConfigUi;
305
308
  storeTemplate(id: string, data: Record<string, any>, update?: boolean): void;
306
309
  private hasDefaultLanguageTextRecord;
310
+ private canBackfillDefaultLanguageTextRecord;
307
311
  private hasDefaultLanguageAttributeRecord;
308
- storeTranslatableText(id: string, data: string): void;
312
+ storeTranslatableText(id: string, data: string, options?: TranslatableTextRecordOptions): void;
309
313
  storeTranslatableAttribute(id: string, data: Record<string, Record<string, string>>): void;
310
314
  private updateFrameSize;
311
315
  handleSupportedLanguagesChange(): void;
@@ -574,3 +578,4 @@ declare global {
574
578
  'cx-content-builder': CxContentBuilder;
575
579
  }
576
580
  }
581
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orangelogic/design-system",
3
3
  "type": "module",
4
- "version": "3.54.0",
4
+ "version": "3.55.0",
5
5
  "license": "UNLICENSED",
6
6
  "types": "library/types.d.ts",
7
7
  "scripts": {