@contentful/field-editor-rich-text 2.0.0-next.1 → 2.0.0-next.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +410 -0
  2. package/dist/field-editor-rich-text.cjs.development.js +569 -317
  3. package/dist/field-editor-rich-text.cjs.development.js.map +1 -1
  4. package/dist/field-editor-rich-text.cjs.production.min.js +1 -1
  5. package/dist/field-editor-rich-text.cjs.production.min.js.map +1 -1
  6. package/dist/field-editor-rich-text.esm.js +467 -215
  7. package/dist/field-editor-rich-text.esm.js.map +1 -1
  8. package/dist/helpers/deserializer.d.ts +1 -1
  9. package/dist/helpers/editor.d.ts +8 -3
  10. package/dist/helpers/normalizers.d.ts +15 -0
  11. package/dist/plugins/Bold/index.d.ts +1 -1
  12. package/dist/plugins/Code/index.d.ts +1 -1
  13. package/dist/plugins/DragAndDrop/index.d.ts +1 -1
  14. package/dist/plugins/EmbeddedEntityBlock/index.d.ts +1 -1
  15. package/dist/plugins/EmbeddedEntityInline/index.d.ts +1 -1
  16. package/dist/plugins/Heading/index.d.ts +1 -1
  17. package/dist/plugins/Hr/index.d.ts +1 -1
  18. package/dist/plugins/Hyperlink/HyperlinkModal.d.ts +1 -1
  19. package/dist/plugins/Hyperlink/index.d.ts +1 -1
  20. package/dist/plugins/InsertBeforeFirstVoidBlock/index.d.ts +1 -1
  21. package/dist/plugins/Italic/index.d.ts +1 -1
  22. package/dist/plugins/List/getListInsertFragment.d.ts +1 -1
  23. package/dist/plugins/List/index.d.ts +1 -1
  24. package/dist/plugins/NewLine/index.d.ts +1 -1
  25. package/dist/plugins/Paragraph/index.d.ts +1 -1
  26. package/dist/plugins/Paste/index.d.ts +1 -1
  27. package/dist/plugins/Paste/sanitizers/helpers.d.ts +1 -1
  28. package/dist/plugins/Quote/index.d.ts +1 -1
  29. package/dist/plugins/Table/actions/addColumn.d.ts +1 -2
  30. package/dist/plugins/Table/actions/addRow.d.ts +1 -1
  31. package/dist/plugins/Table/actions/setHeader.d.ts +1 -1
  32. package/dist/plugins/Table/helpers.d.ts +2 -1
  33. package/dist/plugins/Table/index.d.ts +168 -168
  34. package/dist/plugins/Table/normalizers.d.ts +2 -0
  35. package/dist/plugins/Text/index.d.ts +2 -0
  36. package/dist/plugins/TrailingParagraph/index.d.ts +1 -1
  37. package/dist/plugins/Underline/index.d.ts +1 -1
  38. package/dist/plugins/index.d.ts +180 -0
  39. package/dist/test-utils/createEditor.d.ts +7 -0
  40. package/dist/test-utils/index.d.ts +2 -0
  41. package/dist/test-utils/jsx.d.ts +28 -0
  42. package/dist/types.d.ts +1 -1
  43. package/package.json +5 -12
@@ -1,7 +1,7 @@
1
1
  import React__default, { createElement, useMemo, useState, useEffect, Fragment, useCallback } from 'react';
2
2
  import noop from 'lodash-es/noop';
3
- import { toContentfulDocument, toSlatejsDocument } from '@contentful/contentful-slatejs-adapter';
4
- import { TOP_LEVEL_BLOCKS, BLOCKS, CONTAINERS, VOID_BLOCKS, INLINES, TABLE_BLOCKS, LIST_ITEM_BLOCKS, MARKS, EMPTY_DOCUMENT } from '@contentful/rich-text-types';
3
+ import { toSlatejsDocument, toContentfulDocument } from '@contentful/contentful-slatejs-adapter';
4
+ import { TOP_LEVEL_BLOCKS, BLOCKS, CONTAINERS, VOID_BLOCKS, INLINES, TABLE_BLOCKS, TEXT_CONTAINERS, LIST_ITEM_BLOCKS, MARKS, EMPTY_DOCUMENT } from '@contentful/rich-text-types';
5
5
  import { getScheduleTooltipContent, useEntities, ScheduledIconWithTooltip, MissingEntityCard, AssetThumbnail, EntityProvider } from '@contentful/field-editor-reference';
6
6
  import { css, cx } from 'emotion';
7
7
  import tokens from '@contentful/f36-tokens';
@@ -9,24 +9,15 @@ import deepEquals from 'fast-deep-equal';
9
9
  import { Button, Tooltip, Menu, EntryCard, MenuItem, AssetCard, Text as Text$1, ModalContent, Form, FormControl, TextInput, Select, FormLabel, TextLink, ModalControls, IconButton, Flex, Icon, InlineEntryCard } from '@contentful/f36-components';
10
10
  import { useSelected, useFocused, ReactEditor, useReadOnly } from 'slate-react';
11
11
  import { HorizontalRuleIcon, ChevronDownIcon, QuoteIcon, ListBulletedIcon, ListNumberedIcon, FormatBoldIcon, CodeIcon, FormatItalicIcon, FormatUnderlinedIcon, ClockIcon, LinkIcon, TableIcon, PlusIcon, AssetIcon, EmbeddedEntryBlockIcon, EmbeddedEntryInlineIcon } from '@contentful/f36-icons';
