@contentful/field-editor-rich-text 4.2.6 → 4.3.0

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.
@@ -42,6 +42,7 @@ function getEntityTypeFromRichTextNode(nodeType) {
42
42
  }
43
43
  const newResourceEntitySelectorConfigFromRichTextField = (field, nodeType)=>{
44
44
  return {
45
- allowedResources: (0, _getAllowedResourcesForNodeType.default)(field, nodeType)
45
+ allowedResources: (0, _getAllowedResourcesForNodeType.default)(field, nodeType),
46
+ locale: field.locale
46
47
  };
47
48
  };
@@ -57,8 +57,10 @@ function _interop_require_wildcard(obj, nodeInterop) {
57
57
  }
58
58
  const { getEntryTitle, getEntityStatus } = _fieldeditorshared.entityHelpers;
59
59
  function FetchingWrappedResourceInlineCard(props) {
60
- const { link, onEntityFetchComplete } = props;
61
- const { data, status: requestStatus } = (0, _fieldeditorreference.useResource)(link.linkType, link.urn);
60
+ const { link, onEntityFetchComplete, sdk } = props;
61
+ const { data, status: requestStatus } = (0, _fieldeditorreference.useResource)(link.linkType, link.urn, {
62
+ locale: sdk.field.locale
63
+ });
62
64
  _react.useEffect(()=>{
63
65
  if (requestStatus === 'success') {
64
66
  onEntityFetchComplete?.();
@@ -173,7 +173,8 @@ function HyperlinkModal(props) {
173
173
  }
174
174
  async function selectResourceEntry() {
175
175
  const options = {
176
- allowedResources: (0, _getAllowedResourcesForNodeType.default)(props.sdk.field, _richtexttypes.INLINES.RESOURCE_HYPERLINK)
176
+ allowedResources: (0, _getAllowedResourcesForNodeType.default)(props.sdk.field, _richtexttypes.INLINES.RESOURCE_HYPERLINK),
177
+ locale: props.sdk.field.locale
177
178
  };
178
179
  const entityLink = await props.sdk.dialogs.selectSingleResourceEntity(options);
179
180
  if (entityLink) {
@@ -84,8 +84,10 @@ const InternalEntryCard = _react.memo((props)=>{
84
84
  }, _fastdeepequal.default);
85
85
  InternalEntryCard.displayName = 'ReferenceCard';
86
86
  const FetchingWrappedResourceCard = (props)=>{
87
- const { link, onEntityFetchComplete } = props;
88
- const { data, status, error } = (0, _fieldeditorreference.useResource)(link.linkType, link.urn);
87
+ const { link, onEntityFetchComplete, sdk } = props;
88
+ const { data, status, error } = (0, _fieldeditorreference.useResource)(link.linkType, link.urn, {
89
+ locale: sdk.field.locale
90
+ });
89
91
  _react.useEffect(()=>{
90
92
  if (status === 'success') {
91
93
  onEntityFetchComplete?.();
@@ -19,6 +19,7 @@ function getEntityTypeFromRichTextNode(nodeType) {
19
19
  }
20
20
  export const newResourceEntitySelectorConfigFromRichTextField = (field, nodeType)=>{
21
21
  return {
22
- allowedResources: getAllowedResourcesForNodeType(field, nodeType)
22
+ allowedResources: getAllowedResourcesForNodeType(field, nodeType),
23
+ locale: field.locale
23
24
  };
24
25
  };
@@ -6,8 +6,10 @@ import { INLINES } from '@contentful/rich-text-types';
6
6
  import { truncateTitle } from '../../plugins/shared/utils';
7
7
  const { getEntryTitle, getEntityStatus } = entityHelpers;
8
8
  export function FetchingWrappedResourceInlineCard(props) {
9
- const { link, onEntityFetchComplete } = props;
10
- const { data, status: requestStatus } = useResource(link.linkType, link.urn);
9
+ const { link, onEntityFetchComplete, sdk } = props;
10
+ const { data, status: requestStatus } = useResource(link.linkType, link.urn, {
11
+ locale: sdk.field.locale
12
+ });
11
13
  React.useEffect(()=>{
12
14
  if (requestStatus === 'success') {
13
15
  onEntityFetchComplete?.();
@@ -109,7 +109,8 @@ export function HyperlinkModal(props) {
109
109
  }
110
110
  async function selectResourceEntry() {
111
111
  const options = {
112
- allowedResources: getAllowedResourcesForNodeType(props.sdk.field, INLINES.RESOURCE_HYPERLINK)
112
+ allowedResources: getAllowedResourcesForNodeType(props.sdk.field, INLINES.RESOURCE_HYPERLINK),
113
+ locale: props.sdk.field.locale
113
114
  };
114
115
  const entityLink = await props.sdk.dialogs.selectSingleResourceEntity(options);
115
116
  if (entityLink) {
@@ -28,8 +28,10 @@ const InternalEntryCard = React.memo((props)=>{
28
28
  }, areEqual);
29
29
  InternalEntryCard.displayName = 'ReferenceCard';
30
30
  export const FetchingWrappedResourceCard = (props)=>{
31
- const { link, onEntityFetchComplete } = props;
32
- const { data, status, error } = useResource(link.linkType, link.urn);
31
+ const { link, onEntityFetchComplete, sdk } = props;
32
+ const { data, status, error } = useResource(link.linkType, link.urn, {
33
+ locale: sdk.field.locale
34
+ });
33
35
  React.useEffect(()=>{
34
36
  if (status === 'success') {
35
37
  onEntityFetchComplete?.();
@@ -29,5 +29,6 @@ export declare const newResourceEntitySelectorConfigFromRichTextField: (field: a
29
29
  source: string;
30
30
  contentTypes: string[];
31
31
  }[];
32
+ locale: any;
32
33
  };
33
34
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-rich-text",
3
- "version": "4.2.6",
3
+ "version": "4.3.0",
4
4
  "source": "./src/index.tsx",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -44,7 +44,7 @@
44
44
  "@contentful/f36-icons": "^4.29.0",
45
45
  "@contentful/f36-tokens": "^4.0.5",
46
46
  "@contentful/f36-utils": "^4.24.3",
47
- "@contentful/field-editor-reference": "^6.4.5",
47
+ "@contentful/field-editor-reference": "^6.5.0",
48
48
  "@contentful/field-editor-shared": "^2.3.2",
49
49
  "@contentful/rich-text-plain-text-renderer": "^17.0.0",
50
50
  "@contentful/rich-text-types": "^17.0.0",
@@ -86,5 +86,5 @@
86
86
  "publishConfig": {
87
87
  "registry": "https://npm.pkg.github.com/"
88
88
  },
89
- "gitHead": "818d5f85db9f0d8db39fc41a6019efb958c7b513"
89
+ "gitHead": "f40a4a992e37c353214b87da74b1fccdf5559a8b"
90
90
  }