@contentful/field-editor-rich-text 4.16.0 → 4.16.2

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.
@@ -24,9 +24,9 @@ const _platecommon = require("@udecode/plate-common");
24
24
  const _emotion = require("emotion");
25
25
  const _fastdeepequal = /*#__PURE__*/ _interop_require_default(require("fast-deep-equal"));
26
26
  const _noop = /*#__PURE__*/ _interop_require_default(require("lodash/noop"));
27
+ const _slatereact = require("slate-react");
27
28
  const _CharConstraints = require("./CharConstraints");
28
29
  const _ContentfulEditorProvider = require("./ContentfulEditorProvider");
29
- const _editoroverrides = require("./editor-overrides");
30
30
  const _toSlateValue = require("./helpers/toSlateValue");
31
31
  const _misc = require("./internal/misc");
32
32
  const _plugins = require("./plugins");
@@ -130,7 +130,7 @@ const ConnectedRichTextEditor = (props)=>{
130
130
  id: id,
131
131
  className: classNames,
132
132
  readOnly: props.isDisabled,
133
- scrollSelectionIntoView: _editoroverrides.defaultScrollSelectionIntoView
133
+ scrollSelectionIntoView: _slatereact.defaultScrollSelectionIntoView
134
134
  }), props.withCharValidation && /*#__PURE__*/ _react.createElement(_CharConstraints.CharConstraints, null))))));
135
135
  };
136
136
  const RichTextEditor = (props)=>{
@@ -6,9 +6,9 @@ import { PlateContent, Plate } from '@udecode/plate-common';
6
6
  import { css, cx } from 'emotion';
7
7
  import deepEquals from 'fast-deep-equal';
8
8
  import noop from 'lodash/noop';
9
+ import { defaultScrollSelectionIntoView } from 'slate-react';
9
10
  import { CharConstraints } from './CharConstraints';
10
11
  import { ContentfulEditorIdProvider, getContentfulEditorId } from './ContentfulEditorProvider';
11
- import { defaultScrollSelectionIntoView } from './editor-overrides';
12
12
  import { toSlateValue } from './helpers/toSlateValue';
13
13
  import { normalizeInitialValue } from './internal/misc';
14
14
  import { getPlugins, disableCorePlugins } from './plugins';
@@ -4,8 +4,8 @@
4
4
  import { MARKS } from '@contentful/rich-text-types';
5
5
  import * as p from '@udecode/plate-common';
6
6
  import * as s from 'slate';
7
+ import { DOMRange as SlateReactDomRange } from 'slate-dom';
7
8
  import * as sr from 'slate-react';
8
- import { DOMRange as SlateReactDomRange } from 'slate-react/dist/utils/dom';
9
9
  import type { SelectionMoveOptions as SlateSelectionMoveOptions, SelectionCollapseOptions as SlateSelectionCollapseOptions } from 'slate/dist/interfaces/transforms/selection';
10
10
  import type { TextInsertTextOptions as SlateTextInsertTextOptions } from 'slate/dist/interfaces/transforms/text';
11
11
  import { TrackingPluginActions } from '../../plugins/Tracking';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-rich-text",
3
- "version": "4.16.0",
3
+ "version": "4.16.2",
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": "^5.4.1",
45
45
  "@contentful/f36-tokens": "^5.1.0",
46
46
  "@contentful/f36-utils": "^5.1.0",
47
- "@contentful/field-editor-reference": "^6.15.0",
47
+ "@contentful/field-editor-reference": "^6.15.1",
48
48
  "@contentful/field-editor-shared": "^2.16.0",
49
49
  "@contentful/rich-text-plain-text-renderer": "^17.0.0",
50
50
  "@contentful/rich-text-types": "^17.0.0",
@@ -68,11 +68,11 @@
68
68
  "moment": "^2.20.0",
69
69
  "p-debounce": "^2.1.0",
70
70
  "react-popper": "^2.3.0",
71
- "scroll-into-view-if-needed": "^3.1.0",
72
- "slate": "0.94.1",
71
+ "slate": "0.118.1",
72
+ "slate-dom": "0.118.1",
73
73
  "slate-history": "0.100.0",
74
74
  "slate-hyperscript": "0.77.0",
75
- "slate-react": "0.102.0"
75
+ "slate-react": "0.118.2"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "@lingui/core": "^5.3.0",
@@ -85,11 +85,11 @@
85
85
  "@lingui/core": "5.3.0",
86
86
  "@types/is-hotkey": "^0.1.6",
87
87
  "@udecode/plate-test-utils": "^3.2.0",
88
- "prism-react-renderer": "2.4.0",
88
+ "prism-react-renderer": "2.4.1",
89
89
  "react": "18.3.1"
90
90
  },
