tinacms 0.69.22 → 0.70.1
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/edit-state.d.ts +20 -1
- package/dist/edit-state.es.js +11 -3
- package/dist/edit-state.js +11 -8
- package/dist/hooks/formify/spec/schema.d.ts +2 -2
- package/dist/index.d.ts +42 -10
- package/dist/index.es.js +23 -5
- package/dist/index.js +23 -4
- package/dist/react.d.ts +3 -0
- package/dist/react.es.js +16 -1
- package/dist/react.js +16 -0
- package/dist/rich-text/index.d.ts +7 -2
- package/dist/tina-cms.d.ts +5 -0
- package/package.json +4 -3
package/dist/edit-state.d.ts
CHANGED
|
@@ -10,14 +10,33 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
10
10
|
See the License for the specific language governing permissions and
|
|
11
11
|
limitations under the License.
|
|
12
12
|
*/
|
|
13
|
-
import { isEditing, setEditing
|
|
13
|
+
import { isEditing, setEditing } from '@tinacms/sharedctx';
|
|
14
14
|
import React from 'react';
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated since version 1.0.
|
|
17
|
+
* Use "import { useEditState } from 'tinacms/dist/react'" instead.
|
|
18
|
+
* See https://tina.io/blog/upgrading-to-iframe/ for full migration details
|
|
19
|
+
*/
|
|
20
|
+
declare const useEditState: () => {
|
|
21
|
+
edit: any;
|
|
22
|
+
setEdit: any;
|
|
23
|
+
};
|
|
15
24
|
export { isEditing, setEditing, useEditState };
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated since version 1.0.
|
|
27
|
+
* Tina no longer requires wrapping your site in the TinaProvider
|
|
28
|
+
* See https://tina.io/blog/upgrading-to-iframe/ for full migration details
|
|
29
|
+
*/
|
|
16
30
|
export declare const TinaEditProvider: ({ showEditButton, ...props }: {
|
|
17
31
|
showEditButton?: boolean;
|
|
18
32
|
children: React.ReactNode;
|
|
19
33
|
editMode: React.ReactNode;
|
|
20
34
|
}) => JSX.Element;
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated since version 1.0.
|
|
37
|
+
* Use "import { useTina } from 'tinacms/dist/react'" instead.
|
|
38
|
+
* See https://tina.io/blog/upgrading-to-iframe/ for full migration details
|
|
39
|
+
*/
|
|
21
40
|
export declare function useTina<T extends object>({ query, variables, data, }: {
|
|
22
41
|
query: string;
|
|
23
42
|
variables: object;
|
package/dist/edit-state.es.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { EditProvider, TinaDataContext
|
|
2
|
-
export { isEditing, setEditing
|
|
1
|
+
import { useEditState as useEditState$1, EditProvider, TinaDataContext } from "@tinacms/sharedctx";
|
|
2
|
+
export { isEditing, setEditing } from "@tinacms/sharedctx";
|
|
3
3
|
import React, { useState, useEffect } from "react";
|
|
4
|
+
const useEditState = useEditState$1;
|
|
4
5
|
const TinaEditProvider = ({
|
|
5
6
|
showEditButton,
|
|
6
7
|
...props
|
|
@@ -14,6 +15,13 @@ function useTina({
|
|
|
14
15
|
variables,
|
|
15
16
|
data
|
|
16
17
|
}) {
|
|
18
|
+
React.useEffect(() => {
|
|
19
|
+
console.warn(`
|
|
20
|
+
"useTina" from 'tinacms/dist/edit-state' is now deprecated
|
|
21
|
+
* Use "import { useTina } from 'tinacms/dist/react" instead.
|
|
22
|
+
* See https://tina.io/blog/upgrading-to-iframe/ for full migration details
|
|
23
|
+
`);
|
|
24
|
+
}, []);
|
|
17
25
|
const {
|
|
18
26
|
setRequest,
|
|
19
27
|
state,
|
|
@@ -78,4 +86,4 @@ const TinaEditProviderInner = ({ children, editMode }) => {
|
|
|
78
86
|
}
|
|
79
87
|
return children;
|
|
80
88
|
};
|
|
81
|
-
export { TinaEditProvider, useTina };
|
|
89
|
+
export { TinaEditProvider, useEditState, useTina };
|
package/dist/edit-state.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
return e && typeof e === "object" && "default" in e ? e : { "default": e };
|
|
7
7
|
}
|
|
8
8
|
var React__default = /* @__PURE__ */ _interopDefaultLegacy(React);
|
|
9
|
+
const useEditState = sharedctx.useEditState;
|
|
9
10
|
const TinaEditProvider = ({
|
|
10
11
|
showEditButton,
|
|
11
12
|
...props
|
|
@@ -19,6 +20,13 @@
|
|
|
19
20
|
variables,
|
|
20
21
|
data
|
|
21
22
|
}) {
|
|
23
|
+
React__default["default"].useEffect(() => {
|
|
24
|
+
console.warn(`
|
|
25
|
+
"useTina" from 'tinacms/dist/edit-state' is now deprecated
|
|
26
|
+
* Use "import { useTina } from 'tinacms/dist/react" instead.
|
|
27
|
+
* See https://tina.io/blog/upgrading-to-iframe/ for full migration details
|
|
28
|
+
`);
|
|
29
|
+
}, []);
|
|
22
30
|
const {
|
|
23
31
|
setRequest,
|
|
24
32
|
state,
|
|
@@ -44,7 +52,7 @@
|
|
|
44
52
|
};
|
|
45
53
|
}
|
|
46
54
|
const ToggleButton = () => {
|
|
47
|
-
const { edit } =
|
|
55
|
+
const { edit } = useEditState();
|
|
48
56
|
const [isOnAdmin, setIsOnAdmin] = React__default["default"].useState(false);
|
|
49
57
|
React__default["default"].useEffect(() => {
|
|
50
58
|
var _a;
|
|
@@ -73,7 +81,7 @@
|
|
|
73
81
|
}, "Edit with Tina"));
|
|
74
82
|
};
|
|
75
83
|
const TinaEditProviderInner = ({ children, editMode }) => {
|
|
76
|
-
const { edit } =
|
|
84
|
+
const { edit } = useEditState();
|
|
77
85
|
const [isBrowser, setIsBrowser] = React__default["default"].useState(false);
|
|
78
86
|
React__default["default"].useEffect(() => {
|
|
79
87
|
setIsBrowser(true);
|
|
@@ -95,13 +103,8 @@
|
|
|
95
103
|
return sharedctx.setEditing;
|
|
96
104
|
}
|
|
97
105
|
});
|
|
98
|
-
Object.defineProperty(exports2, "useEditState", {
|
|
99
|
-
enumerable: true,
|
|
100
|
-
get: function() {
|
|
101
|
-
return sharedctx.useEditState;
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
106
|
exports2.TinaEditProvider = TinaEditProvider;
|
|
107
|
+
exports2.useEditState = useEditState;
|
|
105
108
|
exports2.useTina = useTina;
|
|
106
109
|
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
107
110
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare const schema:
|
|
2
|
-
export declare const tinaConfig:
|
|
1
|
+
declare const schema: any;
|
|
2
|
+
export declare const tinaConfig: import("@tinacms/schema-tools/dist/types").Config<(cms: import("@tinacms/toolkit/dist/tina-cms").TinaCMS) => import("@tinacms/toolkit/dist/tina-cms").TinaCMS, import("../../use-graphql-forms").formifyCallback, import("../../use-content-creator").DocumentCreatorArgs, undefined>;
|
|
3
3
|
export default schema;
|
package/dist/index.d.ts
CHANGED
|
@@ -27,14 +27,46 @@ export type { TinaCMSProviderDefaultProps };
|
|
|
27
27
|
export default TinaCMSProvider2;
|
|
28
28
|
import { TinaCMS } from '@tinacms/toolkit';
|
|
29
29
|
import { formifyCallback } from './hooks/use-graphql-forms';
|
|
30
|
-
import type { TinaCloudSchema as TinaCloudSchemaBase, TinaCloudCollection as TinaCloudCollectionBase, TinaCloudTemplateBase, TinaTemplate, TinaFieldBase, TinaCMSConfig } from '@tinacms/schema-tools';
|
|
31
30
|
export { NAMER, resolveForm } from '@tinacms/schema-tools';
|
|
32
|
-
|
|
33
|
-
export
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
export type
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
import type { Config, SchemaField, Schema, Collection, Template } from '@tinacms/schema-tools/dist/types';
|
|
32
|
+
export type { Config, Schema, Collection, Template, SchemaField };
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated use `SchemaField` instead
|
|
35
|
+
*/
|
|
36
|
+
export declare type TinaFieldEnriched = SchemaField;
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated use `SchemaField` instead
|
|
39
|
+
*/
|
|
40
|
+
export declare type TinaField = SchemaField;
|
|
41
|
+
/**
|
|
42
|
+
* @deprecated use `Template` instead
|
|
43
|
+
*/
|
|
44
|
+
export declare type TinaTemplate = Template;
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated use `Template` instead
|
|
47
|
+
*/
|
|
48
|
+
export declare type Templateable = Template;
|
|
49
|
+
/**
|
|
50
|
+
* @deprecated use `Template` instead
|
|
51
|
+
*/
|
|
52
|
+
export declare type TinaCloudTemplatebase = Template;
|
|
53
|
+
/**
|
|
54
|
+
* @deprecated use `Collection` instead
|
|
55
|
+
*/
|
|
56
|
+
export declare type TinaCloudCollection = Collection;
|
|
57
|
+
/**
|
|
58
|
+
* @deprecated use `Collection` instead
|
|
59
|
+
*/
|
|
60
|
+
export declare type TinaCollection = Collection;
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated use `Schema` instead
|
|
63
|
+
*/
|
|
64
|
+
export declare type TinaSchema = Schema;
|
|
65
|
+
/**
|
|
66
|
+
* @deprecated use `Schema` instead
|
|
67
|
+
*/
|
|
68
|
+
export declare type TinaCloudSchema = Schema;
|
|
69
|
+
export declare const defineSchema: (config: Schema) => Schema;
|
|
70
|
+
export declare const defineLegacyConfig: (config: Omit<TinaCMSProviderDefaultProps, 'children'>) => Omit<TinaCMSProviderDefaultProps, "children">;
|
|
71
|
+
export declare const defineStaticConfig: (config: Config<(cms: TinaCMS) => TinaCMS, formifyCallback, import("./hooks/use-content-creator").DocumentCreatorArgs, undefined>) => Config<(cms: TinaCMS) => TinaCMS, formifyCallback, import("./hooks/use-content-creator").DocumentCreatorArgs, undefined>;
|
|
72
|
+
export declare const defineConfig: (config: Config<(cms: TinaCMS) => TinaCMS, formifyCallback, import("./hooks/use-content-creator").DocumentCreatorArgs, undefined>) => Config<(cms: TinaCMS) => TinaCMS, formifyCallback, import("./hooks/use-content-creator").DocumentCreatorArgs, undefined>;
|
package/dist/index.es.js
CHANGED
|
@@ -3994,6 +3994,13 @@ function useTina({
|
|
|
3994
3994
|
variables,
|
|
3995
3995
|
data
|
|
3996
3996
|
}) {
|
|
3997
|
+
React.useEffect(() => {
|
|
3998
|
+
console.warn(`
|
|
3999
|
+
"useTina" from 'tinacms/dist/edit-state' is now deprecated
|
|
4000
|
+
* Use "import { useTina } from 'tinacms/dist/react" instead.
|
|
4001
|
+
* See https://tina.io/blog/upgrading-to-iframe/ for full migration details
|
|
4002
|
+
`);
|
|
4003
|
+
}, []);
|
|
3997
4004
|
const {
|
|
3998
4005
|
setRequest,
|
|
3999
4006
|
state,
|
|
@@ -4125,6 +4132,12 @@ const TinaCMSProvider2 = ({
|
|
|
4125
4132
|
...props
|
|
4126
4133
|
}) => {
|
|
4127
4134
|
var _a;
|
|
4135
|
+
React.useEffect(() => {
|
|
4136
|
+
console.warn(`
|
|
4137
|
+
* Tina no longer requires wrapping your site in the TinaProvider
|
|
4138
|
+
* See https://tina.io/blog/upgrading-to-iframe/ for full migration details
|
|
4139
|
+
`);
|
|
4140
|
+
}, []);
|
|
4128
4141
|
if (props == null ? void 0 : props.apiURL) {
|
|
4129
4142
|
console.warn("The apiURL prop is deprecated. Please see https://tina.io/blog/tina-v-0.68.14 for information on how to upgrade to the new API");
|
|
4130
4143
|
}
|
|
@@ -5275,7 +5288,7 @@ const FilenameInput = (props) => {
|
|
|
5275
5288
|
}));
|
|
5276
5289
|
};
|
|
5277
5290
|
const RenderForm$1 = ({ cms, collection, templateName, mutationInfo }) => {
|
|
5278
|
-
var _a, _b, _c, _d, _e;
|
|
5291
|
+
var _a, _b, _c, _d, _e, _f;
|
|
5279
5292
|
const navigate = useNavigate();
|
|
5280
5293
|
const [formIsPristine, setFormIsPristine] = useState(true);
|
|
5281
5294
|
const schema = cms.api.tina.schema;
|
|
@@ -5300,10 +5313,11 @@ const RenderForm$1 = ({ cms, collection, templateName, mutationInfo }) => {
|
|
|
5300
5313
|
};
|
|
5301
5314
|
}
|
|
5302
5315
|
}
|
|
5316
|
+
const defaultItem = ((_d = template.ui) == null ? void 0 : _d.defaultItem) || (template == null ? void 0 : template.defaultItem);
|
|
5303
5317
|
const form = useMemo(() => {
|
|
5304
5318
|
var _a2, _b2;
|
|
5305
5319
|
return new Form({
|
|
5306
|
-
initialValues: typeof
|
|
5320
|
+
initialValues: typeof defaultItem === "function" ? defaultItem() : defaultItem,
|
|
5307
5321
|
extraSubscribeValues: { active: true, submitting: true, touched: true },
|
|
5308
5322
|
onChange: (values) => {
|
|
5309
5323
|
var _a3;
|
|
@@ -5359,7 +5373,7 @@ const RenderForm$1 = ({ cms, collection, templateName, mutationInfo }) => {
|
|
|
5359
5373
|
const windowWidth = useWindowWidth();
|
|
5360
5374
|
const renderNavToggle = windowWidth < navBreakpoint + 1;
|
|
5361
5375
|
const headerPadding = renderNavToggle ? "px-20" : "px-6";
|
|
5362
|
-
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, ((
|
|
5376
|
+
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, ((_f = (_e = cms == null ? void 0 : cms.api) == null ? void 0 : _e.tina) == null ? void 0 : _f.isLocalMode) && /* @__PURE__ */ React.createElement(LocalWarning, null), /* @__PURE__ */ React.createElement("div", {
|
|
5363
5377
|
className: `py-4 border-b border-gray-200 bg-white ${headerPadding}`
|
|
5364
5378
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
5365
5379
|
className: "max-w-form mx-auto"
|
|
@@ -5709,12 +5723,16 @@ const defineSchema = (config) => {
|
|
|
5709
5723
|
validateSchema({ schema: config });
|
|
5710
5724
|
return config;
|
|
5711
5725
|
};
|
|
5712
|
-
const
|
|
5726
|
+
const defineLegacyConfig = (config) => {
|
|
5713
5727
|
validateSchema({ schema: config.schema });
|
|
5714
5728
|
return config;
|
|
5715
5729
|
};
|
|
5716
5730
|
const defineStaticConfig = (config) => {
|
|
5731
|
+
if (!config.schema) {
|
|
5732
|
+
throw new Error("Static config must have a schema");
|
|
5733
|
+
}
|
|
5717
5734
|
validateSchema({ schema: config.schema });
|
|
5718
5735
|
return config;
|
|
5719
5736
|
};
|
|
5720
|
-
|
|
5737
|
+
const defineConfig = defineStaticConfig;
|
|
5738
|
+
export { AuthWallInner, Client, DEFAULT_LOCAL_TINA_GQL_SERVER_URL, LocalClient, RouteMappingPlugin, TinaAdmin, TinaAdminApi, TinaCMSProvider2, TinaCloudAuthWall, TinaCloudProvider, TinaDataProvider, assertShape, createClient, TinaCMSProvider2 as default, defineConfig, defineLegacyConfig, defineSchema, defineStaticConfig, getStaticPropsForTina, gql, safeAssertShape, staticRequest, useDocumentCreatorPlugin, useGraphqlForms, useTinaAuthRedirect };
|
package/dist/index.js
CHANGED
|
@@ -4010,6 +4010,13 @@ mutation addPendingDocumentMutation(
|
|
|
4010
4010
|
variables,
|
|
4011
4011
|
data
|
|
4012
4012
|
}) {
|
|
4013
|
+
React__default["default"].useEffect(() => {
|
|
4014
|
+
console.warn(`
|
|
4015
|
+
"useTina" from 'tinacms/dist/edit-state' is now deprecated
|
|
4016
|
+
* Use "import { useTina } from 'tinacms/dist/react" instead.
|
|
4017
|
+
* See https://tina.io/blog/upgrading-to-iframe/ for full migration details
|
|
4018
|
+
`);
|
|
4019
|
+
}, []);
|
|
4013
4020
|
const {
|
|
4014
4021
|
setRequest,
|
|
4015
4022
|
state,
|
|
@@ -4141,6 +4148,12 @@ mutation addPendingDocumentMutation(
|
|
|
4141
4148
|
...props
|
|
4142
4149
|
}) => {
|
|
4143
4150
|
var _a;
|
|
4151
|
+
React__default["default"].useEffect(() => {
|
|
4152
|
+
console.warn(`
|
|
4153
|
+
* Tina no longer requires wrapping your site in the TinaProvider
|
|
4154
|
+
* See https://tina.io/blog/upgrading-to-iframe/ for full migration details
|
|
4155
|
+
`);
|
|
4156
|
+
}, []);
|
|
4144
4157
|
if (props == null ? void 0 : props.apiURL) {
|
|
4145
4158
|
console.warn("The apiURL prop is deprecated. Please see https://tina.io/blog/tina-v-0.68.14 for information on how to upgrade to the new API");
|
|
4146
4159
|
}
|
|
@@ -5291,7 +5304,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5291
5304
|
}));
|
|
5292
5305
|
};
|
|
5293
5306
|
const RenderForm$1 = ({ cms, collection, templateName, mutationInfo }) => {
|
|
5294
|
-
var _a, _b, _c, _d, _e;
|
|
5307
|
+
var _a, _b, _c, _d, _e, _f;
|
|
5295
5308
|
const navigate = reactRouterDom.useNavigate();
|
|
5296
5309
|
const [formIsPristine, setFormIsPristine] = React.useState(true);
|
|
5297
5310
|
const schema = cms.api.tina.schema;
|
|
@@ -5316,10 +5329,11 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5316
5329
|
};
|
|
5317
5330
|
}
|
|
5318
5331
|
}
|
|
5332
|
+
const defaultItem = ((_d = template.ui) == null ? void 0 : _d.defaultItem) || (template == null ? void 0 : template.defaultItem);
|
|
5319
5333
|
const form = React.useMemo(() => {
|
|
5320
5334
|
var _a2, _b2;
|
|
5321
5335
|
return new toolkit.Form({
|
|
5322
|
-
initialValues: typeof
|
|
5336
|
+
initialValues: typeof defaultItem === "function" ? defaultItem() : defaultItem,
|
|
5323
5337
|
extraSubscribeValues: { active: true, submitting: true, touched: true },
|
|
5324
5338
|
onChange: (values) => {
|
|
5325
5339
|
var _a3;
|
|
@@ -5375,7 +5389,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5375
5389
|
const windowWidth = windowSize.useWindowWidth();
|
|
5376
5390
|
const renderNavToggle = windowWidth < navBreakpoint + 1;
|
|
5377
5391
|
const headerPadding = renderNavToggle ? "px-20" : "px-6";
|
|
5378
|
-
return /* @__PURE__ */ React__default["default"].createElement(PageWrapper, null, /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, ((
|
|
5392
|
+
return /* @__PURE__ */ React__default["default"].createElement(PageWrapper, null, /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, ((_f = (_e = cms == null ? void 0 : cms.api) == null ? void 0 : _e.tina) == null ? void 0 : _f.isLocalMode) && /* @__PURE__ */ React__default["default"].createElement(toolkit.LocalWarning, null), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5379
5393
|
className: `py-4 border-b border-gray-200 bg-white ${headerPadding}`
|
|
5380
5394
|
}, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5381
5395
|
className: "max-w-form mx-auto"
|
|
@@ -5725,14 +5739,18 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5725
5739
|
schemaTools.validateSchema({ schema: config });
|
|
5726
5740
|
return config;
|
|
5727
5741
|
};
|
|
5728
|
-
const
|
|
5742
|
+
const defineLegacyConfig = (config) => {
|
|
5729
5743
|
schemaTools.validateSchema({ schema: config.schema });
|
|
5730
5744
|
return config;
|
|
5731
5745
|
};
|
|
5732
5746
|
const defineStaticConfig = (config) => {
|
|
5747
|
+
if (!config.schema) {
|
|
5748
|
+
throw new Error("Static config must have a schema");
|
|
5749
|
+
}
|
|
5733
5750
|
schemaTools.validateSchema({ schema: config.schema });
|
|
5734
5751
|
return config;
|
|
5735
5752
|
};
|
|
5753
|
+
const defineConfig = defineStaticConfig;
|
|
5736
5754
|
Object.defineProperty(exports2, "MdxFieldPluginExtendible", {
|
|
5737
5755
|
enumerable: true,
|
|
5738
5756
|
get: function() {
|
|
@@ -5766,6 +5784,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5766
5784
|
exports2.createClient = createClient;
|
|
5767
5785
|
exports2["default"] = TinaCMSProvider2;
|
|
5768
5786
|
exports2.defineConfig = defineConfig;
|
|
5787
|
+
exports2.defineLegacyConfig = defineLegacyConfig;
|
|
5769
5788
|
exports2.defineSchema = defineSchema;
|
|
5770
5789
|
exports2.defineStaticConfig = defineStaticConfig;
|
|
5771
5790
|
exports2.getStaticPropsForTina = getStaticPropsForTina;
|
package/dist/react.d.ts
CHANGED
package/dist/react.es.js
CHANGED
|
@@ -16,4 +16,19 @@ function useTina(props) {
|
|
|
16
16
|
}, [id]);
|
|
17
17
|
return { data };
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
function useEditState() {
|
|
20
|
+
const [edit, setEdit] = React.useState(false);
|
|
21
|
+
React.useEffect(() => {
|
|
22
|
+
if (typeof window !== "undefined") {
|
|
23
|
+
parent.postMessage({ type: "isEditMode" }, window.location.origin);
|
|
24
|
+
window.addEventListener("message", (event) => {
|
|
25
|
+
var _a;
|
|
26
|
+
if (((_a = event.data) == null ? void 0 : _a.type) === "tina:editMode") {
|
|
27
|
+
setEdit(true);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}, []);
|
|
32
|
+
return { edit };
|
|
33
|
+
}
|
|
34
|
+
export { useEditState, useTina };
|
package/dist/react.js
CHANGED
|
@@ -23,6 +23,22 @@
|
|
|
23
23
|
}, [id]);
|
|
24
24
|
return { data };
|
|
25
25
|
}
|
|
26
|
+
function useEditState() {
|
|
27
|
+
const [edit, setEdit] = React__default["default"].useState(false);
|
|
28
|
+
React__default["default"].useEffect(() => {
|
|
29
|
+
if (typeof window !== "undefined") {
|
|
30
|
+
parent.postMessage({ type: "isEditMode" }, window.location.origin);
|
|
31
|
+
window.addEventListener("message", (event) => {
|
|
32
|
+
var _a;
|
|
33
|
+
if (((_a = event.data) == null ? void 0 : _a.type) === "tina:editMode") {
|
|
34
|
+
setEdit(true);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}, []);
|
|
39
|
+
return { edit };
|
|
40
|
+
}
|
|
41
|
+
exports2.useEditState = useEditState;
|
|
26
42
|
exports2.useTina = useTina;
|
|
27
43
|
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
28
44
|
});
|
|
@@ -57,6 +57,9 @@ declare type BaseComponents = {
|
|
|
57
57
|
ol?: {
|
|
58
58
|
children: JSX.Element;
|
|
59
59
|
};
|
|
60
|
+
li?: {
|
|
61
|
+
children: JSX.Element;
|
|
62
|
+
};
|
|
60
63
|
block_quote?: {
|
|
61
64
|
children: JSX.Element;
|
|
62
65
|
};
|
|
@@ -121,8 +124,10 @@ export declare type TinaMarkdownContent = {
|
|
|
121
124
|
type: string;
|
|
122
125
|
children: TinaMarkdownContent[];
|
|
123
126
|
};
|
|
124
|
-
export declare const TinaMarkdown:
|
|
127
|
+
export declare const TinaMarkdown: <CustomComponents extends {
|
|
128
|
+
[key: string]: object;
|
|
129
|
+
} = any>({ content, components, }: {
|
|
125
130
|
content: TinaMarkdownContent | TinaMarkdownContent[];
|
|
126
|
-
components?: Components<{}>;
|
|
131
|
+
components?: Components<{}> | Components<{ [BK in keyof CustomComponents]: (props: CustomComponents[BK]) => JSX.Element; }>;
|
|
127
132
|
}) => JSX.Element;
|
|
128
133
|
export {};
|
package/dist/tina-cms.d.ts
CHANGED
|
@@ -13,6 +13,11 @@ limitations under the License.
|
|
|
13
13
|
import type { formifyCallback } from './hooks/use-graphql-forms';
|
|
14
14
|
import { useDocumentCreatorPlugin } from './hooks/use-content-creator';
|
|
15
15
|
import { TinaCMSProviderDefaultProps } from './types/cms';
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated since version 1.0.
|
|
18
|
+
* Tina no longer requires wrapping your site in the TinaProvider
|
|
19
|
+
* See https://tina.io/blog/upgrading-to-iframe/ for full migration details
|
|
20
|
+
*/
|
|
16
21
|
export declare const TinaCMSProvider2: ({ query, documentCreatorCallback, formifyCallback, schema, ...props }: TinaCMSProviderDefaultProps) => JSX.Element;
|
|
17
22
|
export declare type DocumentCreatorCallback = Parameters<typeof useDocumentCreatorPlugin>[0];
|
|
18
23
|
export declare const TinaDataProvider: ({ children, formifyCallback, }: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinacms",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.70.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "./dist/index.es.js",
|
|
6
6
|
"exports": {
|
|
@@ -55,10 +55,11 @@
|
|
|
55
55
|
"@headlessui/react": "^1.5.0",
|
|
56
56
|
"@heroicons/react": "^1.0.4",
|
|
57
57
|
"@react-hook/window-size": "^3.0.7",
|
|
58
|
-
"@tinacms/schema-tools": "0.1
|
|
58
|
+
"@tinacms/schema-tools": "0.2.1",
|
|
59
59
|
"@tinacms/sharedctx": "0.1.3",
|
|
60
|
-
"@tinacms/toolkit": "0.58.
|
|
60
|
+
"@tinacms/toolkit": "0.58.5",
|
|
61
61
|
"crypto-js": "^4.0.0",
|
|
62
|
+
"encoding": "0.1.13",
|
|
62
63
|
"fetch-ponyfill": "^7.1.0",
|
|
63
64
|
"final-form": "4.20.1",
|
|
64
65
|
"graphql": "15.8.0",
|