@sitecore-jss/sitecore-jss-nextjs 22.1.0-canary.2 → 22.1.0-canary.4
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.
- package/dist/cjs/components/Link.js +1 -4
- package/dist/cjs/components/NextImage.js +1 -4
- package/dist/cjs/components/RichText.js +2 -6
- package/dist/esm/components/Link.js +1 -4
- package/dist/esm/components/NextImage.js +1 -4
- package/dist/esm/components/RichText.js +2 -6
- package/package.json +5 -5
- package/types/components/RichText.d.ts +0 -4
|
@@ -43,7 +43,7 @@ const prop_types_1 = __importDefault(require("prop-types"));
|
|
|
43
43
|
const link_1 = __importDefault(require("next/link"));
|
|
44
44
|
const sitecore_jss_react_1 = require("@sitecore-jss/sitecore-jss-react");
|
|
45
45
|
exports.Link = (0, react_1.forwardRef)((props, ref) => {
|
|
46
|
-
const { field, editable, children, internalLinkMatcher = /^\//g, showLinkTextWithChildrenPresent } = props, htmlLinkProps = __rest(props, ["field", "editable", "children", "internalLinkMatcher", "showLinkTextWithChildrenPresent"]);
|
|
46
|
+
const { field, editable = true, children, internalLinkMatcher = /^\//g, showLinkTextWithChildrenPresent } = props, htmlLinkProps = __rest(props, ["field", "editable", "children", "internalLinkMatcher", "showLinkTextWithChildrenPresent"]);
|
|
47
47
|
if (!field ||
|
|
48
48
|
(!field.editable && !field.value && !field.href)) {
|
|
49
49
|
return null;
|
|
@@ -67,8 +67,5 @@ exports.Link = (0, react_1.forwardRef)((props, ref) => {
|
|
|
67
67
|
delete reactLinkProps.internalLinkMatcher;
|
|
68
68
|
return react_1.default.createElement(sitecore_jss_react_1.Link, Object.assign({}, reactLinkProps, { ref: ref }));
|
|
69
69
|
});
|
|
70
|
-
exports.Link.defaultProps = {
|
|
71
|
-
editable: true,
|
|
72
|
-
};
|
|
73
70
|
exports.Link.displayName = 'NextLink';
|
|
74
71
|
exports.Link.propTypes = Object.assign({ internalLinkMatcher: prop_types_1.default.instanceOf(RegExp) }, sitecore_jss_react_1.LinkPropTypes);
|
|
@@ -21,7 +21,7 @@ const react_1 = __importDefault(require("react"));
|
|
|
21
21
|
const sitecore_jss_react_1 = require("@sitecore-jss/sitecore-jss-react");
|
|
22
22
|
const image_1 = __importDefault(require("next/image"));
|
|
23
23
|
const NextImage = (_a) => {
|
|
24
|
-
var { editable, imageParams, field, mediaUrlPrefix, fill, priority } = _a, otherProps = __rest(_a, ["editable", "imageParams", "field", "mediaUrlPrefix", "fill", "priority"]);
|
|
24
|
+
var { editable = true, imageParams, field, mediaUrlPrefix, fill, priority } = _a, otherProps = __rest(_a, ["editable", "imageParams", "field", "mediaUrlPrefix", "fill", "priority"]);
|
|
25
25
|
// next handles src and we use a custom loader,
|
|
26
26
|
// throw error if these are present
|
|
27
27
|
if (otherProps.src) {
|
|
@@ -75,7 +75,4 @@ exports.NextImage.propTypes = {
|
|
|
75
75
|
mediaUrlPrefix: prop_types_1.default.instanceOf(RegExp),
|
|
76
76
|
imageParams: prop_types_1.default.objectOf(prop_types_1.default.oneOfType([prop_types_1.default.number.isRequired, prop_types_1.default.string.isRequired]).isRequired),
|
|
77
77
|
};
|
|
78
|
-
exports.NextImage.defaultProps = {
|
|
79
|
-
editable: true,
|
|
80
|
-
};
|
|
81
78
|
exports.NextImage.displayName = 'NextImage';
|
|
@@ -44,9 +44,9 @@ const router_1 = require("next/router");
|
|
|
44
44
|
const sitecore_jss_react_1 = require("@sitecore-jss/sitecore-jss-react");
|
|
45
45
|
const prefetched = {};
|
|
46
46
|
const RichText = (props) => {
|
|
47
|
-
const { internalLinksSelector = 'a[href^="/"]', prefetchLinks = true } = props, rest = __rest(props, ["internalLinksSelector", "prefetchLinks"]);
|
|
47
|
+
const { internalLinksSelector = 'a[href^="/"]', prefetchLinks = true, editable = true } = props, rest = __rest(props, ["internalLinksSelector", "prefetchLinks", "editable"]);
|
|
48
48
|
const hasText = props.field && props.field.value;
|
|
49
|
-
const isEditing =
|
|
49
|
+
const isEditing = editable && props.field && props.field.editable;
|
|
50
50
|
const router = (0, router_1.useRouter)();
|
|
51
51
|
const richTextRef = (0, react_1.useRef)(null);
|
|
52
52
|
(0, react_1.useEffect)(() => {
|
|
@@ -82,8 +82,4 @@ const RichText = (props) => {
|
|
|
82
82
|
};
|
|
83
83
|
exports.RichText = RichText;
|
|
84
84
|
exports.RichText.propTypes = Object.assign({ internalLinksSelector: prop_types_1.default.string }, sitecore_jss_react_1.RichTextPropTypes);
|
|
85
|
-
exports.RichText.defaultProps = {
|
|
86
|
-
tag: 'div',
|
|
87
|
-
editable: true,
|
|
88
|
-
};
|
|
89
85
|
exports.RichText.displayName = 'NextRichText';
|
|
@@ -14,7 +14,7 @@ import PropTypes from 'prop-types';
|
|
|
14
14
|
import NextLink from 'next/link';
|
|
15
15
|
import { Link as ReactLink, LinkPropTypes, } from '@sitecore-jss/sitecore-jss-react';
|
|
16
16
|
export const Link = forwardRef((props, ref) => {
|
|
17
|
-
const { field, editable, children, internalLinkMatcher = /^\//g, showLinkTextWithChildrenPresent } = props, htmlLinkProps = __rest(props, ["field", "editable", "children", "internalLinkMatcher", "showLinkTextWithChildrenPresent"]);
|
|
17
|
+
const { field, editable = true, children, internalLinkMatcher = /^\//g, showLinkTextWithChildrenPresent } = props, htmlLinkProps = __rest(props, ["field", "editable", "children", "internalLinkMatcher", "showLinkTextWithChildrenPresent"]);
|
|
18
18
|
if (!field ||
|
|
19
19
|
(!field.editable && !field.value && !field.href)) {
|
|
20
20
|
return null;
|
|
@@ -38,8 +38,5 @@ export const Link = forwardRef((props, ref) => {
|
|
|
38
38
|
delete reactLinkProps.internalLinkMatcher;
|
|
39
39
|
return React.createElement(ReactLink, Object.assign({}, reactLinkProps, { ref: ref }));
|
|
40
40
|
});
|
|
41
|
-
Link.defaultProps = {
|
|
42
|
-
editable: true,
|
|
43
|
-
};
|
|
44
41
|
Link.displayName = 'NextLink';
|
|
45
42
|
Link.propTypes = Object.assign({ internalLinkMatcher: PropTypes.instanceOf(RegExp) }, LinkPropTypes);
|
|
@@ -15,7 +15,7 @@ import React from 'react';
|
|
|
15
15
|
import { getEEMarkup, } from '@sitecore-jss/sitecore-jss-react';
|
|
16
16
|
import Image from 'next/image';
|
|
17
17
|
export const NextImage = (_a) => {
|
|
18
|
-
var { editable, imageParams, field, mediaUrlPrefix, fill, priority } = _a, otherProps = __rest(_a, ["editable", "imageParams", "field", "mediaUrlPrefix", "fill", "priority"]);
|
|
18
|
+
var { editable = true, imageParams, field, mediaUrlPrefix, fill, priority } = _a, otherProps = __rest(_a, ["editable", "imageParams", "field", "mediaUrlPrefix", "fill", "priority"]);
|
|
19
19
|
// next handles src and we use a custom loader,
|
|
20
20
|
// throw error if these are present
|
|
21
21
|
if (otherProps.src) {
|
|
@@ -68,7 +68,4 @@ NextImage.propTypes = {
|
|
|
68
68
|
mediaUrlPrefix: PropTypes.instanceOf(RegExp),
|
|
69
69
|
imageParams: PropTypes.objectOf(PropTypes.oneOfType([PropTypes.number.isRequired, PropTypes.string.isRequired]).isRequired),
|
|
70
70
|
};
|
|
71
|
-
NextImage.defaultProps = {
|
|
72
|
-
editable: true,
|
|
73
|
-
};
|
|
74
71
|
NextImage.displayName = 'NextImage';
|
|
@@ -15,9 +15,9 @@ import { useRouter } from 'next/router';
|
|
|
15
15
|
import { RichText as ReactRichText, RichTextPropTypes, } from '@sitecore-jss/sitecore-jss-react';
|
|
16
16
|
const prefetched = {};
|
|
17
17
|
export const RichText = (props) => {
|
|
18
|
-
const { internalLinksSelector = 'a[href^="/"]', prefetchLinks = true } = props, rest = __rest(props, ["internalLinksSelector", "prefetchLinks"]);
|
|
18
|
+
const { internalLinksSelector = 'a[href^="/"]', prefetchLinks = true, editable = true } = props, rest = __rest(props, ["internalLinksSelector", "prefetchLinks", "editable"]);
|
|
19
19
|
const hasText = props.field && props.field.value;
|
|
20
|
-
const isEditing =
|
|
20
|
+
const isEditing = editable && props.field && props.field.editable;
|
|
21
21
|
const router = useRouter();
|
|
22
22
|
const richTextRef = useRef(null);
|
|
23
23
|
useEffect(() => {
|
|
@@ -52,8 +52,4 @@ export const RichText = (props) => {
|
|
|
52
52
|
return React.createElement(ReactRichText, Object.assign({ ref: richTextRef }, rest));
|
|
53
53
|
};
|
|
54
54
|
RichText.propTypes = Object.assign({ internalLinksSelector: PropTypes.string }, RichTextPropTypes);
|
|
55
|
-
RichText.defaultProps = {
|
|
56
|
-
tag: 'div',
|
|
57
|
-
editable: true,
|
|
58
|
-
};
|
|
59
55
|
RichText.displayName = 'NextRichText';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sitecore-jss/sitecore-jss-nextjs",
|
|
3
|
-
"version": "22.1.0-canary.
|
|
3
|
+
"version": "22.1.0-canary.4",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -72,9 +72,9 @@
|
|
|
72
72
|
"react-dom": "^18.2.0"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
|
-
"@sitecore-jss/sitecore-jss": "^22.1.0-canary.
|
|
76
|
-
"@sitecore-jss/sitecore-jss-dev-tools": "^22.1.0-canary.
|
|
77
|
-
"@sitecore-jss/sitecore-jss-react": "^22.1.0-canary.
|
|
75
|
+
"@sitecore-jss/sitecore-jss": "^22.1.0-canary.4",
|
|
76
|
+
"@sitecore-jss/sitecore-jss-dev-tools": "^22.1.0-canary.4",
|
|
77
|
+
"@sitecore-jss/sitecore-jss-react": "^22.1.0-canary.4",
|
|
78
78
|
"@vercel/kv": "^0.2.1",
|
|
79
79
|
"node-html-parser": "^6.1.4",
|
|
80
80
|
"prop-types": "^15.8.1",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
},
|
|
84
84
|
"description": "",
|
|
85
85
|
"types": "types/index.d.ts",
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "21d10de73f0acc952eed4c8395dd480df396c963",
|
|
87
87
|
"files": [
|
|
88
88
|
"dist",
|
|
89
89
|
"types",
|