@contentful/field-editor-reference 6.19.2-alpha.0 → 6.19.2-canary.7
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/common/EntityStore.js +4 -16
- package/dist/cjs/common/MultipleReferenceEditor.js +2 -1
- package/dist/cjs/common/SingleReferenceEditor.js +2 -1
- package/dist/esm/common/EntityStore.js +4 -16
- package/dist/esm/common/MultipleReferenceEditor.js +2 -1
- package/dist/esm/common/SingleReferenceEditor.js +2 -1
- package/package.json +3 -3
|
@@ -41,6 +41,7 @@ _export(exports, {
|
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
43
|
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
44
|
+
const _fieldeditorshared = require("@contentful/field-editor-shared");
|
|
44
45
|
const _constate = /*#__PURE__*/ _interop_require_default(require("constate"));
|
|
45
46
|
const _contentfulmanagement = require("contentful-management");
|
|
46
47
|
const _lodash = require("lodash");
|
|
@@ -162,18 +163,10 @@ async function fetchContentfulEntry({ urn, fetch, options }) {
|
|
|
162
163
|
const environmentId = resourceIdMatch?.groups?.environmentId || 'master';
|
|
163
164
|
const entryId = resourceIdMatch.groups.entityId;
|
|
164
165
|
const [space, entry] = await Promise.all([
|
|
165
|
-
fetch(
|
|
166
|
-
'space',
|
|
167
|
-
spaceId
|
|
168
|
-
], ({ cmaClient })=>cmaClient.space.get({
|
|
166
|
+
fetch((0, _fieldeditorshared.createGetSpaceKey)(spaceId), ({ cmaClient })=>cmaClient.space.get({
|
|
169
167
|
spaceId
|
|
170
168
|
}), options),
|
|
171
|
-
fetch(
|
|
172
|
-
'entry',
|
|
173
|
-
spaceId,
|
|
174
|
-
environmentId,
|
|
175
|
-
entryId
|
|
176
|
-
], ({ cmaClient })=>cmaClient.entry.get({
|
|
169
|
+
fetch((0, _fieldeditorshared.createGetEntryKey)(spaceId, environmentId, entryId), ({ cmaClient })=>cmaClient.entry.get({
|
|
177
170
|
spaceId,
|
|
178
171
|
environmentId,
|
|
179
172
|
entryId
|
|
@@ -181,12 +174,7 @@ async function fetchContentfulEntry({ urn, fetch, options }) {
|
|
|
181
174
|
]);
|
|
182
175
|
const contentTypeId = entry.sys.contentType.sys.id;
|
|
183
176
|
const [contentType, defaultLocaleCode] = await Promise.all([
|
|
184
|
-
fetch(
|
|
185
|
-
'contentType',
|
|
186
|
-
spaceId,
|
|
187
|
-
environmentId,
|
|
188
|
-
contentTypeId
|
|
189
|
-
], ({ cmaClient })=>cmaClient.contentType.get({
|
|
177
|
+
fetch((0, _fieldeditorshared.createGetContentTypeKey)(spaceId, environmentId, contentTypeId), ({ cmaClient })=>cmaClient.contentType.get({
|
|
190
178
|
contentTypeId,
|
|
191
179
|
spaceId,
|
|
192
180
|
environmentId
|
|
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "MultipleReferenceEditor", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
|
+
const _fieldeditorshared = require("@contentful/field-editor-shared");
|
|
12
13
|
const _sortable = require("@dnd-kit/sortable");
|
|
13
14
|
const _components = require("../components");
|
|
14
15
|
const _LinkEntityActions = require("../components/LinkActions/LinkEntityActions");
|
|
@@ -145,7 +146,7 @@ function Editor(props) {
|
|
|
145
146
|
}));
|
|
146
147
|
}
|
|
147
148
|
function MultipleReferenceEditor(props) {
|
|
148
|
-
const allContentTypes = props.sdk
|
|
149
|
+
const { contentTypes: allContentTypes } = (0, _fieldeditorshared.useContentTypes)(props.sdk);
|
|
149
150
|
return /*#__PURE__*/ _react.createElement(_ReferenceEditor.ReferenceEditor, props, ({ value, disabled, setValue, externalReset })=>{
|
|
150
151
|
return /*#__PURE__*/ _react.createElement(Editor, {
|
|
151
152
|
...props,
|
|
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "SingleReferenceEditor", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
12
|
+
const _fieldeditorshared = require("@contentful/field-editor-shared");
|
|
12
13
|
const _components = require("../components");
|
|
13
14
|
const _LinkEntityActions = require("../components/LinkActions/LinkEntityActions");
|
|
14
15
|
const _ReferenceEditor = require("./ReferenceEditor");
|
|
@@ -102,7 +103,7 @@ function Editor(props) {
|
|
|
102
103
|
});
|
|
103
104
|
}
|
|
104
105
|
function SingleReferenceEditor(props) {
|
|
105
|
-
const allContentTypes = props.sdk
|
|
106
|
+
const { contentTypes: allContentTypes } = (0, _fieldeditorshared.useContentTypes)(props.sdk);
|
|
106
107
|
return /*#__PURE__*/ _react.createElement(_ReferenceEditor.ReferenceEditor, props, ({ value, setValue, disabled, externalReset })=>{
|
|
107
108
|
return /*#__PURE__*/ _react.createElement(Editor, {
|
|
108
109
|
...props,
|
|
@@ -12,6 +12,7 @@ function _define_property(obj, key, value) {
|
|
|
12
12
|
return obj;
|
|
13
13
|
}
|
|
14
14
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
15
|
+
import { createGetContentTypeKey, createGetEntryKey, createGetSpaceKey } from '@contentful/field-editor-shared';
|
|
15
16
|
import constate from 'constate';
|
|
16
17
|
import { fetchAll } from 'contentful-management';
|
|
17
18
|
import { get } from 'lodash';
|
|
@@ -74,18 +75,10 @@ async function fetchContentfulEntry({ urn, fetch, options }) {
|
|
|
74
75
|
const environmentId = resourceIdMatch?.groups?.environmentId || 'master';
|
|
75
76
|
const entryId = resourceIdMatch.groups.entityId;
|
|
76
77
|
const [space, entry] = await Promise.all([
|
|
77
|
-
fetch(
|
|
78
|
-
'space',
|
|
79
|
-
spaceId
|
|
80
|
-
], ({ cmaClient })=>cmaClient.space.get({
|
|
78
|
+
fetch(createGetSpaceKey(spaceId), ({ cmaClient })=>cmaClient.space.get({
|
|
81
79
|
spaceId
|
|
82
80
|
}), options),
|
|
83
|
-
fetch(
|
|
84
|
-
'entry',
|
|
85
|
-
spaceId,
|
|
86
|
-
environmentId,
|
|
87
|
-
entryId
|
|
88
|
-
], ({ cmaClient })=>cmaClient.entry.get({
|
|
81
|
+
fetch(createGetEntryKey(spaceId, environmentId, entryId), ({ cmaClient })=>cmaClient.entry.get({
|
|
89
82
|
spaceId,
|
|
90
83
|
environmentId,
|
|
91
84
|
entryId
|
|
@@ -93,12 +86,7 @@ async function fetchContentfulEntry({ urn, fetch, options }) {
|
|
|
93
86
|
]);
|
|
94
87
|
const contentTypeId = entry.sys.contentType.sys.id;
|
|
95
88
|
const [contentType, defaultLocaleCode] = await Promise.all([
|
|
96
|
-
fetch(
|
|
97
|
-
'contentType',
|
|
98
|
-
spaceId,
|
|
99
|
-
environmentId,
|
|
100
|
-
contentTypeId
|
|
101
|
-
], ({ cmaClient })=>cmaClient.contentType.get({
|
|
89
|
+
fetch(createGetContentTypeKey(spaceId, environmentId, contentTypeId), ({ cmaClient })=>cmaClient.contentType.get({
|
|
102
90
|
contentTypeId,
|
|
103
91
|
spaceId,
|
|
104
92
|
environmentId
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
|
+
import { useContentTypes } from '@contentful/field-editor-shared';
|
|
3
4
|
import { arrayMove } from '@dnd-kit/sortable';
|
|
4
5
|
import { LinkEntityActions } from '../components';
|
|
5
6
|
import { useLinkActionsProps } from '../components/LinkActions/LinkEntityActions';
|
|
@@ -95,7 +96,7 @@ function Editor(props) {
|
|
|
95
96
|
}));
|
|
96
97
|
}
|
|
97
98
|
export function MultipleReferenceEditor(props) {
|
|
98
|
-
const allContentTypes = props.sdk
|
|
99
|
+
const { contentTypes: allContentTypes } = useContentTypes(props.sdk);
|
|
99
100
|
return /*#__PURE__*/ React.createElement(ReferenceEditor, props, ({ value, disabled, setValue, externalReset })=>{
|
|
100
101
|
return /*#__PURE__*/ React.createElement(Editor, {
|
|
101
102
|
...props,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
|
+
import { useContentTypes } from '@contentful/field-editor-shared';
|
|
3
4
|
import { LinkEntityActions } from '../components';
|
|
4
5
|
import { useLinkActionsProps } from '../components/LinkActions/LinkEntityActions';
|
|
5
6
|
import { ReferenceEditor } from './ReferenceEditor';
|
|
@@ -52,7 +53,7 @@ function Editor(props) {
|
|
|
52
53
|
});
|
|
53
54
|
}
|
|
54
55
|
export function SingleReferenceEditor(props) {
|
|
55
|
-
const allContentTypes = props.sdk
|
|
56
|
+
const { contentTypes: allContentTypes } = useContentTypes(props.sdk);
|
|
56
57
|
return /*#__PURE__*/ React.createElement(ReferenceEditor, props, ({ value, setValue, disabled, externalReset })=>{
|
|
57
58
|
return /*#__PURE__*/ React.createElement(Editor, {
|
|
58
59
|
...props,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-reference",
|
|
3
|
-
"version": "6.19.2-
|
|
3
|
+
"version": "6.19.2-canary.7+54b401aa",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@contentful/f36-components": "^5.8.1",
|
|
40
40
|
"@contentful/f36-icons": "^5.8.1",
|
|
41
41
|
"@contentful/f36-tokens": "^5.1.0",
|
|
42
|
-
"@contentful/field-editor-shared": "^2.17.1-
|
|
42
|
+
"@contentful/field-editor-shared": "^2.17.1-canary.59+54b401aa",
|
|
43
43
|
"@contentful/mimetype": "^2.2.29",
|
|
44
44
|
"@dnd-kit/core": "^6.0.8",
|
|
45
45
|
"@dnd-kit/sortable": "^8.0.0",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"registry": "https://npm.pkg.github.com/"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "54b401aa9908c8380c3801bf25fa38e23dff72d2"
|
|
72
72
|
}
|