@contentful/field-editor-rich-text 6.6.13 → 6.6.14-canary.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/README.md CHANGED
@@ -10,11 +10,6 @@ This package contains a React `RichTextEditor` component that is used as the def
10
10
  import { RichTextEditor } from '@contentful/field-editor-rich-text';
11
11
  ```
12
12
 
13
- Pass `withSelectionSync={true}` to opt in to synchronizing the browser caret before editing.
14
- It defaults to `false`; the plugin is omitted when disabled. Resolve the feature flag before
15
- mounting the editor. This setting applies when the editor is created, so later changes require
16
- reopening or remounting the editor.
17
-
18
13
  ## ⚠️ Important: Package Configuration
19
14
 
20
15
  Plate 53.3.14 pins `slate-react` to 0.126.4. To use the latest Slate React version tested by this package (0.127.1), update existing overrides in your application as shown below. Package-manager overrides in this repository are not inherited by applications that install the published package.
@@ -84,14 +84,13 @@ function _interop_require_wildcard(obj, nodeInterop) {
84
84
  return newObj;
85
85
  }
86
86
  const ConnectedRichTextEditor = _react.memo(function ConnectedRichTextEditor(props) {
87
- const { sdk, onAction, restrictedMarks, withCharValidation, withSelectionSync } = props;
87
+ const { sdk, onAction, restrictedMarks, withCharValidation } = props;
88
88
  const id = (0, _ContentfulEditorProvider.getContentfulEditorId)(sdk);
89
- const plugins = _react.useMemo(()=>(0, _plugins.getPlugins)(sdk, onAction ?? _noop.default, restrictedMarks, withCharValidation, withSelectionSync), [
89
+ const plugins = _react.useMemo(()=>(0, _plugins.getPlugins)(sdk, onAction ?? _noop.default, restrictedMarks, withCharValidation), [
90
90
  sdk,
91
91
  onAction,
92
92
  restrictedMarks,
93
- withCharValidation,
94
- withSelectionSync
93
+ withCharValidation
95
94
  ]);
96
95
  const initialValue = (0, _usedeepcompare.useDeepCompareMemo)(()=>{
97
96
  return (0, _toSlateDoc.toSlateDoc)(props.value);
@@ -210,18 +210,14 @@ const _createTestEditor = require("../../test-utils/createTestEditor");
210
210
  _richtexttypes.BLOCKS.PARAGRAPH
211
211
  ]);
212
212
  });
213
- _vitest.it.each([
214
- undefined,
215
- false,
216
- true
217
- ])('registers caret sync only when explicitly enabled (%s)', (enabled)=>{
213
+ (0, _vitest.it)('always registers caret sync', ()=>{
218
214
  const sdk = {
219
215
  field: {
220
216
  validation: []
221
217
  }
222
218
  };
223
219
  const { editor } = (0, _createTestEditor.createTestEditor)({
224
- plugins: (0, _plugins.getPlugins)(sdk, _vitest.vi.fn(), undefined, undefined, enabled)
220
+ plugins: (0, _plugins.getPlugins)(sdk, _vitest.vi.fn())
225
221
  });
226
- (0, _vitest.expect)(editor.plugins.selectionSync !== undefined).toBe(enabled === true);
222
+ (0, _vitest.expect)(editor.plugins.selectionSync).toBeDefined();
227
223
  });
@@ -34,12 +34,10 @@ const _Text = require("./Text");
34
34
  const _Tracking = require("./Tracking");
35
35
  const _TrailingParagraph = require("./TrailingParagraph");
36
36
  const _Voids = require("./Voids");
37
- const getPlugins = (sdk, onAction, restrictedMarks, withCharValidation, withSelectionSync = false)=>[
37
+ const getPlugins = (sdk, onAction, restrictedMarks, withCharValidation)=>[
38
38
  (0, _DeserializeDocx.createDeserializeDocxPlugin)(),
39
39
  (0, _Tracking.createTrackingPlugin)(onAction),
40
- ...withSelectionSync ? [
41
- (0, _createSelectionSyncPlugin.createSelectionSyncPlugin)()
42
- ] : [],
40
+ (0, _createSelectionSyncPlugin.createSelectionSyncPlugin)(),
43
41
  (0, _DragAndDrop.createDragAndDropPlugin)(),
44
42
  ...Object.values((0, _useCommands.isCommandPromptPluginEnabled)(sdk)).some(Boolean) ? [
45
43
  (0, _CommandPalette.createCommandPalettePlugin)()
@@ -20,14 +20,13 @@ import { SyncEditorChanges } from './SyncEditorChanges';
20
20
  import Toolbar from './Toolbar';
21
21
  import StickyToolbarWrapper from './Toolbar/components/StickyToolbarWrapper';
22
22
  export const ConnectedRichTextEditor = React.memo(function ConnectedRichTextEditor(props) {
23
- const { sdk, onAction, restrictedMarks, withCharValidation, withSelectionSync } = props;
23
+ const { sdk, onAction, restrictedMarks, withCharValidation } = props;
24
24
  const id = getContentfulEditorId(sdk);
25
- const plugins = React.useMemo(()=>getPlugins(sdk, onAction ?? noop, restrictedMarks, withCharValidation, withSelectionSync), [
25
+ const plugins = React.useMemo(()=>getPlugins(sdk, onAction ?? noop, restrictedMarks, withCharValidation), [
26
26
  sdk,
27
27
  onAction,
28
28
  restrictedMarks,
29
- withCharValidation,
30
- withSelectionSync
29
+ withCharValidation
31
30
  ]);
32
31
  const initialValue = useDeepCompareMemo(()=>{
33
32
  return toSlateDoc(props.value);
@@ -206,18 +206,14 @@ it('unwraps an empty quote on Backspace', ()=>{
206
206
  BLOCKS.PARAGRAPH
207
207
  ]);
208
208
  });
209
- it.each([
210
- undefined,
211
- false,
212
- true
213
- ])('registers caret sync only when explicitly enabled (%s)', (enabled)=>{
209
+ it('always registers caret sync', ()=>{
214
210
  const sdk = {
215
211
  field: {
216
212
  validation: []
217
213
  }
218
214
  };
219
215
  const { editor } = createTestEditor({
220
- plugins: getPlugins(sdk, vi.fn(), undefined, undefined, enabled)
216
+ plugins: getPlugins(sdk, vi.fn())
221
217
  });
222
- expect(editor.plugins.selectionSync !== undefined).toBe(enabled === true);
218
+ expect(editor.plugins.selectionSync).toBeDefined();
223
219
  });
@@ -24,12 +24,10 @@ import { createTextPlugin } from './Text';
24
24
  import { createTrackingPlugin } from './Tracking';
25
25
  import { createTrailingParagraphPlugin } from './TrailingParagraph';
26
26
  import { createVoidsPlugin } from './Voids';
27
- export const getPlugins = (sdk, onAction, restrictedMarks, withCharValidation, withSelectionSync = false)=>[
27
+ export const getPlugins = (sdk, onAction, restrictedMarks, withCharValidation)=>[
28
28
  createDeserializeDocxPlugin(),
29
29
  createTrackingPlugin(onAction),
30
- ...withSelectionSync ? [
31
- createSelectionSyncPlugin()
32
- ] : [],
30
+ createSelectionSyncPlugin(),
33
31
  createDragAndDropPlugin(),
34
32
  ...Object.values(isCommandPromptPluginEnabled(sdk)).some(Boolean) ? [
35
33
  createCommandPalettePlugin()
@@ -19,8 +19,6 @@ type RichTextProps = {
19
19
  */
20
20
  onChange?: (doc: Contentful.Document) => unknown;
21
21
  withCharValidation?: boolean;
22
- /** Enable caret syncing at editor creation. Defaults to false; remount to change it. */
23
- withSelectionSync?: boolean;
24
22
  queryClient?: QueryClient;
25
23
  };
26
24
  type ConnectedRichTextProps = {
@@ -36,7 +34,6 @@ type ConnectedRichTextProps = {
36
34
  actionsDisabled?: boolean;
37
35
  stickyToolbarOffset?: number;
38
36
  withCharValidation?: boolean;
39
- withSelectionSync?: boolean;
40
37
  queryClient?: QueryClient;
41
38
  };
42
39
  export declare const ConnectedRichTextEditor: React.NamedExoticComponent<ConnectedRichTextProps>;
@@ -1,4 +1,4 @@
1
1
  import { FieldAppSDK } from '@contentful/app-sdk';
2
2
  import { PlatePlugin } from '../internal/types';
3
3
  import { RichTextTrackingActionHandler } from './Tracking';
4
- export declare const getPlugins: (sdk: FieldAppSDK, onAction: RichTextTrackingActionHandler, restrictedMarks?: string[], withCharValidation?: boolean, withSelectionSync?: boolean) => PlatePlugin[];
4
+ export declare const getPlugins: (sdk: FieldAppSDK, onAction: RichTextTrackingActionHandler, restrictedMarks?: string[], withCharValidation?: boolean) => PlatePlugin[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-rich-text",
3
- "version": "6.6.13",
3
+ "version": "6.6.14-canary.1+01bd1473",
4
4
  "source": "./src/index.tsx",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -96,5 +96,5 @@
96
96
  "prettier --write"
97
97
  ]
98
98
  },
99
- "gitHead": "af63f65d3de15f82d4fa356aaaaedf4d3a3a7f5b"
99
+ "gitHead": "01bd1473053db3042b2cfa1c25734cbbca4ea3ba"
100
100
  }