@contentful/field-editor-rich-text 2.1.0 → 2.1.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.
@@ -1869,15 +1869,19 @@ var CommandList = function CommandList(_ref5) {
1869
1869
  }, /*#__PURE__*/createElement(Popover, {
1870
1870
  isOpen: true,
1871
1871
  usePortal: false,
1872
+
1873
+ /* eslint-disable-next-line jsx-a11y/no-autofocus -- we want to keep focus on text input*/
1872
1874
  autoFocus: false
1873
1875
  }, /*#__PURE__*/createElement(Popover.Trigger, null, /*#__PURE__*/createElement("span", null)), /*#__PURE__*/createElement(Popover.Content, {
1874
- className: styles.menuContent
1876
+ className: styles.menuContent,
1877
+ testId: "rich-text-commands"
1875
1878
  }, /*#__PURE__*/createElement("header", {
1876
1879
  className: styles.menuHeader
1877
1880
  }, /*#__PURE__*/createElement(SectionHeading, {
1878
1881
  marginBottom: "none"
1879
1882
  }, "Richtext commands")), /*#__PURE__*/createElement("div", {
1880
- className: styles.menuList
1883
+ className: styles.menuList,
1884
+ "data-test-id": "rich-text-commands-list"
1881
1885
  }, /*#__PURE__*/createElement(CommandListItems, {
1882
1886
  commandItems: commandItems,
1883
1887
  selectedItem: selectedItem
@@ -7371,24 +7375,13 @@ var StickyToolbarWrapper = function StickyToolbarWrapper(_ref) {
7371
7375
  }, children);
7372
7376
  };
7373
7377
 
7374
- /**
7375
- * Returns whether a given operation is relevant enough to trigger a save.
7376
- */
7377
-
7378
- var isRelevantOperation = function isRelevantOperation(op) {
7379
- if (op.type === 'set_selection') {
7380
- return false;
7381
- }
7382
-
7383
- return true;
7384
- };
7385
-
7378
+ var internalMarks = [COMMAND_PROMPT];
7386
7379
  var removeInternalMarks = function removeInternalMarks(document) {
7387
7380
  return _extends({}, document, {
7388
7381
  content: document.content.map(function (node) {
7389
7382
  if (node.nodeType === 'text') {
7390
7383
  node.marks = node.marks.filter(function (mark) {
7391
- return mark.type !== COMMAND_PROMPT;
7384
+ return !internalMarks.includes(mark.type);
7392
7385
  });
7393
7386
  return node;
7394
7387
  }
@@ -7398,6 +7391,18 @@ var removeInternalMarks = function removeInternalMarks(document) {
7398
7391
  });
7399
7392
  };
7400
7393
 
7394
+ /**
7395
+ * Returns whether a given operation is relevant enough to trigger a save.
7396
+ */
7397
+
7398
+ var isRelevantOperation = function isRelevantOperation(op) {
7399
+ if (op.type === 'set_selection') {
7400
+ return false;
7401
+ }
7402
+
7403
+ return true;
7404
+ };
7405
+
7401
7406
  var useOnValueChanged = function useOnValueChanged(_ref) {
7402
7407
  var editorId = _ref.editorId,
7403
7408
  handler = _ref.handler,