@contentful/field-editor-rich-text 2.3.6 → 2.3.9
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/CHANGELOG.md +16 -0
- package/dist/field-editor-rich-text.cjs.development.js +35 -4
- package/dist/field-editor-rich-text.cjs.development.js.map +1 -1
- package/dist/field-editor-rich-text.cjs.production.min.js +1 -1
- package/dist/field-editor-rich-text.cjs.production.min.js.map +1 -1
- package/dist/field-editor-rich-text.esm.js +36 -5
- package/dist/field-editor-rich-text.esm.js.map +1 -1
- package/dist/plugins/shared/useStableCallback.d.ts +6 -0
- package/package.json +3 -3
- package/dist/plugins/EmbeddedEntityBlock/FetchingWrappedAssetCard.d.ts +0 -15
- package/dist/plugins/EmbeddedEntityBlock/FetchingWrappedEntryCard.d.ts +0 -15
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.3.9](https://github.com/contentful/field-editors/compare/@contentful/field-editor-rich-text@2.3.8...@contentful/field-editor-rich-text@2.3.9) (2022-07-21)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @contentful/field-editor-rich-text
|
|
9
|
+
|
|
10
|
+
## [2.3.8](https://github.com/contentful/field-editors/compare/@contentful/field-editor-rich-text@2.3.7...@contentful/field-editor-rich-text@2.3.8) (2022-07-21)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- no embedded entries check rich text commands [TOL-273] ([#1192](https://github.com/contentful/field-editors/issues/1192)) ([c9983cf](https://github.com/contentful/field-editors/commit/c9983cf183ce95993b7cb1fb1a23728d373df736))
|
|
15
|
+
|
|
16
|
+
## [2.3.7](https://github.com/contentful/field-editors/compare/@contentful/field-editor-rich-text@2.3.6...@contentful/field-editor-rich-text@2.3.7) (2022-07-19)
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
- **rich-text:** avoid unnecessary render of reference cards ([#1189](https://github.com/contentful/field-editors/issues/1189)) ([b253014](https://github.com/contentful/field-editors/commit/b2530144857ea9b82259c6fbae02875f0692a62a))
|
|
21
|
+
|
|
6
22
|
## [2.3.6](https://github.com/contentful/field-editors/compare/@contentful/field-editor-rich-text@2.3.5...@contentful/field-editor-rich-text@2.3.6) (2022-07-19)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @contentful/field-editor-rich-text
|
|
@@ -373,6 +373,10 @@ var _constate = /*#__PURE__*/constate(useSdk),
|
|
|
373
373
|
var useCommandList = function useCommandList(commandItems, container) {
|
|
374
374
|
var _React$useState = React.useState(function () {
|
|
375
375
|
// select the first item on initial render
|
|
376
|
+
if (!commandItems.length) {
|
|
377
|
+
return '';
|
|
378
|
+
}
|
|
379
|
+
|
|
376
380
|
if ('group' in commandItems[0]) {
|
|
377
381
|
return commandItems[0].commands[0].id;
|
|
378
382
|
}
|
|
@@ -2186,6 +2190,27 @@ function useFetchedEntity(_ref) {
|
|
|
2186
2190
|
return entity;
|
|
2187
2191
|
}
|
|
2188
2192
|
|
|
2193
|
+
/**
|
|
2194
|
+
* A userland implementation of useEvent RFC
|
|
2195
|
+
*
|
|
2196
|
+
* See: https://github.com/reactjs/rfcs/pull/220
|
|
2197
|
+
*/
|
|
2198
|
+
|
|
2199
|
+
var useStableCallback = function useStableCallback(callback) {
|
|
2200
|
+
var callbackRef = React.useRef(callback); // Makes sure the callbackRef points to the latest `callback` props
|
|
2201
|
+
// The useLayoutEffect is here for concurrent safety. It has the
|
|
2202
|
+
// disadvantage of not being able to use the result callback during
|
|
2203
|
+
// the render but that's Ok.
|
|
2204
|
+
|
|
2205
|
+
React.useLayoutEffect(function () {
|
|
2206
|
+
callbackRef.current = callback;
|
|
2207
|
+
}); // The stable callback that won't change
|
|
2208
|
+
|
|
2209
|
+
return React.useCallback(function () {
|
|
2210
|
+
return callbackRef.current.apply(callbackRef, arguments);
|
|
2211
|
+
}, []);
|
|
2212
|
+
};
|
|
2213
|
+
|
|
2189
2214
|
var InternalAssetCard = /*#__PURE__*/React.memo(function (props) {
|
|
2190
2215
|
if (props.asset === undefined) {
|
|
2191
2216
|
return /*#__PURE__*/React.createElement(f36Components.AssetCard, {
|
|
@@ -2221,8 +2246,11 @@ function FetchingWrappedAssetCard(props) {
|
|
|
2221
2246
|
assetId = props.assetId;
|
|
2222
2247
|
|
|
2223
2248
|
var _useEntities = fieldEditorReference.useEntities(),
|
|
2224
|
-
loadEntityScheduledActions = _useEntities.loadEntityScheduledActions;
|
|
2249
|
+
loadEntityScheduledActions = _useEntities.loadEntityScheduledActions; // FIXME: remove when useEntities() has been refactored to avoid
|
|
2250
|
+
// unnecessary re-rendering
|
|
2251
|
+
|
|
2225
2252
|
|
|
2253
|
+
var stableLoadEntityScheduledActions = useStableCallback(loadEntityScheduledActions);
|
|
2226
2254
|
var asset = useFetchedEntity({
|
|
2227
2255
|
type: 'Asset',
|
|
2228
2256
|
id: assetId,
|
|
@@ -2233,7 +2261,7 @@ function FetchingWrappedAssetCard(props) {
|
|
|
2233
2261
|
sdk: props.sdk,
|
|
2234
2262
|
isDisabled: props.isDisabled,
|
|
2235
2263
|
isSelected: props.isSelected,
|
|
2236
|
-
loadEntityScheduledActions:
|
|
2264
|
+
loadEntityScheduledActions: stableLoadEntityScheduledActions,
|
|
2237
2265
|
locale: props.locale,
|
|
2238
2266
|
onEdit: props.onEdit,
|
|
2239
2267
|
onRemove: props.onRemove
|
|
@@ -2283,8 +2311,11 @@ var FetchingWrappedEntryCard = function FetchingWrappedEntryCard(props) {
|
|
|
2283
2311
|
onEntityFetchComplete = props.onEntityFetchComplete;
|
|
2284
2312
|
|
|
2285
2313
|
var _useEntities = fieldEditorReference.useEntities(),
|
|
2286
|
-
loadEntityScheduledActions = _useEntities.loadEntityScheduledActions;
|
|
2314
|
+
loadEntityScheduledActions = _useEntities.loadEntityScheduledActions; // FIXME: remove when useEntities() has been refactored to avoid
|
|
2315
|
+
// unnecessary re-rendering
|
|
2316
|
+
|
|
2287
2317
|
|
|
2318
|
+
var stableLoadEntityScheduledActions = useStableCallback(loadEntityScheduledActions);
|
|
2288
2319
|
var entry = useFetchedEntity({
|
|
2289
2320
|
type: 'Entry',
|
|
2290
2321
|
id: entryId,
|
|
@@ -2298,7 +2329,7 @@ var FetchingWrappedEntryCard = function FetchingWrappedEntryCard(props) {
|
|
|
2298
2329
|
isSelected: props.isSelected,
|
|
2299
2330
|
onEdit: props.onEdit,
|
|
2300
2331
|
onRemove: props.onRemove,
|
|
2301
|
-
loadEntityScheduledActions:
|
|
2332
|
+
loadEntityScheduledActions: stableLoadEntityScheduledActions
|
|
2302
2333
|
});
|
|
2303
2334
|
};
|
|
2304
2335
|
|