tinacms 1.5.12 → 1.5.14
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/client.es.js +12 -4
- package/dist/client.js +9 -9
- package/dist/dev-tools.es.js +211 -245
- package/dist/dev-tools.js +221 -262
- package/dist/edit-state.es.js +37 -23
- package/dist/edit-state.js +39 -39
- package/dist/index.es.js +1960 -1538
- package/dist/index.js +1989 -1614
- package/dist/internalClient/index.d.ts +1 -0
- package/dist/react.es.js +32 -8
- package/dist/react.js +35 -21
- package/dist/rich-text/index.es.js +43 -104
- package/dist/rich-text/index.js +50 -117
- package/dist/rich-text/prism.d.ts +2 -0
- package/dist/rich-text/prism.es.js +13 -69
- package/dist/rich-text/prism.js +11 -74
- package/dist/utils/index.d.ts +2 -2
- package/package.json +8 -7
package/dist/edit-state.es.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { useEditState as useEditState$1, EditProvider, TinaDataContext } from "@tinacms/sharedctx";
|
|
2
|
-
|
|
2
|
+
import { isEditing, setEditing } from "@tinacms/sharedctx";
|
|
3
3
|
import React, { useState, useEffect } from "react";
|
|
4
4
|
const useEditState = useEditState$1;
|
|
5
5
|
const TinaEditProvider = ({
|
|
6
6
|
showEditButton,
|
|
7
7
|
...props
|
|
8
8
|
}) => {
|
|
9
|
-
return /* @__PURE__ */ React.createElement(EditProvider, null, showEditButton && /* @__PURE__ */ React.createElement(ToggleButton, null), /* @__PURE__ */ React.createElement(TinaEditProviderInner, {
|
|
10
|
-
...props
|
|
11
|
-
}));
|
|
9
|
+
return /* @__PURE__ */ React.createElement(EditProvider, null, showEditButton && /* @__PURE__ */ React.createElement(ToggleButton, null), /* @__PURE__ */ React.createElement(TinaEditProviderInner, { ...props }));
|
|
12
10
|
};
|
|
13
11
|
function useTina({
|
|
14
12
|
query,
|
|
@@ -28,7 +26,9 @@ function useTina({
|
|
|
28
26
|
isDummyContainer,
|
|
29
27
|
isLoading: contextLoading
|
|
30
28
|
} = React.useContext(TinaDataContext);
|
|
31
|
-
const [waitForContextRerender, setWaitForContextRerender] = useState(
|
|
29
|
+
const [waitForContextRerender, setWaitForContextRerender] = useState(
|
|
30
|
+
!isDummyContainer
|
|
31
|
+
);
|
|
32
32
|
const isLoading = contextLoading || waitForContextRerender;
|
|
33
33
|
React.useEffect(() => {
|
|
34
34
|
setRequest({ query, variables });
|
|
@@ -57,23 +57,31 @@ const ToggleButton = () => {
|
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
}, [setIsOnAdmin]);
|
|
60
|
-
return edit || isOnAdmin ? null : /* @__PURE__ */ React.createElement(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
60
|
+
return edit || isOnAdmin ? null : /* @__PURE__ */ React.createElement(
|
|
61
|
+
"div",
|
|
62
|
+
{
|
|
63
|
+
style: { position: "fixed", bottom: "56px", left: "0px", zIndex: 200 }
|
|
64
|
+
},
|
|
65
|
+
/* @__PURE__ */ React.createElement(
|
|
66
|
+
"a",
|
|
67
|
+
{
|
|
68
|
+
href: "/admin",
|
|
69
|
+
style: {
|
|
70
|
+
borderRadius: "0 50px 50px 0",
|
|
71
|
+
fontSize: "16px",
|
|
72
|
+
fontFamily: "Inter, 'Helvetica Neue', 'Arial Nova', Helvetica, Arial, sans-serif",
|
|
73
|
+
fontWeight: "bold",
|
|
74
|
+
textDecoration: "none",
|
|
75
|
+
background: "rgb(34, 150, 254)",
|
|
76
|
+
boxShadow: "0px 1px 3px rgb(0 0 0 / 10%), 0px 2px 6px rgb(0 0 0 / 20%)",
|
|
77
|
+
color: "white",
|
|
78
|
+
padding: "14px 20px",
|
|
79
|
+
border: "none"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"Edit with Tina"
|
|
83
|
+
)
|
|
84
|
+
);
|
|
77
85
|
};
|
|
78
86
|
const TinaEditProviderInner = ({ children, editMode }) => {
|
|
79
87
|
const { edit } = useEditState();
|
|
@@ -86,4 +94,10 @@ const TinaEditProviderInner = ({ children, editMode }) => {
|
|
|
86
94
|
}
|
|
87
95
|
return children;
|
|
88
96
|
};
|
|
89
|
-
export {
|
|
97
|
+
export {
|
|
98
|
+
TinaEditProvider,
|
|
99
|
+
isEditing,
|
|
100
|
+
setEditing,
|
|
101
|
+
useEditState,
|
|
102
|
+
useTina
|
|
103
|
+
};
|
package/dist/edit-state.js
CHANGED
|
@@ -2,25 +2,19 @@
|
|
|
2
2
|
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@tinacms/sharedctx"), require("react")) : typeof define === "function" && define.amd ? define(["exports", "@tinacms/sharedctx", "react"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP, global.NOOP));
|
|
3
3
|
})(this, function(exports2, sharedctx, React) {
|
|
4
4
|
"use strict";
|
|
5
|
-
function _interopDefaultLegacy(e) {
|
|
6
|
-
return e && typeof e === "object" && "default" in e ? e : { "default": e };
|
|
7
|
-
}
|
|
8
|
-
var React__default = /* @__PURE__ */ _interopDefaultLegacy(React);
|
|
9
5
|
const useEditState = sharedctx.useEditState;
|
|
10
6
|
const TinaEditProvider = ({
|
|
11
7
|
showEditButton,
|
|
12
8
|
...props
|
|
13
9
|
}) => {
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
-
...props
|
|
16
|
-
}));
|
|
10
|
+
return /* @__PURE__ */ React.createElement(sharedctx.EditProvider, null, showEditButton && /* @__PURE__ */ React.createElement(ToggleButton, null), /* @__PURE__ */ React.createElement(TinaEditProviderInner, { ...props }));
|
|
17
11
|
};
|
|
18
12
|
function useTina({
|
|
19
13
|
query,
|
|
20
14
|
variables,
|
|
21
15
|
data
|
|
22
16
|
}) {
|
|
23
|
-
|
|
17
|
+
React.useEffect(() => {
|
|
24
18
|
console.warn(`
|
|
25
19
|
"useTina" from 'tinacms/dist/edit-state' is now deprecated
|
|
26
20
|
* Use "import { useTina } from 'tinacms/dist/react" instead.
|
|
@@ -32,10 +26,12 @@
|
|
|
32
26
|
state,
|
|
33
27
|
isDummyContainer,
|
|
34
28
|
isLoading: contextLoading
|
|
35
|
-
} =
|
|
36
|
-
const [waitForContextRerender, setWaitForContextRerender] = React.useState(
|
|
29
|
+
} = React.useContext(sharedctx.TinaDataContext);
|
|
30
|
+
const [waitForContextRerender, setWaitForContextRerender] = React.useState(
|
|
31
|
+
!isDummyContainer
|
|
32
|
+
);
|
|
37
33
|
const isLoading = contextLoading || waitForContextRerender;
|
|
38
|
-
|
|
34
|
+
React.useEffect(() => {
|
|
39
35
|
setRequest({ query, variables });
|
|
40
36
|
}, [JSON.stringify(variables), query]);
|
|
41
37
|
React.useEffect(() => {
|
|
@@ -53,8 +49,8 @@
|
|
|
53
49
|
}
|
|
54
50
|
const ToggleButton = () => {
|
|
55
51
|
const { edit } = useEditState();
|
|
56
|
-
const [isOnAdmin, setIsOnAdmin] =
|
|
57
|
-
|
|
52
|
+
const [isOnAdmin, setIsOnAdmin] = React.useState(false);
|
|
53
|
+
React.useEffect(() => {
|
|
58
54
|
var _a;
|
|
59
55
|
if (window) {
|
|
60
56
|
if ((_a = window.location) == null ? void 0 : _a.pathname.startsWith("/admin")) {
|
|
@@ -62,28 +58,36 @@
|
|
|
62
58
|
}
|
|
63
59
|
}
|
|
64
60
|
}, [setIsOnAdmin]);
|
|
65
|
-
return edit || isOnAdmin ? null : /* @__PURE__ */
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
61
|
+
return edit || isOnAdmin ? null : /* @__PURE__ */ React.createElement(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
style: { position: "fixed", bottom: "56px", left: "0px", zIndex: 200 }
|
|
65
|
+
},
|
|
66
|
+
/* @__PURE__ */ React.createElement(
|
|
67
|
+
"a",
|
|
68
|
+
{
|
|
69
|
+
href: "/admin",
|
|
70
|
+
style: {
|
|
71
|
+
borderRadius: "0 50px 50px 0",
|
|
72
|
+
fontSize: "16px",
|
|
73
|
+
fontFamily: "Inter, 'Helvetica Neue', 'Arial Nova', Helvetica, Arial, sans-serif",
|
|
74
|
+
fontWeight: "bold",
|
|
75
|
+
textDecoration: "none",
|
|
76
|
+
background: "rgb(34, 150, 254)",
|
|
77
|
+
boxShadow: "0px 1px 3px rgb(0 0 0 / 10%), 0px 2px 6px rgb(0 0 0 / 20%)",
|
|
78
|
+
color: "white",
|
|
79
|
+
padding: "14px 20px",
|
|
80
|
+
border: "none"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"Edit with Tina"
|
|
84
|
+
)
|
|
85
|
+
);
|
|
82
86
|
};
|
|
83
87
|
const TinaEditProviderInner = ({ children, editMode }) => {
|
|
84
88
|
const { edit } = useEditState();
|
|
85
|
-
const [isBrowser, setIsBrowser] =
|
|
86
|
-
|
|
89
|
+
const [isBrowser, setIsBrowser] = React.useState(false);
|
|
90
|
+
React.useEffect(() => {
|
|
87
91
|
setIsBrowser(true);
|
|
88
92
|
}, []);
|
|
89
93
|
if (edit && isBrowser) {
|
|
@@ -93,18 +97,14 @@
|
|
|
93
97
|
};
|
|
94
98
|
Object.defineProperty(exports2, "isEditing", {
|
|
95
99
|
enumerable: true,
|
|
96
|
-
get:
|
|
97
|
-
return sharedctx.isEditing;
|
|
98
|
-
}
|
|
100
|
+
get: () => sharedctx.isEditing
|
|
99
101
|
});
|
|
100
102
|
Object.defineProperty(exports2, "setEditing", {
|
|
101
103
|
enumerable: true,
|
|
102
|
-
get:
|
|
103
|
-
return sharedctx.setEditing;
|
|
104
|
-
}
|
|
104
|
+
get: () => sharedctx.setEditing
|
|
105
105
|
});
|
|
106
106
|
exports2.TinaEditProvider = TinaEditProvider;
|
|
107
107
|
exports2.useEditState = useEditState;
|
|
108
108
|
exports2.useTina = useTina;
|
|
109
|
-
Object.
|
|
109
|
+
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
110
110
|
});
|