@cntrl-site/sdk-nextjs 0.21.3 → 0.21.5

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.
@@ -60,12 +60,11 @@ class RichTextConverter {
60
60
  const kids = [];
61
61
  layouts.forEach(l => {
62
62
  const ta = richText.layoutParams[l.id].textAlign;
63
- const whiteSpace = ta === sdk_1.TextAlign.Right ? 'normal' : 'pre-wrap';
64
63
  styleRules[l.id].push(`
65
64
  .${blockClass} {
66
65
  display: ${group.some(g => g.layout === l.id) ? 'block' : 'none'};
67
66
  text-align: ${ta};
68
- white-space: ${whiteSpace};
67
+ white-space: pre-wrap;
69
68
  overflow-wrap: break-word;
70
69
  }
71
70
  `);
@@ -169,6 +168,7 @@ class RichTextConverter {
169
168
  return styleGroups;
170
169
  }
171
170
  groupEntities(entitiesList, styleGroups) {
171
+ var _a, _b, _c, _d;
172
172
  const entitiesGroups = [];
173
173
  // some entities may have no data, need to filter them out (case with deleting a section/page that was linked to)
174
174
  const entities = entitiesList.filter(e => e.hasOwnProperty('data'));
@@ -186,7 +186,7 @@ class RichTextConverter {
186
186
  const end = dividers[i + 1];
187
187
  const entity = entities.find(e => e.start === start);
188
188
  entitiesGroups.push(Object.assign({ stylesGroup: [], start,
189
- end }, (entity && { link: entity.data.url, target: entity.data.target })));
189
+ end }, (entity && { link: (_b = (_a = entity.data) === null || _a === void 0 ? void 0 : _a.url) !== null && _b !== void 0 ? _b : '', target: (_d = (_c = entity.data) === null || _c === void 0 ? void 0 : _c.target) !== null && _d !== void 0 ? _d : '_self' })));
190
190
  }
191
191
  return entitiesGroups;
192
192
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk-nextjs",
3
- "version": "0.21.3",
3
+ "version": "0.21.5",
4
4
  "description": "SDK for Next.js",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/index.ts",
@@ -6,7 +6,6 @@ import {
6
6
  Layout,
7
7
  RichTextItem,
8
8
  VerticalAlign,
9
- TextAlign,
10
9
  RichTextStyle,
11
10
  RichTextEntity
12
11
  } from '@cntrl-site/sdk';
@@ -88,12 +87,11 @@ export class RichTextConverter {
88
87
  const kids: ReactNode[] = [];
89
88
  layouts.forEach(l => {
90
89
  const ta = richText.layoutParams[l.id].textAlign;
91
- const whiteSpace = ta === TextAlign.Right ? 'normal' : 'pre-wrap';
92
90
  styleRules[l.id].push(`
93
91
  .${blockClass} {
94
92
  display: ${group.some(g => g.layout === l.id) ? 'block' : 'none'};
95
93
  text-align: ${ta};
96
- white-space: ${whiteSpace};
94
+ white-space: pre-wrap;
97
95
  overflow-wrap: break-word;
98
96
  }
99
97
  `);
@@ -221,7 +219,7 @@ export class RichTextConverter {
221
219
  stylesGroup: [],
222
220
  start,
223
221
  end,
224
- ...(entity && { link: entity.data.url, target: entity.data.target })
222
+ ...(entity && { link: entity.data?.url ?? '', target: entity.data?.target ?? '_self' })
225
223
  });
226
224
  }
227
225
  return entitiesGroups;