@sitecore-content-sdk/react 2.2.0 → 2.2.1-canary.20260707071213
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.
|
@@ -22,6 +22,7 @@ const withFieldMetadata_1 = require("../enhancers/withFieldMetadata");
|
|
|
22
22
|
const withEmptyFieldEditingComponent_1 = require("../enhancers/withEmptyFieldEditingComponent");
|
|
23
23
|
const DefaultEmptyFieldEditingComponents_1 = require("./DefaultEmptyFieldEditingComponents");
|
|
24
24
|
const TextComponent = (_a) => {
|
|
25
|
+
var _b;
|
|
25
26
|
var { field, tag, editable = true, encode = true } = _a, otherProps = __rest(_a, ["field", "tag", "editable", "encode"]);
|
|
26
27
|
if ((0, layout_1.isFieldValueEmpty)(field)) {
|
|
27
28
|
return null;
|
|
@@ -31,28 +32,29 @@ const TextComponent = (_a) => {
|
|
|
31
32
|
// eslint-disable-next-line no-param-reassign, no-unused-vars
|
|
32
33
|
editable = false;
|
|
33
34
|
}
|
|
34
|
-
|
|
35
|
-
// when string value isn't formatted, we should format line breaks
|
|
36
|
-
const splitted = String(output).split('\n');
|
|
37
|
-
if (splitted.length) {
|
|
38
|
-
const formatted = [];
|
|
39
|
-
splitted.forEach((str, i) => {
|
|
40
|
-
const isLast = i === splitted.length - 1;
|
|
41
|
-
formatted.push(str);
|
|
42
|
-
if (!isLast) {
|
|
43
|
-
formatted.push(react_1.default.createElement("br", { key: i }));
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
output = formatted;
|
|
47
|
-
}
|
|
35
|
+
const value = (_b = field.value) !== null && _b !== void 0 ? _b : '';
|
|
48
36
|
let children = null;
|
|
49
37
|
const htmlProps = Object.assign({}, otherProps);
|
|
50
38
|
if (!encode) {
|
|
51
39
|
htmlProps.dangerouslySetInnerHTML = {
|
|
52
|
-
__html:
|
|
40
|
+
__html: String(value).split('\n').join('<br>'),
|
|
53
41
|
};
|
|
54
42
|
}
|
|
55
43
|
else {
|
|
44
|
+
let output = value;
|
|
45
|
+
// when string value isn't formatted, we should format line breaks
|
|
46
|
+
const splitted = String(output).split('\n');
|
|
47
|
+
if (splitted.length) {
|
|
48
|
+
const formatted = [];
|
|
49
|
+
splitted.forEach((str, i) => {
|
|
50
|
+
const isLast = i === splitted.length - 1;
|
|
51
|
+
formatted.push(str);
|
|
52
|
+
if (!isLast) {
|
|
53
|
+
formatted.push(react_1.default.createElement("br", { key: i }));
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
output = formatted;
|
|
57
|
+
}
|
|
56
58
|
children = output;
|
|
57
59
|
}
|
|
58
60
|
const Tag = (tag || 'span');
|
|
@@ -16,6 +16,7 @@ import { withFieldMetadata } from '../enhancers/withFieldMetadata';
|
|
|
16
16
|
import { withEmptyFieldEditingComponent } from '../enhancers/withEmptyFieldEditingComponent';
|
|
17
17
|
import { DefaultEmptyFieldEditingComponentText } from './DefaultEmptyFieldEditingComponents';
|
|
18
18
|
const TextComponent = (_a) => {
|
|
19
|
+
var _b;
|
|
19
20
|
var { field, tag, editable = true, encode = true } = _a, otherProps = __rest(_a, ["field", "tag", "editable", "encode"]);
|
|
20
21
|
if (isFieldValueEmpty(field)) {
|
|
21
22
|
return null;
|
|
@@ -25,28 +26,29 @@ const TextComponent = (_a) => {
|
|
|
25
26
|
// eslint-disable-next-line no-param-reassign, no-unused-vars
|
|
26
27
|
editable = false;
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
-
// when string value isn't formatted, we should format line breaks
|
|
30
|
-
const splitted = String(output).split('\n');
|
|
31
|
-
if (splitted.length) {
|
|
32
|
-
const formatted = [];
|
|
33
|
-
splitted.forEach((str, i) => {
|
|
34
|
-
const isLast = i === splitted.length - 1;
|
|
35
|
-
formatted.push(str);
|
|
36
|
-
if (!isLast) {
|
|
37
|
-
formatted.push(React.createElement("br", { key: i }));
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
output = formatted;
|
|
41
|
-
}
|
|
29
|
+
const value = (_b = field.value) !== null && _b !== void 0 ? _b : '';
|
|
42
30
|
let children = null;
|
|
43
31
|
const htmlProps = Object.assign({}, otherProps);
|
|
44
32
|
if (!encode) {
|
|
45
33
|
htmlProps.dangerouslySetInnerHTML = {
|
|
46
|
-
__html:
|
|
34
|
+
__html: String(value).split('\n').join('<br>'),
|
|
47
35
|
};
|
|
48
36
|
}
|
|
49
37
|
else {
|
|
38
|
+
let output = value;
|
|
39
|
+
// when string value isn't formatted, we should format line breaks
|
|
40
|
+
const splitted = String(output).split('\n');
|
|
41
|
+
if (splitted.length) {
|
|
42
|
+
const formatted = [];
|
|
43
|
+
splitted.forEach((str, i) => {
|
|
44
|
+
const isLast = i === splitted.length - 1;
|
|
45
|
+
formatted.push(str);
|
|
46
|
+
if (!isLast) {
|
|
47
|
+
formatted.push(React.createElement("br", { key: i }));
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
output = formatted;
|
|
51
|
+
}
|
|
50
52
|
children = output;
|
|
51
53
|
}
|
|
52
54
|
const Tag = (tag || 'span');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitecore-content-sdk/react",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.1-canary.20260707071213",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"url": "https://github.com/sitecore/content-sdk/issues"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@sitecore-content-sdk/analytics-core": "
|
|
35
|
+
"@sitecore-content-sdk/analytics-core": "2.1.1-canary.20260707071213",
|
|
36
36
|
"@sitecore-feaas/clientside": "^0.6.0",
|
|
37
37
|
"@stylistic/eslint-plugin": "^5.2.2",
|
|
38
38
|
"@testing-library/dom": "^10.4.0",
|
|
@@ -71,16 +71,16 @@
|
|
|
71
71
|
"typescript": "~5.8.3"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
|
-
"@sitecore-content-sdk/analytics-core": "
|
|
75
|
-
"@sitecore-content-sdk/events": "
|
|
74
|
+
"@sitecore-content-sdk/analytics-core": "2.1.1-canary.20260707071213",
|
|
75
|
+
"@sitecore-content-sdk/events": "2.1.1-canary.20260707071213",
|
|
76
76
|
"@sitecore-feaas/clientside": "^0.6.0",
|
|
77
77
|
"react": "^19.2.1",
|
|
78
78
|
"react-dom": "^19.2.1"
|
|
79
79
|
},
|
|
80
80
|
"dependencies": {
|
|
81
|
-
"@sitecore-content-sdk/content": "
|
|
82
|
-
"@sitecore-content-sdk/core": "
|
|
83
|
-
"@sitecore-content-sdk/search": "
|
|
81
|
+
"@sitecore-content-sdk/content": "2.2.1-canary.20260707071213",
|
|
82
|
+
"@sitecore-content-sdk/core": "2.1.2-canary.20260707071213",
|
|
83
|
+
"@sitecore-content-sdk/search": "0.3.1-canary.20260707071213",
|
|
84
84
|
"fast-deep-equal": "^3.1.3"
|
|
85
85
|
},
|
|
86
86
|
"description": "",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/components/Text.tsx"],"names":[],"mappings":"AACA,OAAO,KAAuB,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAqB,MAAM,sCAAsC,CAAC;AAIxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,SAAU,SAAQ,aAAa;IAC9C,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,SAAU,SAAQ,kBAAkB,CAAC,SAAS,CAAC;IAC9D,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC;IAClC,2BAA2B;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/components/Text.tsx"],"names":[],"mappings":"AACA,OAAO,KAAuB,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAqB,MAAM,sCAAsC,CAAC;AAIxF,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD;;;GAGG;AACH,MAAM,WAAW,SAAU,SAAQ,aAAa;IAC9C,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,SAAU,SAAQ,kBAAkB,CAAC,SAAS,CAAC;IAC9D,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC;IAClC,2BAA2B;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAmED;;;GAGG;AACH,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAIpC,CAAC"}
|