@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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.1.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-rich-text@2.1.0...@contentful/field-editor-rich-text@2.1.1) (2022-07-05)
7
+
8
+ **Note:** Version bump only for package @contentful/field-editor-rich-text
9
+
6
10
  # [2.1.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-rich-text@2.0.4...@contentful/field-editor-rich-text@2.1.0) (2022-07-01)
7
11
 
8
12
  ### Features
@@ -1876,15 +1876,19 @@ var CommandList = function CommandList(_ref5) {
1876
1876
  }, /*#__PURE__*/React.createElement(f36Components.Popover, {
1877
1877
  isOpen: true,
1878
1878
  usePortal: false,
1879
+
1880
+ /* eslint-disable-next-line jsx-a11y/no-autofocus -- we want to keep focus on text input*/
1879
1881
  autoFocus: false
1880
1882
  }, /*#__PURE__*/React.createElement(f36Components.Popover.Trigger, null, /*#__PURE__*/React.createElement("span", null)), /*#__PURE__*/React.createElement(f36Components.Popover.Content, {
1881
- className: styles.menuContent
1883
+ className: styles.menuContent,
1884
+ testId: "rich-text-commands"
1882
1885
  }, /*#__PURE__*/React.createElement("header", {
1883
1886
  className: styles.menuHeader
1884
1887
  }, /*#__PURE__*/React.createElement(f36Components.SectionHeading, {
1885
1888
  marginBottom: "none"
1886
1889
  }, "Richtext commands")), /*#__PURE__*/React.createElement("div", {
1887
- className: styles.menuList
1890
+ className: styles.menuList,
1891
+ "data-test-id": "rich-text-commands-list"
1888
1892
  }, /*#__PURE__*/React.createElement(CommandListItems, {
1889
1893
  commandItems: commandItems,
1890
1894
  selectedItem: selectedItem
@@ -7378,24 +7382,13 @@ var StickyToolbarWrapper = function StickyToolbarWrapper(_ref) {
7378
7382
  }, children);
7379
7383
  };
7380
7384
 
7381
- /**
7382
- * Returns whether a given operation is relevant enough to trigger a save.
7383
- */
7384
-
7385
- var isRelevantOperation = function isRelevantOperation(op) {
7386
- if (op.type === 'set_selection') {
7387
- return false;
7388
- }
7389
-
7390
- return true;
7391
- };
7392
-
7385
+ var internalMarks = [COMMAND_PROMPT];
7393
7386
  var removeInternalMarks = function removeInternalMarks(document) {
7394
7387
  return _extends({}, document, {
7395
7388
  content: document.content.map(function (node) {
7396
7389
  if (node.nodeType === 'text') {
7397
7390
  node.marks = node.marks.filter(function (mark) {
7398
- return mark.type !== COMMAND_PROMPT;
7391
+ return !internalMarks.includes(mark.type);
7399
7392
  });
7400
7393
  return node;
7401
7394
  }
@@ -7405,6 +7398,18 @@ var removeInternalMarks = function removeInternalMarks(document) {
7405
7398
  });
7406
7399
  };
7407
7400
 
7401
+ /**
7402
+ * Returns whether a given operation is relevant enough to trigger a save.
7403
+ */
7404
+
7405
+ var isRelevantOperation = function isRelevantOperation(op) {
7406
+ if (op.type === 'set_selection') {
7407
+ return false;
7408
+ }
7409
+
7410
+ return true;
7411
+ };
7412
+
7408
7413
  var useOnValueChanged = function useOnValueChanged(_ref) {
7409
7414
  var editorId = _ref.editorId,
7410
7415
  handler = _ref.handler,