@contentful/field-editor-rich-text 6.6.14-canary.0 → 6.6.14

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);
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  const _richtexttypes = require("@contentful/rich-text-types");
6
6
  const _platejs = require("platejs");
7
7
  const _vitest = require("vitest");
8
- const _plugins = require("../../plugins");
9
8
  const _Paragraph = require("../../plugins/Paragraph/Paragraph");
10
9
  const _sanitizeHTML = require("../../plugins/PasteHTML/utils/sanitizeHTML");
11
10
  const _Cell = require("../../plugins/Table/components/Cell");
@@ -210,18 +209,3 @@ const _createTestEditor = require("../../test-utils/createTestEditor");
210
209
  _richtexttypes.BLOCKS.PARAGRAPH
211
210
  ]);
212
211
  });
213
- _vitest.it.each([
214
- undefined,
215
- false,
216
- true
217
- ])('registers caret sync only when explicitly enabled (%s)', (enabled)=>{
218
- const sdk = {
219
- field: {
220
- validation: []
221
- }
222
- };
223
- const { editor } = (0, _createTestEditor.createTestEditor)({
224
- plugins: (0, _plugins.getPlugins)(sdk, _vitest.vi.fn(), undefined, undefined, enabled)
225
- });
226
- (0, _vitest.expect)(editor.plugins.selectionSync !== undefined).toBe(enabled === true);
227
- });
@@ -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);
@@ -1,7 +1,6 @@
1
1
  import { BLOCKS } from '@contentful/rich-text-types';
2
2
  import { getPluginByType, getPluginType, KEYS } from 'platejs';
3
3
  import { expect, it, vi } from 'vitest';
4
- import { getPlugins } from '../../plugins';
5
4
  import { Paragraph } from '../../plugins/Paragraph/Paragraph';
6
5
  import { sanitizeHTML } from '../../plugins/PasteHTML/utils/sanitizeHTML';
7
6
  import { Cell } from '../../plugins/Table/components/Cell';
@@ -206,18 +205,3 @@ it('unwraps an empty quote on Backspace', ()=>{
206
205
  BLOCKS.PARAGRAPH
207
206
  ]);
208
207
  });
209
- it.each([
210
- undefined,
211
- false,
212
- true
213
- ])('registers caret sync only when explicitly enabled (%s)', (enabled)=>{
214
- const sdk = {
215
- field: {
216
- validation: []
217
- }
218
- };
219
- const { editor } = createTestEditor({
220
- plugins: getPlugins(sdk, vi.fn(), undefined, undefined, enabled)
221
- });
222
- expect(editor.plugins.selectionSync !== undefined).toBe(enabled === true);
223
- });
@@ -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.14-canary.0+eb2f67c7",
3
+ "version": "6.6.14",
4
4
  "source": "./src/index.tsx",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -46,8 +46,8 @@
46
46
  "@contentful/f36-icons": "^6.7.1",
47
47
  "@contentful/f36-tokens": "^6.1.2",
48
48
  "@contentful/f36-utils": "^6.1.0",
49
- "@contentful/field-editor-reference": "^8.5.6-canary.0+eb2f67c7",
50
- "@contentful/field-editor-shared": "^4.6.4-canary.0+eb2f67c7",
49
+ "@contentful/field-editor-reference": "^8.5.5",
50
+ "@contentful/field-editor-shared": "^4.6.3",
51
51
  "@contentful/rich-text-plain-text-renderer": "^17.2.1",
52
52
  "@contentful/rich-text-types": "^17.2.7",
53
53
  "@emotion/css": "^11.13.5",
@@ -96,5 +96,5 @@
96
96
  "prettier --write"
97
97
  ]
98
98
  },
99
- "gitHead": "eb2f67c7309a6cba329967a547f866a074ca2c74"
99
+ "gitHead": "9742da65a3db578d2a4051c521ea9c1acd33c256"
100
100
  }