12
- import { Editor, Transforms, Element, Text, Node as Node$1, Path, Range } from 'slate';
13
- import { getPlatePluginOptions, usePlateEditorRef, getRenderElement, getPlatePluginTypes, getRenderLeaf, getPlatePluginType, Plate, createReactPlugin, createHistoryPlugin } from '@udecode/plate-core';
14
- import { getText, getElementDeserializer, getLeafDeserializer, setNodes, insertNodes, toggleNodeType, findNode, getToggleMarkOnKeyDown, isMarkActive, toggleMark, getAbove, getChildren, someNode, getToggleElementOnKeyDown, getNodes } from '@udecode/plate-common';
12
+ import { Editor, Element, Transforms, Text, Node as Node$1, Path, Range } from 'slate';
13
+ import { getText, getElementDeserializer, getPlatePluginOptions, getLeafDeserializer, usePlateEditorRef, getRenderElement, getPlatePluginTypes, setNodes, insertNodes, toggleNodeType, findNode, ELEMENT_LI, ELEMENT_UL, ELEMENT_OL, ELEMENT_LIC, toggleList, createListPlugin as createListPlugin$1, getParent, getAbove, withList, getRenderLeaf, getToggleMarkOnKeyDown, isMarkActive, toggleMark, ELEMENT_TABLE, ELEMENT_TH, ELEMENT_TR, ELEMENT_TD, getChildren, insertTable, isFirstChild as isFirstChild$1, isAncestorEmpty, someNode, getPlatePluginType, getEmptyRowNode, getEmptyCellNode, deleteRow, deleteColumn, deleteTable, createTablePlugin as createTablePlugin$1, getTableOnKeyDown, ELEMENT_PARAGRAPH, getToggleElementOnKeyDown, createExitBreakPlugin, createTrailingBlockPlugin, getNodes, createDeserializeHTMLPlugin, createDeserializeAstPlugin, createReactPlugin, createHistoryPlugin, Plate } from '@udecode/plate';
15
14
  import constate from 'constate';
16
15
  import find from 'lodash-es/find';
17
16
  import flow from 'lodash-es/flow';
18
17
  import get from 'lodash-es/get';
19
- import { ELEMENT_LI, ELEMENT_UL, ELEMENT_OL, ELEMENT_LIC, toggleList, createListPlugin as createListPlugin$1, withList } from '@udecode/plate-list';
20
- import { documentToPlainTextString } from '@contentful/rich-text-plain-text-renderer';
21
18
  import { entityHelpers, isValidImage, shortenStorageUnit, ModalDialogLauncher, FieldConnector } from '@contentful/field-editor-shared';
22
19
  import mimetype from '@contentful/mimetype';
23
- import { ELEMENT_TABLE, ELEMENT_TH, ELEMENT_TR, ELEMENT_TD, insertTable, getEmptyRowNode, getEmptyCellNode, deleteRow, deleteColumn, deleteTable, createTablePlugin as createTablePlugin$1, getTableOnKeyDown } from '@udecode/plate-table';
24
- import { createDeserializeAstPlugin } from '@udecode/plate-ast-serializer';
25
- import { createDeserializeHTMLPlugin } from '@udecode/plate-html-serializer';
26
- import { ELEMENT_PARAGRAPH } from '@udecode/plate-paragraph';
27
- import { createExitBreakPlugin } from '@udecode/plate-break';
28
20
  import values from 'lodash-es/values';
29
- import { createTrailingBlockPlugin } from '@udecode/plate-trailing-block';
30
21
  import PropTypes from 'prop-types';
31
22
 
32
23
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
@@ -610,6 +601,33 @@ function currentSelectionPrecedesTableCell(editor) {
610
601
  var nextNode = getNextNode(editor);
611
602
  return !!nextNode && TABLE_BLOCKS.includes(nextNode.type) && isAtEndOfTextSelection(editor);
612
603
  }
604
+ var replaceNode = function replaceNode(editor, path, replacement) {
605
+ Transforms.removeNodes(editor, {
606
+ at: path
607
+ });
608
+ Transforms.insertNodes(editor, replacement, {
609
+ at: path
610
+ });
611
+ };
612
+ /**
613
+ * It filters out all paragraphs and headings from a path and convert them into paragraphs.
614
+ */
615
+
616
+ function extractParagraphsAt(editor, path) {
617
+ var paragraphs = Array.from(Editor.nodes(editor, {
618
+ at: path,
619
+ match: function match(node) {
620
+ return TEXT_CONTAINERS.includes(node.type);
621
+ },
622
+ mode: 'all'
623
+ })).map(function (_ref2) {
624
+ var node = _ref2[0];
625
+ return _extends({}, node, {
626
+ type: BLOCKS.PARAGRAPH
627
+ });
628
+ });
629
+ return paragraphs;
630
+ }
613
631
 
