react-datocms 7.2.6-0 → 7.2.6
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.
|
@@ -80,10 +80,8 @@ const index_js_1 = require("../useContentLink/index.js");
|
|
|
80
80
|
* @returns null - This component has no visual output
|
|
81
81
|
*/
|
|
82
82
|
function ContentLink(props) {
|
|
83
|
-
const { currentPath, enableClickToEdit: enableClickToEditOptions } = props, useContentLinkOptions = __rest(props, ["currentPath", "enableClickToEdit"]);
|
|
84
|
-
const { enableClickToEdit, setCurrentPath } = (0, index_js_1.useContentLink)(Object.assign(Object.assign({}, useContentLinkOptions), {
|
|
85
|
-
// Always strip stega encoding in the component for clean DOM
|
|
86
|
-
enabled: { stripStega: true } }));
|
|
83
|
+
const { currentPath, enableClickToEdit: enableClickToEditOptions, stripStega } = props, useContentLinkOptions = __rest(props, ["currentPath", "enableClickToEdit", "stripStega"]);
|
|
84
|
+
const { enableClickToEdit, setCurrentPath } = (0, index_js_1.useContentLink)(Object.assign(Object.assign({}, useContentLinkOptions), { enabled: stripStega !== undefined ? { stripStega } : true }));
|
|
87
85
|
// Sync current path when it changes
|
|
88
86
|
(0, react_1.useEffect)(() => {
|
|
89
87
|
if (currentPath !== undefined) {
|
|
@@ -93,7 +91,9 @@ function ContentLink(props) {
|
|
|
93
91
|
// Enable click-to-edit on mount if requested
|
|
94
92
|
(0, react_1.useEffect)(() => {
|
|
95
93
|
if (enableClickToEditOptions !== undefined) {
|
|
96
|
-
enableClickToEdit(enableClickToEditOptions === true
|
|
94
|
+
enableClickToEdit(enableClickToEditOptions === true
|
|
95
|
+
? undefined
|
|
96
|
+
: enableClickToEditOptions);
|
|
97
97
|
}
|
|
98
98
|
}, [enableClickToEditOptions, enableClickToEdit]);
|
|
99
99
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ContentLink/index.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ContentLink/index.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAC;;;;;;;;;;;;;AAiFb,kCAgCC;AA/GD,iCAAkC;AAClC,yDAGoC;AAWpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,SAAgB,WAAW,CAAC,KAAuB;IACjD,MAAM,EACJ,WAAW,EACX,iBAAiB,EAAE,wBAAwB,EAC3C,UAAU,KAER,KAAK,EADJ,qBAAqB,UACtB,KAAK,EALH,kDAKL,CAAQ,CAAC;IAEV,MAAM,EAAE,iBAAiB,EAAE,cAAc,EAAE,GAAG,IAAA,yBAAc,kCACvD,qBAAqB,KACxB,OAAO,EAAE,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,IAAI,IACzD,CAAC;IAEH,oCAAoC;IACpC,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC9B,cAAc,CAAC,WAAW,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,EAAE,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,CAAC;IAElC,6CAA6C;IAC7C,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,wBAAwB,KAAK,SAAS,EAAE,CAAC;YAC3C,iBAAiB,CACf,wBAAwB,KAAK,IAAI;gBAC/B,CAAC,CAAC,SAAS;gBACX,CAAC,CAAC,wBAAwB,CAC7B,CAAC;QACJ,CAAC;IACH,CAAC,EAAE,CAAC,wBAAwB,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAElD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -77,10 +77,8 @@ import { useContentLink, } from '../useContentLink/index.js';
|
|
|
77
77
|
* @returns null - This component has no visual output
|
|
78
78
|
*/
|
|
79
79
|
export function ContentLink(props) {
|
|
80
|
-
const { currentPath, enableClickToEdit: enableClickToEditOptions } = props, useContentLinkOptions = __rest(props, ["currentPath", "enableClickToEdit"]);
|
|
81
|
-
const { enableClickToEdit, setCurrentPath } = useContentLink(Object.assign(Object.assign({}, useContentLinkOptions), {
|
|
82
|
-
// Always strip stega encoding in the component for clean DOM
|
|
83
|
-
enabled: { stripStega: true } }));
|
|
80
|
+
const { currentPath, enableClickToEdit: enableClickToEditOptions, stripStega } = props, useContentLinkOptions = __rest(props, ["currentPath", "enableClickToEdit", "stripStega"]);
|
|
81
|
+
const { enableClickToEdit, setCurrentPath } = useContentLink(Object.assign(Object.assign({}, useContentLinkOptions), { enabled: stripStega !== undefined ? { stripStega } : true }));
|
|
84
82
|
// Sync current path when it changes
|
|
85
83
|
useEffect(() => {
|
|
86
84
|
if (currentPath !== undefined) {
|
|
@@ -90,7 +88,9 @@ export function ContentLink(props) {
|
|
|
90
88
|
// Enable click-to-edit on mount if requested
|
|
91
89
|
useEffect(() => {
|
|
92
90
|
if (enableClickToEditOptions !== undefined) {
|
|
93
|
-
enableClickToEdit(enableClickToEditOptions === true
|
|
91
|
+
enableClickToEdit(enableClickToEditOptions === true
|
|
92
|
+
? undefined
|
|
93
|
+
: enableClickToEditOptions);
|
|
94
94
|
}
|
|
95
95
|
}, [enableClickToEditOptions, enableClickToEdit]);
|
|
96
96
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ContentLink/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAEL,cAAc,GACf,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ContentLink/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAEL,cAAc,GACf,MAAM,4BAA4B,CAAC;AAWpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,MAAM,UAAU,WAAW,CAAC,KAAuB;IACjD,MAAM,EACJ,WAAW,EACX,iBAAiB,EAAE,wBAAwB,EAC3C,UAAU,KAER,KAAK,EADJ,qBAAqB,UACtB,KAAK,EALH,kDAKL,CAAQ,CAAC;IAEV,MAAM,EAAE,iBAAiB,EAAE,cAAc,EAAE,GAAG,cAAc,iCACvD,qBAAqB,KACxB,OAAO,EAAE,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,IAAI,IACzD,CAAC;IAEH,oCAAoC;IACpC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC9B,cAAc,CAAC,WAAW,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,EAAE,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC,CAAC;IAElC,6CAA6C;IAC7C,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,wBAAwB,KAAK,SAAS,EAAE,CAAC;YAC3C,iBAAiB,CACf,wBAAwB,KAAK,IAAI;gBAC/B,CAAC,CAAC,SAAS;gBACX,CAAC,CAAC,wBAAwB,CAC7B,CAAC;QACJ,CAAC;IACH,CAAC,EAAE,CAAC,wBAAwB,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAElD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -6,6 +6,8 @@ export type ContentLinkProps = Omit<UseContentLinkOptions, 'enabled'> & {
|
|
|
6
6
|
enableClickToEdit?: true | {
|
|
7
7
|
scrollToNearestTarget: true;
|
|
8
8
|
};
|
|
9
|
+
/** Whether to strip stega encoding from text nodes after stamping. */
|
|
10
|
+
stripStega?: boolean;
|
|
9
11
|
};
|
|
10
12
|
/**
|
|
11
13
|
* ContentLink component for Visual Editing with DatoCMS.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-datocms",
|
|
3
|
-
"version": "7.2.6
|
|
3
|
+
"version": "7.2.6",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=8.0.0"
|
|
6
6
|
},
|
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
"react": ">= 16.12.0"
|
|
151
151
|
},
|
|
152
152
|
"dependencies": {
|
|
153
|
-
"@datocms/content-link": "^0.3.
|
|
153
|
+
"@datocms/content-link": "^0.3.9",
|
|
154
154
|
"@mux/mux-player-react": "*",
|
|
155
155
|
"datocms-listen": "^1.0.2",
|
|
156
156
|
"datocms-structured-text-generic-html-renderer": "^5.0.0",
|
|
@@ -11,6 +11,8 @@ export type ContentLinkProps = Omit<UseContentLinkOptions, 'enabled'> & {
|
|
|
11
11
|
currentPath?: string;
|
|
12
12
|
/** Enable click-to-edit on mount. Pass true for default behavior or an object with scrollToNearestTarget. If undefined, click-to-edit is disabled. */
|
|
13
13
|
enableClickToEdit?: true | { scrollToNearestTarget: true };
|
|
14
|
+
/** Whether to strip stega encoding from text nodes after stamping. */
|
|
15
|
+
stripStega?: boolean;
|
|
14
16
|
};
|
|
15
17
|
|
|
16
18
|
/**
|
|
@@ -81,13 +83,13 @@ export function ContentLink(props: ContentLinkProps): null {
|
|
|
81
83
|
const {
|
|
82
84
|
currentPath,
|
|
83
85
|
enableClickToEdit: enableClickToEditOptions,
|
|
86
|
+
stripStega,
|
|
84
87
|
...useContentLinkOptions
|
|
85
88
|
} = props;
|
|
86
89
|
|
|
87
90
|
const { enableClickToEdit, setCurrentPath } = useContentLink({
|
|
88
91
|
...useContentLinkOptions,
|
|
89
|
-
|
|
90
|
-
enabled: { stripStega: true },
|
|
92
|
+
enabled: stripStega !== undefined ? { stripStega } : true,
|
|
91
93
|
});
|
|
92
94
|
|
|
93
95
|
// Sync current path when it changes
|
|
@@ -101,7 +103,9 @@ export function ContentLink(props: ContentLinkProps): null {
|
|
|
101
103
|
useEffect(() => {
|
|
102
104
|
if (enableClickToEditOptions !== undefined) {
|
|
103
105
|
enableClickToEdit(
|
|
104
|
-
enableClickToEditOptions === true
|
|
106
|
+
enableClickToEditOptions === true
|
|
107
|
+
? undefined
|
|
108
|
+
: enableClickToEditOptions,
|
|
105
109
|
);
|
|
106
110
|
}
|
|
107
111
|
}, [enableClickToEditOptions, enableClickToEdit]);
|