@cntrl-site/sdk-nextjs 0.8.7 → 0.8.9

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.
@@ -0,0 +1,15 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="HtmlUnknownAttribute" enabled="true" level="WARNING" enabled_by_default="true">
5
+ <option name="myValues">
6
+ <value>
7
+ <list size="1">
8
+ <item index="0" class="java.lang.String" itemvalue="jsx" />
9
+ </list>
10
+ </value>
11
+ </option>
12
+ <option name="myCustomValuesEnabled" value="true" />
13
+ </inspection_tool>
14
+ </profile>
15
+ </component>
Binary file
Binary file
@@ -153,7 +153,7 @@ class RichTextConverter {
153
153
  }
154
154
  groupEntities(entities, styleGroups) {
155
155
  const entitiesGroups = [];
156
- if (!styleGroups)
156
+ if (!styleGroups || styleGroups.length === 0)
157
157
  return;
158
158
  if (entities.length === 0) {
159
159
  entitiesGroups.push({
@@ -238,7 +238,7 @@ function sliceSymbols(text, start, end = NaN) {
238
238
  }
239
239
  if (isNaN(startOffset))
240
240
  return '';
241
- return text.slice(startOffset, endOffset + 1);
241
+ return text.slice(startOffset, endOffset);
242
242
  }
243
243
  function getSymbolsCount(input) {
244
244
  let count = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cntrl-site/sdk-nextjs",
3
- "version": "0.8.7",
3
+ "version": "0.8.9",
4
4
  "description": "SDK for Next.js",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/index.js",
@@ -108,7 +108,11 @@ export class RichTextConverter {
108
108
  if (offset < style.start) {
109
109
  entityKids.push(sliceSymbols(content, offset, style.start));
110
110
  }
111
- entityKids.push(<span key={style.start} className={`s-${style.start}-${style.end}`}>{sliceSymbols(content, style.start, style.end)}</span>);
111
+ entityKids.push(
112
+ <span key={style.start} className={`s-${style.start}-${style.end}`}>
113
+ {sliceSymbols(content, style.start, style.end)}
114
+ </span>
115
+ );
112
116
  offset = style.end;
113
117
  }
114
118
  if (offset < entity.end) {
@@ -185,7 +189,7 @@ export class RichTextConverter {
185
189
 
186
190
  private groupEntities(entities: RichText.Entity[], styleGroups?: StyleGroup[]): EntitiesGroup[] | undefined {
187
191
  const entitiesGroups: EntitiesGroup[] = [];
188
- if (!styleGroups) return;
192
+ if (!styleGroups || styleGroups.length === 0) return;
189
193
  if (entities.length === 0) {
190
194
  entitiesGroups.push({
191
195
  stylesGroup: styleGroups,
@@ -271,7 +275,7 @@ function sliceSymbols(text: string, start: number, end: number = NaN): string {
271
275
  endOffset += ch.length;
272
276
  }
273
277
  if (isNaN(startOffset)) return '';
274
- return text.slice(startOffset, endOffset + 1);
278
+ return text.slice(startOffset, endOffset);
275
279
  }
276
280
 
277
281
  function getSymbolsCount(input: string): number {
Binary file
Binary file