614
632
  function deserializeLeaf(type, rules) {
615
633
  return function (editor) {
@@ -972,8 +990,8 @@ var H1 = /*#__PURE__*/createHeading('h1', BLOCKS.HEADING_1);
972
990
  var H2 = /*#__PURE__*/createHeading('h2', BLOCKS.HEADING_2);
973
991
  var H3 = /*#__PURE__*/createHeading('h3', BLOCKS.HEADING_3);
974
992
  var H4 = /*#__PURE__*/createHeading('h4', BLOCKS.HEADING_4);
975
- var H5 = /*#__PURE__*/createHeading('h1', BLOCKS.HEADING_5);
976
- var H6 = /*#__PURE__*/createHeading('h1', BLOCKS.HEADING_6);
993
+ var H5 = /*#__PURE__*/createHeading('h5', BLOCKS.HEADING_5);
994
+ var H6 = /*#__PURE__*/createHeading('h6', BLOCKS.HEADING_6);
977
995
  function createHeadingPlugin() {
978
996
  var headings = [BLOCKS.HEADING_1, BLOCKS.HEADING_2, BLOCKS.HEADING_3, BLOCKS.HEADING_4, BLOCKS.HEADING_5, BLOCKS.HEADING_6];
979
997
  return {
@@ -1141,15 +1159,6 @@ var withQuoteOptions = (_withQuoteOptions = {}, _withQuoteOptions[BLOCKS.QUOTE]
1141
1159
  * A copy of Plate's list plugin with a few adjustments
1142
1160
  * to fix pasting text inside lists.
1143
1161
  */
1144
-
1145
- var slateNodesToText = function slateNodesToText(nodes) {
1146
- var contentfulNode = toContentfulDocument({
1147
- document: nodes,
1148
- schema: schema
1149
- });
1150
- return documentToPlainTextString(contentfulNode);
1151
- };
1152
-
1153
1162
  var getListInsertFragment = function getListInsertFragment(editor) {
1154
1163
  var insertFragment = editor.insertFragment;
1155
1164
  var li = getPlatePluginOptions(editor, ELEMENT_LI);
@@ -1205,10 +1214,7 @@ var getListInsertFragment = function getListInsertFragment(editor) {
1205
1214
  var nodes = fragment.flatMap(function (node) {
1206
1215
  return trimList(node);
1207
1216
  });
1208
- var text = slateNodesToText(nodes);
1209
- return Transforms.insertNodes(editor, [{
1210
- text: text
1211
- }], {
1217
+ return Transforms.insertNodes(editor, nodes, {
1212
1218
  at: editor.selection || Path.next(liPath),
1213
1219
  select: true
1214
1220
  });
@@ -1281,6 +1287,88 @@ var withListOptions = (_withListOptions = {}, _withListOptions[ELEMENT_LIC] = {
1281
1287
  component: OL
1282
1288
  }, _withListOptions);
1283
1289
 
1290
+ var emptyNodeOfType = function emptyNodeOfType(type) {
1291
+ return {
1292
+ type: type,
1293
+ children: [],
1294
+ data: {}
1295
+ };
1296
+ };
1297
+
1298
+ var isList = function isList(node) {
1299
+ return [BLOCKS.OL_LIST, BLOCKS.UL_LIST].includes(node.type);
1300
+ };
1301
+
1302
+ var isListItem = function isListItem(node) {
1303
+ return node.type === BLOCKS.LIST_ITEM;
1304
+ };
1305
+
1306
+ var hasListAsDirectParent = function hasListAsDirectParent(editor, path) {
1307
+ var _ref = getParent(editor, path) || [],
1308
+ parentNode = _ref[0];
1309
+
1310
+ return isList(parentNode);
1311
+ };
1312
+
1313
+ var isValidInsideListItem = function isValidInsideListItem(node) {
1314
+ return Text.isText(node) || LIST_ITEM_BLOCKS.concat(Object.values(INLINES)).includes(node.type);
1315
+ };
1316
+
1317
+ var replaceInvalidListItemWithText = function replaceInvalidListItemWithText(editor, path) {
1318
+ var textFromEntry = extractParagraphsAt(editor, path);
1319
+ replaceNode(editor, path, textFromEntry);
1320
+ };
1321
+ /**
1322
+ * Ensures each list item follows the list schema.
1323
+ * Returns true if the list needed to have been normalized.
1324
+ */
1325
+
1326
+
1327
+ var normalizeList = function normalizeList(editor, path) {
1328
+ for (var _iterator = _createForOfIteratorHelperLoose(Node$1.children(editor, path)), _step; !(_step = _iterator()).done;) {
1329
+ var _step$value = _step.value,
1330
+ child = _step$value[0],
1331
+ childPath = _step$value[1];
1332
+
1333
+ if (Element.isElement(child) && !isListItem(child)) {
1334
+ Transforms.wrapNodes(editor, emptyNodeOfType(BLOCKS.LIST_ITEM), {
1335
+ at: childPath
1336
+ });
1337
+ return true;
1338
+ }
1339
+ }
1340
+
1341
+ return false;
1342
+ };
1343
+
1344
+ var getNearestListAncestor = function getNearestListAncestor(editor, path) {
1345
+ return getAbove(editor, {
1346
+ at: path,
1347
+ mode: 'lowest',
1348
+ match: isList
1349
+ }) || [];
1350
+ };
1351
+ /**
1352
+ * Places orphaned list items in a list. If there's a list somewhere
1353
+ * in the node's ancestors, defaults to that list type, else places
1354
+ * the list item in an unordered list.
1355
+ */
1356
+
1357
+
1358
+ var normalizeOrphanedListItem = function normalizeOrphanedListItem(editor, path) {
1359
+ var _getNearestListAncest = getNearestListAncestor(editor, path),
1360
+ parentList = _getNearestListAncest[0];
1361
+
1362
+ var parentListType = parentList == null ? void 0 : parentList.type;
1363
+ Transforms.wrapNodes(editor, {
1364
+ type: parentListType || BLOCKS.UL_LIST,
1365
+ children: [],
1366
+ data: {}
1367
+ }, {
1368
+ at: path
1369
+ });
1370
+ };
1371
+
1284
1372
  var withCustomList = function withCustomList(options) {
1285
1373
  var withDefaultOverrides = withList(options);
1286
1374
  return function (editor) {
@@ -1290,6 +1378,52 @@ var withCustomList = function withCustomList(options) {
1290
1378
  editor.insertFragment = insertFragment; // Use our custom getListInsertFragment
1291
1379
 
1292
1380
  editor.insertFragment = getListInsertFragment(editor);
1381
+ var normalizeNode = editor.normalizeNode;
1382
+
1383
+ editor.normalizeNode = function (entry) {
1384
+ var node = entry[0],
1385
+ path = entry[1];
1386
+
1387
+ if (isList(node)) {
1388
+ if (normalizeList(editor, path)) {
1389
+ return;
1390
+ }
1391
+ } else if (isListItem(node)) {
1392
+ if (!hasListAsDirectParent(editor, path)) {
1393
+ normalizeOrphanedListItem(editor, path);
1394
+ return;
1395
+ }
1396
+
1397
+ var listItemChildren = Array.from(Node$1.children(editor, path)); // Handle list items with no paragraph/text
1398
+
1399
+ if (listItemChildren.length === 0) {
1400
+ Transforms.insertNodes(editor, [{
1401
+ type: BLOCKS.PARAGRAPH,
1402
+ data: {},
1403
+ children: [{
1404
+ text: ''
1405
+ }]
1406
+ }], {
1407
+ at: path.concat([0])
1408
+ });
1409
+ return;
1410
+ }
1411
+
1412
+ for (var _i = 0, _listItemChildren = listItemChildren; _i < _listItemChildren.length; _i++) {
1413
+ var _listItemChildren$_i = _listItemChildren[_i],
1414
+ child = _listItemChildren$_i[0],
1415
+ childPath = _listItemChildren$_i[1];
1416
+
1417
+ if (Element.isElement(child) && !isValidInsideListItem(child)) {
1418
+ replaceInvalidListItemWithText(editor, childPath);
1419
+ return;
1420
+ }
1421
+ }
1422
+ }
1423
+
1424
+ normalizeNode(entry);
1425
+ };
1426
+
1293
1427
  return editor;
1294
1428
  };
1295
1429
  };
@@ -2890,7 +3024,7 @@ function HyperlinkModal(props) {
2890
3024
 
2891
3025
  return /*#__PURE__*/createElement(EntityProvider, {
2892
3026
  sdk: props.sdk
2893
- }, /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(ModalContent, null, /*#__PURE__*/createElement(Form, null, /*#__PURE__*/createElement(FormControl, {
3027
+ }, /*#__PURE__*/createElement(Fragment, null, /*#__PURE__*/createElement(ModalContent, null, /*#__PURE__*/createElement(Form, null, !props.linkType && /*#__PURE__*/createElement(FormControl, {
2894
3028
  id: "link-text",
2895
3029
  isRequired: true
2896
3030
  }, /*#__PURE__*/createElement(FormControl.Label, null, "Link text"), /*#__PURE__*/createElement(TextInput, {
@@ -3386,6 +3520,7 @@ function insertTableAndFocusFirstCell(editor) {
3386
3520
  header: true
3387
3521
  });
3388
3522
  moveToFirstCellFromSelectedTable(editor);
3523
+ replaceEmptyParagraphWithTable(editor);
3389
3524
  }
3390
3525
  function isTableActive(editor) {
3391
3526
  var tableElements = [ELEMENT_TABLE, ELEMENT_TH, ELEMENT_TR, ELEMENT_TD];
@@ -3415,6 +3550,36 @@ function isTableHeaderEnabled(editor) {
3415
3550
  return node.type === BLOCKS.TABLE_HEADER_CELL;
3416
3551
  });
3417
3552
  }
3553
+ function replaceEmptyParagraphWithTable(editor) {
3554
+ var tablePath = getAncestorPathFromSelection(editor);
3555
+ if (!tablePath || isFirstChild$1(tablePath)) return;
3556
+ var previousPath = Path.previous(tablePath);
3557
+ if (!previousPath) return;
3558
+
3559
+ var _Editor$nodes = Editor.nodes(editor, {
3560
+ at: previousPath,
3561
+ match: function match(node) {
3562
+ return node.type === BLOCKS.PARAGRAPH;
3563
+ }
3564
+ }),
3565
+ nodes = _Editor$nodes[0];
3566
+
3567
+ if (!nodes) return;
3568
+ var previousNode = nodes[0];
3569
+ var isPreviousNodeTextEmpty = isAncestorEmpty(editor, previousNode);
3570
+
3571
+ if (isPreviousNodeTextEmpty) {
3572
+ // Switch table with previous empty paragraph
3573
+ Transforms.moveNodes(editor, {
3574
+ at: tablePath,
3575
+ to: previousPath
3576
+ }); // Remove previous paragraph that now is under the table
3577
+
3578
+ Transforms.removeNodes(editor, {
3579
+ at: tablePath
3580
+ });
3581
+ }
3582
+ }
3418
3583
 
3419
3584
  function useTracking(_ref) {
3420
3585
  var onAction = _ref.onAction;
@@ -3670,17 +3835,117 @@ var TableActions = function TableActions() {
3670
3835
  }, "Delete table")));
3671
3836
  };
3672
3837
 
3673
- var _templateObject$4, _templateObject2$3, _templateObject3$3, _templateObject4$1, _styles$1, _withTableOptions;
3674
- var styles$f = (_styles$1 = {}, _styles$1[BLOCKS.TABLE] = /*#__PURE__*/css(_templateObject$4 || (_templateObject$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-bottom: 1.5em;\n border-collapse: collapse;\n border-radius: 5px;\n border-style: hidden;\n box-shadow: 0 0 0 1px ", ";\n width: 100%;\n table-layout: fixed;\n overflow: hidden;\n "])), tokens.gray400), _styles$1[BLOCKS.TABLE_ROW] = /*#__PURE__*/css(_templateObject2$3 || (_templateObject2$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border: 1px solid ", ";\n &:hover td {\n background-color: transparent !important;\n }\n "])), tokens.gray400), _styles$1[BLOCKS.TABLE_HEADER_CELL] = /*#__PURE__*/css(_templateObject3$3 || (_templateObject3$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background-color: ", ";\n border: 1px solid ", ";\n padding: 10px 12px;\n font-weight: ", ";\n text-align: left;\n min-width: 48px;\n position: relative;\n div:last-child {\n margin-bottom: 0;\n }\n "])), tokens.gray200, tokens.gray400, tokens.fontWeightMedium), _styles$1[BLOCKS.TABLE_CELL] = /*#__PURE__*/css(_templateObject4$1 || (_templateObject4$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border: 1px solid ", ";\n padding: 10px 12px;\n min-width: 48px;\n position: relative;\n div:last-child {\n margin-bottom: 0;\n }\n "])), tokens.gray400), _styles$1);
3838
+ /**
3839
+ * Injects a custom element normalization handler.
3840
+ *
3841
+ * Handlers must explicity return "true" to indicate a pass.
3842
+ * A pass is when a handler didn't encounter any normalization
3843
+ * paths (i.e. all nodes were valid)
3844
+ *
3845
+ * Important read:
3846
+ * https://docs.slatejs.org/concepts/11-normalizing#multi-pass-normalizing
3847
+ */
3675
3848
 
3676
- var slateNodeToText = function slateNodeToText(node) {
3677
- var contentfulNode = toContentfulDocument({
3678
- document: [node],
3679
- schema: schema
3680
- });
3681
- return documentToPlainTextString(contentfulNode);
3849
+ var withNormalizer = function withNormalizer(editor, handler) {
3850
+ var normalizeNode = editor.normalizeNode;
3851
+
3852
+ editor.normalizeNode = function (entry) {
3853
+ var node = entry[0];
3854
+ var passed = false;
3855
+
3856
+ if (Element.isElement(node)) {
3857
+ passed = handler(editor, entry) === true;
3858
+ }
3859
+
3860
+ if (passed) {
3861
+ normalizeNode(entry);
3862
+ }
3863
+ };
3682
3864
  };
3683
3865
 
3866
+ var isTable = function isTable(node) {
3867
+ return node.type === BLOCKS.TABLE;
3868
+ };
3869
+
3870
+ var isTableCell = function isTableCell(node) {
3871
+ return node.type === BLOCKS.TABLE_CELL || node.type === BLOCKS.TABLE_HEADER_CELL;
3872
+ };
3873
+ /**
3874
+ * Normalizes TABLE_CELL & TABLE_HEADER_CELL nodes
3875
+ */
3876
+
3877
+
3878
+ var normalizeTableCell = function normalizeTableCell(editor, entry) {
3879
+ var node = entry[0],
3880
+ path = entry[1];
3881
+
3882
+ if (!isTableCell(node)) {
3883
+ return true;
3884
+ }
3885
+
3886
+ for (var _iterator = _createForOfIteratorHelperLoose(Node$1.children(editor, path)), _step; !(_step = _iterator()).done;) {
3887
+ var _step$value = _step.value,
3888
+ child = _step$value[0],
3889
+ childPath = _step$value[1];
3890
+
3891
+ if (!Element.isElement(child)) {
3892
+ continue;
3893
+ }
3894
+
3895
+ var isValidTableCellItem = CONTAINERS[node.type].includes(child.type);
3896
+
3897
+ if (!isValidTableCellItem) {
3898
+ var text = extractParagraphsAt(editor, childPath);
3899
+ replaceNode(editor, childPath, text);
3900
+ return;
3901
+ }
3902
+ }
3903
+
3904
+ return true;
3905
+ };
3906
+ /**
3907
+ * Normalizes TABLE nodes
3908
+ */
3909
+
3910
+
3911
+ var normalizeTable = function normalizeTable(editor, entry) {
3912
+ var node = entry[0],
3913
+ path = entry[1];
3914
+
3915
+ if (!isTable(node)) {
3916
+ return true;
3917
+ } // All direct children must be of type TABLE_ROW
3918
+
3919
+
3920
+ for (var _iterator2 = _createForOfIteratorHelperLoose(Node$1.children(editor, path)), _step2; !(_step2 = _iterator2()).done;) {
3921
+ var _step2$value = _step2.value,
3922
+ child = _step2$value[0],
3923
+ childPath = _step2$value[1];
3924
+
3925
+ if (!Element.isElement(child)) {
3926
+ continue;
3927
+ }
3928
+
3929
+ var isValidTableChild = CONTAINERS[BLOCKS.TABLE].includes(child.type);
3930
+
3931
+ if (!isValidTableChild) {
3932
+ Transforms.removeNodes(editor, {
3933
+ at: childPath
3934
+ });
3935
+ return;
3936
+ }
3937
+ }
3938
+
3939
+ return true;
3940
+ };
3941
+
3942
+ var addTableNormalizers = function addTableNormalizers(editor) {
3943
+ withNormalizer(editor, normalizeTable);
3944
+ withNormalizer(editor, normalizeTableCell);
3945
+ };
3946
+
3947
+ var _templateObject$4, _templateObject2$3, _templateObject3$3, _templateObject4$1, _styles$1, _withTableOptions;
3948
+ var styles$f = (_styles$1 = {}, _styles$1[BLOCKS.TABLE] = /*#__PURE__*/css(_templateObject$4 || (_templateObject$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n margin-bottom: 1.5em;\n border-collapse: collapse;\n border-radius: 5px;\n border-style: hidden;\n box-shadow: 0 0 0 1px ", ";\n width: 100%;\n table-layout: fixed;\n overflow: hidden;\n "])), tokens.gray400), _styles$1[BLOCKS.TABLE_ROW] = /*#__PURE__*/css(_templateObject2$3 || (_templateObject2$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border: 1px solid ", ";\n\n &:hover td {\n background-color: transparent !important;\n }\n "])), tokens.gray400), _styles$1[BLOCKS.TABLE_HEADER_CELL] = /*#__PURE__*/css(_templateObject3$3 || (_templateObject3$3 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background-color: ", ";\n border: 1px solid ", ";\n padding: 10px 12px;\n font-weight: ", ";\n text-align: left;\n min-width: 48px;\n position: relative;\n\n div:last-child {\n margin-bottom: 0;\n }\n "])), tokens.gray200, tokens.gray400, tokens.fontWeightMedium), _styles$1[BLOCKS.TABLE_CELL] = /*#__PURE__*/css(_templateObject4$1 || (_templateObject4$1 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border: 1px solid ", ";\n padding: 10px 12px;\n min-width: 48px;\n position: relative;\n\n div:last-child {\n margin-bottom: 0;\n }\n "])), tokens.gray400), _styles$1);
3684
3949
  var Table = function Table(props) {
3685
3950
  return /*#__PURE__*/createElement("table", Object.assign({}, props.attributes, {
3686
3951
  className: styles$f[BLOCKS.TABLE]
@@ -3744,56 +4009,6 @@ function addTableTrackingEvents(editor, _ref) {
3744
4009
  };
3745
4010
  }
3746
4011
 
3747
- var paragraph = function paragraph() {
3748
- return {
3749
- type: BLOCKS.PARAGRAPH,
3750
- data: {},
3751
- children: []
3752
- };
3753
- };
3754
-
3755
- function addTableNormalization(editor) {
3756
- var normalizeNode = editor.normalizeNode;
3757
-
3758
- editor.normalizeNode = function (entry) {
3759
- var node = entry[0],
3760
- path = entry[1]; // TODO: This should be enforced by sanitizeSlateDoc() but the internal
3761
- // editor value can be different.
3762
- // cf. https://github.com/ianstormtaylor/slate/issues/2206
3763
-
3764
- var cellTypes = [BLOCKS.TABLE_CELL, BLOCKS.TABLE_HEADER_CELL];
3765
-
3766
- if (Element.isElement(node) && cellTypes.includes(node.type)) {
3767
- for (var _iterator = _createForOfIteratorHelperLoose(Node$1.children(editor, path)), _step; !(_step = _iterator()).done;) {
3768
- var _step$value = _step.value,
3769
- child = _step$value[0],
3770
- childPath = _step$value[1];
3771
-
3772
- if (Text.isText(child)) {
3773
- Transforms.wrapNodes(editor, paragraph(), {
3774
- at: childPath
3775
- });
3776
- } else if (!CONTAINERS[node.type].includes(child.type)) {
3777
- var paragraphWithTextFromNode = _extends({}, paragraph(), {
3778
- children: [{
3779
- text: slateNodeToText(child)
3780
- }]
3781
- });
3782
-
3783
- Transforms.removeNodes(editor, {
3784
- at: childPath
3785
- });
3786
- Transforms.insertNodes(editor, paragraphWithTextFromNode, {
3787
- at: childPath
3788
- });
3789
- }
3790
- }
3791
- }
3792
-
3793
- normalizeNode(entry);
3794
- };
3795
- }
3796
-
3797
4012
  function hasTables(nodes) {
3798
4013
  return nodes.some(function (_ref2) {
3799
4014
  var type = _ref2.type;
@@ -3819,10 +4034,8 @@ function hasHeadersOutsideFirstRow(nodes) {
3819
4034
  });
3820
4035
  }
3821
4036
 
3822
- function createWithTableEvents(tracking) {
4037
+ function createTableOnKeyDown() {
3823
4038
  return function withTableEvents(editor) {
3824
- addTableTrackingEvents(editor, tracking);
3825
- addTableNormalization(editor);
3826
4039
  var handleKeyDownFromPlateUdecode = getTableOnKeyDown()(editor);
3827
4040
  return function handleKeyDown(event) {
3828
4041
  if (event.key === 'Backspace' && currentSelectionStartsTableCell(editor) || event.key === 'Delete' && currentSelectionPrecedesTableCell(editor)) {
@@ -3841,8 +4054,10 @@ function createWithTableEvents(tracking) {
3841
4054
 
3842
4055
  var createTablePlugin = function createTablePlugin(tracking) {
3843
4056
  return _extends({}, createTablePlugin$1(), {
3844
- onKeyDown: createWithTableEvents(tracking),
4057
+ onKeyDown: createTableOnKeyDown(),
3845
4058
  withOverrides: function withOverrides(editor) {
4059
+ addTableTrackingEvents(editor, tracking);
4060
+ addTableNormalizers(editor);
3846
4061
  var insertFragment = editor.insertFragment;
3847
4062
 
3848
4063
  editor.insertFragment = function (fragments) {
@@ -4295,16 +4510,15 @@ function getWithEmbeddedEntityEvents(nodeType, sdk) {
4295
4510
  // TODO: Dry up copied code from HR
4296
4511
  return function handleEvent(event) {
4297
4512
  if (!editor) return;
4298
- var isEnter = event.keyCode === 13;
4299
4513
 
4300
4514
  var _getNodeEntryFromSele = getNodeEntryFromSelection(editor, nodeType),
4301
4515
  pathToSelectedElement = _getNodeEntryFromSele[1];
4302
4516
 
4303
4517
  if (pathToSelectedElement) {
4304
- if (isEnter) {
4305
- event.preventDefault();
4306
- moveToTheNextLine(editor);
4307
- } else if (event.key === 'Backspace') {
4518
+ var isDelete = event.key === 'Delete';
4519
+ var isBackspace = event.key === 'Backspace';
4520
+
4521
+ if (isDelete || isBackspace) {
4308
4522
  event.preventDefault();
4309
4523
  Transforms.removeNodes(editor, {
4310
4524
  at: pathToSelectedElement
@@ -4753,6 +4967,9 @@ var Toolbar = function Toolbar(_ref) {
4753
4967
  var validationInfo = React__default.useMemo(function () {
4754
4968
  return getValidationInfo(sdk.field);
4755
4969
  }, [sdk.field]);
4970
+ var isListSelected = isNodeTypeSelected(editor, BLOCKS.UL_LIST) || isNodeTypeSelected(editor, BLOCKS.OL_LIST);
4971
+ var isBlockquoteSelected = isNodeTypeSelected(editor, BLOCKS.QUOTE);
4972
+ var shouldDisableTables = isDisabled || !canInsertBlocks || isListSelected || isBlockquoteSelected;
4756
4973
  return /*#__PURE__*/React__default.createElement(Flex, {
4757
4974
  testId: "toolbar",
4758
4975
  className: styles$k.toolbar,
@@ -4784,7 +5001,7 @@ var Toolbar = function Toolbar(_ref) {
4784
5001
  }), isNodeTypeEnabled(sdk.field, BLOCKS.HR) && /*#__PURE__*/React__default.createElement(ToolbarHrButton, {
4785
5002
  isDisabled: isDisabled || !canInsertBlocks
4786
5003
  }), isNodeTypeEnabled(sdk.field, BLOCKS.TABLE) && /*#__PURE__*/React__default.createElement(ToolbarTableButton, {
4787
- isDisabled: isDisabled || !canInsertBlocks
5004
+ isDisabled: shouldDisableTables
4788
5005
  })), /*#__PURE__*/React__default.createElement("div", {
4789
5006
  className: styles$k.embedActionsWrapper
4790
5007
  }, /*#__PURE__*/React__default.createElement(EmbedEntityWidget, {
@@ -4823,6 +5040,99 @@ var StickyToolbarWrapper = function StickyToolbarWrapper(_ref) {
4823
5040
  }, children);
4824
5041
  };
4825
5042
 
5043
+ var TEXT_PARENT_NODES = /*#__PURE__*/VOID_BLOCKS.concat(values(INLINES)).concat(BLOCKS.PARAGRAPH, BLOCKS.HEADING_1, BLOCKS.HEADING_2, BLOCKS.HEADING_3, BLOCKS.HEADING_4, BLOCKS.HEADING_5, BLOCKS.HEADING_6);
5044
+
5045
+ var isTextElement = function isTextElement(node) {
5046
+ return 'text' in node;
5047
+ };
5048
+
5049
+ var wrapNode = function wrapNode(type, node) {
5050
+ return {
5051
+ type: type,
5052
+ data: {},
5053
+ children: [node]
5054
+ };
5055
+ };
5056
+
5057
+ function wrapOrphanedTextNode(parentNodeType, node) {
5058
+ var paragraph = wrapNode(BLOCKS.PARAGRAPH, node);
5059
+
5060
+ switch (parentNodeType) {
5061
+ case BLOCKS.OL_LIST:
5062
+ case BLOCKS.UL_LIST:
5063
+ return wrapNode(BLOCKS.LIST_ITEM, paragraph);
5064
+
5065
+ case BLOCKS.TABLE_ROW:
5066
+ return wrapNode(BLOCKS.TABLE_CELL, paragraph);
5067
+
5068
+ case BLOCKS.TABLE:
5069
+ return wrapNode(BLOCKS.TABLE_ROW, wrapNode(BLOCKS.TABLE_CELL, paragraph));
5070
+
5071
+ default:
5072
+ return paragraph;
5073
+ }
5074
+ }
5075
+ /**
5076
+ * Ensures "orphaned" text node elements (those without a parent capable of
5077
+ * validly rendering a text child node) are wrapped with a suitable parent
5078
+ * element to prevent failures on the validation layer.
5079
+ *
5080
+ * It is commonplace for third party plugins (including udecode) to reconcile
5081
+ * deletion events by inserting such nodes into their schema. This
5082
+ * subprocedure is intended as a guard against such cases.
5083
+ */
5084
+
5085
+
5086
+ function sanitizeSlateDoc(nodes, parentNodeType) {
5087
+ if (nodes === void 0) {
5088
+ nodes = [];
5089
+ }
5090
+
5091
+ if (parentNodeType === void 0) {
5092
+ parentNodeType = BLOCKS.DOCUMENT;
5093
+ }
5094
+
5095
+ return nodes.map(function (node) {
5096
+ if (isTextElement(node)) {
5097
+ return TEXT_PARENT_NODES.includes(parentNodeType) ? node : wrapOrphanedTextNode(parentNodeType, node);
5098
+ }
5099
+
5100
+ return _extends({}, node, {
5101
+ children: sanitizeSlateDoc(node.children, node.type)
5102
+ });
5103
+ });
5104
+ }
5105
+ /**
5106
+ * Ensures incoming void nodes have a child leaf text element.
5107
+ */
5108
+
5109
+ function sanitizeIncomingSlateDoc(nodes) {
5110
+ if (nodes === void 0) {
5111
+ nodes = [];
5112
+ }
5113
+
5114
+ return nodes.map(function (node) {
5115
+ var _node$children;
5116
+
5117
+ if (isTextElement(node)) {
5118
+ return node;
5119
+ }
5120
+
5121
+ if (node.isVoid && ((_node$children = node.children) == null ? void 0 : _node$children.length) === 0) {
5122
+ return _extends({}, node, {
5123
+ children: [{
5124
+ text: '',
5125
+ data: {}
5126
+ }]
5127
+ });
5128
+ }
5129
+
5130
+ return _extends({}, node, {
5131
+ children: sanitizeIncomingSlateDoc(node.children)
5132
+ });
5133
+ });
5134
+ }
5135
+
4826
5136
  var isHTMLElement = function isHTMLElement(node) {
4827
5137
  return node.nodeType === Node.ELEMENT_NODE;
4828
5138
  };
@@ -4973,28 +5283,25 @@ var htmlToDataTransfer = function htmlToDataTransfer(html) {
4973
5283
  return data;
4974
5284
  };
4975
5285
 
4976
- function withPasteHandling(editor) {
4977
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
4978
- return function (_event) {
4979
- var insertData = editor.insertData;
5286
+ var createPastePlugin = function createPastePlugin() {
5287
+ return {
5288
+ withOverrides: function withOverrides(editor) {
5289
+ var insertData = editor.insertData;
4980
5290
 
4981
- editor.insertData = function (data) {
4982
- var html = data.getData(MIME_TYPE_HTML);
5291
+ editor.insertData = function (data) {
5292
+ var html = data.getData(MIME_TYPE_HTML);
4983
5293
 
4984
- if (html) {
4985
- var sanitized = sanitizeHtml(html, editor);
4986
- var newData = htmlToDataTransfer(sanitized);
4987
- insertData(newData);
4988
- } else {
4989
- insertData(data);
4990
- }
4991
- };
4992
- };
4993
- }
5294
+ if (html) {
5295
+ var sanitized = sanitizeHtml(html, editor);
5296
+ var newData = htmlToDataTransfer(sanitized);
5297
+ insertData(newData);
5298
+ } else {
5299
+ insertData(data);
5300
+ }
5301
+ };
4994
5302
 
4995
- var createPastePlugin = function createPastePlugin() {
4996
- return {
4997
- onKeyDown: withPasteHandling
5303
+ return editor;
5304
+ }
4998
5305
  };
4999
5306
  };
5000
5307
 
@@ -5129,99 +5436,6 @@ function createInsertBeforeFirstVoidBlockPlugin() {
5129
5436
  return createExitBreakPlugin(optionsExitBreakPlugin);
5130
5437
  }
5131
5438
 
5132
- var TEXT_PARENT_NODES = /*#__PURE__*/VOID_BLOCKS.concat(values(INLINES)).concat(BLOCKS.PARAGRAPH, BLOCKS.HEADING_1, BLOCKS.HEADING_2, BLOCKS.HEADING_3, BLOCKS.HEADING_4, BLOCKS.HEADING_5, BLOCKS.HEADING_6);
5133
-
5134
- var isTextElement = function isTextElement(node) {
5135
- return 'text' in node;
5136
- };
5137
-
5138
- var wrapNode = function wrapNode(type, node) {
5139
- return {
5140
- type: type,
5141
- data: {},
5142
- children: [node]
5143
- };
5144
- };
5145
-
5146
- function wrapOrphanedTextNode(parentNodeType, node) {
5147
- var paragraph = wrapNode(BLOCKS.PARAGRAPH, node);
5148
-
5149
- switch (parentNodeType) {
5150
- case BLOCKS.OL_LIST:
5151
- case BLOCKS.UL_LIST:
5152
- return wrapNode(BLOCKS.LIST_ITEM, paragraph);
5153
-
5154
- case BLOCKS.TABLE_ROW:
5155
- return wrapNode(BLOCKS.TABLE_CELL, paragraph);
5156
-
5157
- case BLOCKS.TABLE:
5158
- return wrapNode(BLOCKS.TABLE_ROW, wrapNode(BLOCKS.TABLE_CELL, paragraph));
5159
-
5160
- default:
5161
- return paragraph;
5162
- }
5163
- }
5164
- /**
5165
- * Ensures "orphaned" text node elements (those without a parent capable of
5166
- * validly rendering a text child node) are wrapped with a suitable parent
5167
- * element to prevent failures on the validation layer.
5168
- *
5169
- * It is commonplace for third party plugins (including udecode) to reconcile
5170
- * deletion events by inserting such nodes into their schema. This
5171
- * subprocedure is intended as a guard against such cases.
5172
- */
5173
-
5174
-
5175
- function sanitizeSlateDoc(nodes, parentNodeType) {
5176
- if (nodes === void 0) {
5177
- nodes = [];
5178
- }
5179
-
5180
- if (parentNodeType === void 0) {
5181
- parentNodeType = BLOCKS.DOCUMENT;
5182
- }
5183
-
5184
- return nodes.map(function (node) {
5185
- if (isTextElement(node)) {
5186
- return TEXT_PARENT_NODES.includes(parentNodeType) ? node : wrapOrphanedTextNode(parentNodeType, node);
5187
- }
5188
-
5189
- return _extends({}, node, {
5190
- children: sanitizeSlateDoc(node.children, node.type)
5191
- });
5192
- });
5193
- }
5194
- /**
5195
- * Ensures incoming void nodes have a child leaf text element.
5196
- */
5197
-
5198
- function sanitizeIncomingSlateDoc(nodes) {
5199
- if (nodes === void 0) {
5200
- nodes = [];
5201
- }
5202
-
5203
- return nodes.map(function (node) {
5204
- var _node$children;
5205
-
5206
- if (isTextElement(node)) {
5207
- return node;
5208
- }
5209
-
5210
- if (node.isVoid && ((_node$children = node.children) == null ? void 0 : _node$children.length) === 0) {
5211
- return _extends({}, node, {
5212
- children: [{
5213
- text: '',
5214
- data: {}
5215
- }]
5216
- });
5217
- }
5218
-
5219
- return _extends({}, node, {
5220
- children: sanitizeIncomingSlateDoc(node.children)
5221
- });
5222
- });
5223
- }
5224
-
5225
5439
  var createTrailingParagraphPlugin = function createTrailingParagraphPlugin() {
5226
5440
  return createTrailingBlockPlugin({
5227
5441
  type: BLOCKS.PARAGRAPH,
@@ -5233,7 +5447,7 @@ function createDragAndDropPlugin() {
5233
5447
  var _DND_BLOCKED_ELEMENTS;
5234
5448
 
5235
5449
  // Elements that don't allow other elements to be dragged into them and which callback should be used
5236
- var DND_BLOCKED_ELEMENTS = (_DND_BLOCKED_ELEMENTS = {}, _DND_BLOCKED_ELEMENTS[BLOCKS.TABLE] = Transforms.removeNodes, _DND_BLOCKED_ELEMENTS[BLOCKS.QUOTE] = Transforms.liftNodes, _DND_BLOCKED_ELEMENTS);
5450
+ var DND_BLOCKED_ELEMENTS = (_DND_BLOCKED_ELEMENTS = {}, _DND_BLOCKED_ELEMENTS[BLOCKS.QUOTE] = Transforms.liftNodes, _DND_BLOCKED_ELEMENTS);
5237
5451
  var DRAGGABLE_TYPES = [BLOCKS.EMBEDDED_ENTRY, BLOCKS.EMBEDDED_ASSET, INLINES.EMBEDDED_ENTRY];
5238
5452
  /**
5239
5453
  * HTML node names where dropping should be allowed
@@ -5316,7 +5530,45 @@ function getParents(el) {
5316
5530
  return parents;
5317
5531
  }
5318
5532
 
5319
- var _excluded$1 = ["sdk", "isInitiallyDisabled", "onAction"];
5533
+ function createTextPlugin() {
5534
+ return {
5535
+ withOverrides: function withOverrides(editor) {
5536
+ var deleteForward = editor.deleteForward; // When pressing delete instead of backspace
5537
+
5538
+ editor.deleteForward = function (unit) {
5539
+ var _editor$selection;
5540
+
5541
+ var _Editor$nodes = Editor.nodes(editor, {
5542
+ at: (_editor$selection = editor.selection) == null ? void 0 : _editor$selection.focus.path,
5543
+ match: function match(node) {
5544
+ return TEXT_CONTAINERS.includes(node.type);
5545
+ }
5546
+ }),
5547
+ nodes = _Editor$nodes[0];
5548
+
5549
+ if (nodes) {
5550
+ var paragraphOrHeading = nodes[0],
5551
+ path = nodes[1];
5552
+ var isTextEmpty = isAncestorEmpty(editor, paragraphOrHeading); // We ignore paragraphs/headings that are children of ul, ol, blockquote, tables, etc
5553
+
5554
+ var isRootLevel = path.length === 1;
5555
+
5556
+ if (isTextEmpty && isRootLevel) {
5557
+ Transforms.removeNodes(editor, {
5558
+ at: path
5559
+ });
5560
+ } else {
5561
+ deleteForward(unit);
5562
+ }
5563
+ } else {
5564
+ deleteForward(unit);
5565
+ }
5566
+ };
5567
+
5568
+ return editor;
5569
+ }
5570
+ };
5571
+ }
5320
5572
 
5321
5573
  var getPlugins = function getPlugins(sdk, tracking) {
5322
5574
  var plugins = [// Core
@@ -5326,16 +5578,16 @@ var getPlugins = function getPlugins(sdk, tracking) {
5326
5578
  createParagraphPlugin(), createListPlugin(), createHrPlugin(), createHeadingPlugin(), createQuotePlugin(), createTablePlugin(tracking), createEmbeddedEntryBlockPlugin(sdk), createEmbeddedAssetBlockPlugin(sdk), // Inline elements
5327
5579
  createHyperlinkPlugin(sdk), createEmbeddedEntityInlinePlugin(sdk), // Marks
5328
5580
  createBoldPlugin(), createCodePlugin(), createItalicPlugin(), createUnderlinePlugin(), // Other
5329
- createTrailingParagraphPlugin()];
5581
+ createTrailingParagraphPlugin(), createTextPlugin()];
5330
5582
  return plugins.concat([createDeserializeHTMLPlugin({
5331
5583
  plugins: plugins
5332
5584
  }), createDeserializeAstPlugin({
5333
5585
  plugins: plugins
5334
5586
  })]);
5335
5587
  };
5588
+ var pluginOptions = /*#__PURE__*/_extends({}, withParagraphOptions, withListOptions, withHrOptions, withHeadingOptions, withQuoteOptions, withTableOptions, withEmbeddedEntryBlockOptions, withEmbeddedAssetBlockOptions, withHyperlinkOptions, withEmbeddedEntityInlineOptions, withBoldOptions, withCodeOptions, withItalicOptions, withUnderlineOptions);
5336
5589
 
5337
- var options = /*#__PURE__*/_extends({}, withParagraphOptions, withListOptions, withHrOptions, withHeadingOptions, withQuoteOptions, withTableOptions, withEmbeddedEntryBlockOptions, withEmbeddedAssetBlockOptions, withHyperlinkOptions, withEmbeddedEntityInlineOptions, withBoldOptions, withCodeOptions, withItalicOptions, withUnderlineOptions);
5338
-
5590
+ var _excluded$1 = ["sdk", "isInitiallyDisabled", "onAction"];
5339
5591
  var ConnectedRichTextEditor = function ConnectedRichTextEditor(props) {
5340
5592
  var tracking = useTrackingContext();
5341
5593
  var docFromAdapter = toSlatejsDocument({
@@ -5375,7 +5627,7 @@ var ConnectedRichTextEditor = function ConnectedRichTextEditor(props) {
5375
5627
  props.onChange == null ? void 0 : props.onChange(contentfulDoc);
5376
5628
  },
5377
5629
  // @ts-expect-error
5378
- options: options
5630
+ options: pluginOptions
5379
5631
  }, !props.isToolbarHidden && /*#__PURE__*/React__default.createElement(StickyToolbarWrapper, {
5380
5632
  isDisabled: props.isDisabled
5381
5633
  }, /*#__PURE__*/React__default.createElement(Toolbar, {