91
91
  "publishConfig": {
92
92
  "registry": "https://npm.pkg.github.com/"
93
93
  },
94
- "gitHead": "e685baec786ae9c9a6e0660bdb17005304646593"
94
+ "gitHead": "4f962a8f4e7f93dbfeb560062223fd4aedcae112"
95
95
  }
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- _export_star(require("./scroll-selection-into-view"), exports);
6
- function _export_star(from, to) {
7
- Object.keys(from).forEach(function(k) {
8
- if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
9
- Object.defineProperty(to, k, {
10
- enumerable: true,
11
- get: function() {
12
- return from[k];
13
- }
14
- });
15
- }
16
- });
17
- return from;
18
- }
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "defaultScrollSelectionIntoView", {
6
- enumerable: true,
7
- get: function() {
8
- return defaultScrollSelectionIntoView;
9
- }
10
- });
11
- const _scrollintoviewifneeded = /*#__PURE__*/ _interop_require_default(require("scroll-into-view-if-needed"));
12
- const _internal = require("../internal");
13
- function _interop_require_default(obj) {
14
- return obj && obj.__esModule ? obj : {
15
- default: obj
16
- };
17
- }
18
- const defaultScrollSelectionIntoView = (editor, domRange)=>{
19
- if (domRange.getBoundingClientRect && (!editor.selection || editor.selection && _internal.Range.isCollapsed(editor.selection))) {
20
- const leafEl = domRange.startContainer.parentElement;
21
- const domRect = domRange.getBoundingClientRect();
22
- const isZeroDimensionRect = domRect.width === 0 && domRect.height === 0 && domRect.x === 0 && domRect.y === 0;
23
- if (isZeroDimensionRect) {
24
- const leafRect = leafEl.getBoundingClientRect();
25
- const leafHasDimensions = leafRect.width > 0 || leafRect.height > 0;
26
- if (leafHasDimensions) {
27
- return;
28
- }
29
- }
30
- leafEl.getBoundingClientRect = domRange.getBoundingClientRect.bind(domRange);
31
- (0, _scrollintoviewifneeded.default)(leafEl, {
32
- scrollMode: 'if-needed'
33
- });
34
- delete leafEl.getBoundingClientRect;
35
- }
36
- };
@@ -1 +0,0 @@
1
- export * from './scroll-selection-into-view';
@@ -1,21 +0,0 @@
1
- import scrollIntoView from 'scroll-into-view-if-needed';
2
- import { Range } from '../internal';
3
- export const defaultScrollSelectionIntoView = (editor, domRange)=>{
4
- if (domRange.getBoundingClientRect && (!editor.selection || editor.selection && Range.isCollapsed(editor.selection))) {
5
- const leafEl = domRange.startContainer.parentElement;
6
- const domRect = domRange.getBoundingClientRect();
7
- const isZeroDimensionRect = domRect.width === 0 && domRect.height === 0 && domRect.x === 0 && domRect.y === 0;
8
- if (isZeroDimensionRect) {
9
- const leafRect = leafEl.getBoundingClientRect();
10
- const leafHasDimensions = leafRect.width > 0 || leafRect.height > 0;
11
- if (leafHasDimensions) {
12
- return;
13
- }
14
- }
15
- leafEl.getBoundingClientRect = domRange.getBoundingClientRect.bind(domRange);
16
- scrollIntoView(leafEl, {
17
- scrollMode: 'if-needed'
18
- });
19
- delete leafEl.getBoundingClientRect;
20
- }
21
- };
@@ -1 +0,0 @@
1
- export * from './scroll-selection-into-view';
@@ -1,2 +0,0 @@
1
- import { DOMRange, ReactEditor } from '../internal';
2
- export declare const defaultScrollSelectionIntoView: (editor: ReactEditor, domRange: DOMRange) => void;