@contentful/field-editor-rich-text 6.4.4-canary.9 → 6.4.4

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.
@@ -20,7 +20,6 @@ const _Break = require("./Break");
20
20
  const _CharCounter = require("./CharCounter");
21
21
  const _CommandPalette = require("./CommandPalette");
22
22
  const _useCommands = require("./CommandPalette/useCommands");
23
- const _createSelectionSyncPlugin = require("./createSelectionSyncPlugin");
24
23
  const _DeserializeDocx = require("./DeserializeDocx");
25
24
  const _DragAndDrop = require("./DragAndDrop");
26
25
  const _EmbeddedEntityBlock = require("./EmbeddedEntityBlock");
@@ -45,7 +44,6 @@ const _Voids = require("./Voids");
45
44
  const getPlugins = (sdk, onAction, restrictedMarks, withCharValidation)=>[
46
45
  (0, _DeserializeDocx.createDeserializeDocxPlugin)(),
47
46
  (0, _Tracking.createTrackingPlugin)(onAction),
48
- (0, _createSelectionSyncPlugin.createSelectionSyncPlugin)(),
49
47
  (0, _DragAndDrop.createDragAndDropPlugin)(),
50
48
  ...Object.values((0, _useCommands.isCommandPromptPluginEnabled)(sdk)).some(Boolean) ? [
51
49
  (0, _CommandPalette.createCommandPalettePlugin)()
@@ -2,7 +2,6 @@ import { createSoftBreakPlugin, createExitBreakPlugin, createResetNodePlugin } f
2
2
  import { createCharCounterPlugin } from './CharCounter';
3
3
  import { createCommandPalettePlugin } from './CommandPalette';
4
4
  import { isCommandPromptPluginEnabled } from './CommandPalette/useCommands';
5
- import { createSelectionSyncPlugin } from './createSelectionSyncPlugin';
6
5
  import { createDeserializeDocxPlugin } from './DeserializeDocx';
7
6
  import { createDragAndDropPlugin } from './DragAndDrop';
8
7
  import { createEmbeddedAssetBlockPlugin, createEmbeddedEntryBlockPlugin } from './EmbeddedEntityBlock';
@@ -27,7 +26,6 @@ import { createVoidsPlugin } from './Voids';
27
26
  export const getPlugins = (sdk, onAction, restrictedMarks, withCharValidation)=>[
28
27
  createDeserializeDocxPlugin(),
29
28
  createTrackingPlugin(onAction),
30
- createSelectionSyncPlugin(),
31
29
  createDragAndDropPlugin(),
32
30
  ...Object.values(isCommandPromptPluginEnabled(sdk)).some(Boolean) ? [
33
31
  createCommandPalettePlugin()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/field-editor-rich-text",
3
- "version": "6.4.4-canary.9+156377b9",
3
+ "version": "6.4.4",
4
4
  "source": "./src/index.tsx",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -94,5 +94,5 @@
94
94
  "publishConfig": {
95
95
  "registry": "https://npm.pkg.github.com/"
96
96
  },
97
- "gitHead": "156377b9509badb58c20020657be6d67702cc691"
97
+ "gitHead": "515df2cbdfa9ce00c1d1843c757d50bef08f5446"
98
98
  }
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "createSelectionSyncPlugin", {
6
- enumerable: true,
7
- get: function() {
8
- return createSelectionSyncPlugin;
9
- }
10
- });
11
- const _platecommon = require("@udecode/plate-common");
12
- const syncSelection = (editor)=>{
13
- const selection = (0, _platecommon.getEditorWindow)(editor)?.getSelection();
14
- if (!selection || !(0, _platecommon.hasEditorTarget)(editor, selection.anchorNode) || !(0, _platecommon.hasEditorTarget)(editor, selection.focusNode)) {
15
- return;
16
- }
17
- const range = (0, _platecommon.toSlateRange)(editor, selection, {
18
- exactMatch: false,
19
- suppressThrow: true
20
- });
21
- if (range && !(0, _platecommon.getVoidNode)(editor, {
22
- at: range.anchor
23
- }) && !(0, _platecommon.getVoidNode)(editor, {
24
- at: range.focus
25
- })) (0, _platecommon.select)(editor, range);
26
- };
27
- const createSelectionSyncPlugin = ()=>({
28
- key: 'selectionSync',
29
- handlers: {
30
- onMouseUp: (editor)=>()=>{
31
- if (!(0, _platecommon.isComposing)(editor)) syncSelection(editor);
32
- },
33
- onKeyDown: (editor)=>(event)=>{
34
- if ([
35
- 'ArrowLeft',
36
- 'ArrowRight',
37
- 'Backspace',
38
- 'Delete'
39
- ].includes(event.key) && !(!(0, _platecommon.isEditorFocused)(editor) && editor.selection && (0, _platecommon.getVoidNode)(editor, {
40
- at: editor.selection.focus
41
- })) && !event.nativeEvent.isComposing && !(0, _platecommon.isComposing)(editor)) syncSelection(editor);
42
- },
43
- onCompositionStart: (editor)=>()=>{
44
- if (!(0, _platecommon.isComposing)(editor)) syncSelection(editor);
45
- },
46
- onDOMBeforeInput: (editor)=>(event)=>{
47
- const input = 'nativeEvent' in event ? event.nativeEvent : event;
48
- if (input.inputType !== 'insertText' && !input.inputType.startsWith('delete') || input.isComposing || (0, _platecommon.isComposing)(editor)) return;
49
- syncSelection(editor);
50
- }
51
- }
52
- });
@@ -1,42 +0,0 @@
1
- import { getEditorWindow, getVoidNode, hasEditorTarget, isComposing, isEditorFocused, select, toSlateRange } from '@udecode/plate-common';
2
- const syncSelection = (editor)=>{
3
- const selection = getEditorWindow(editor)?.getSelection();
4
- if (!selection || !hasEditorTarget(editor, selection.anchorNode) || !hasEditorTarget(editor, selection.focusNode)) {
5
- return;
6
- }
7
- const range = toSlateRange(editor, selection, {
8
- exactMatch: false,
9
- suppressThrow: true
10
- });
11
- if (range && !getVoidNode(editor, {
12
- at: range.anchor
13
- }) && !getVoidNode(editor, {
14
- at: range.focus
15
- })) select(editor, range);
16
- };
17
- export const createSelectionSyncPlugin = ()=>({
18
- key: 'selectionSync',
19
- handlers: {
20
- onMouseUp: (editor)=>()=>{
21
- if (!isComposing(editor)) syncSelection(editor);
22
- },
23
- onKeyDown: (editor)=>(event)=>{
24
- if ([
25
- 'ArrowLeft',
26
- 'ArrowRight',
27
- 'Backspace',
28
- 'Delete'
29
- ].includes(event.key) && !(!isEditorFocused(editor) && editor.selection && getVoidNode(editor, {
30
- at: editor.selection.focus
31
- })) && !event.nativeEvent.isComposing && !isComposing(editor)) syncSelection(editor);
32
- },
33
- onCompositionStart: (editor)=>()=>{
34
- if (!isComposing(editor)) syncSelection(editor);
35
- },
36
- onDOMBeforeInput: (editor)=>(event)=>{
37
- const input = 'nativeEvent' in event ? event.nativeEvent : event;
38
- if (input.inputType !== 'insertText' && !input.inputType.startsWith('delete') || input.isComposing || isComposing(editor)) return;
39
- syncSelection(editor);
40
- }
41
- }
42
- });
@@ -1,2 +0,0 @@
1
- import { PlatePlugin } from '../internal/types';
2
- export declare const createSelectionSyncPlugin: () => PlatePlugin;