@contentful/field-editor-rich-text 3.4.19 → 3.4.21

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,16 @@
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
+ ## [3.4.21](https://github.com/contentful/field-editors/compare/@contentful/field-editor-rich-text@3.4.20...@contentful/field-editor-rich-text@3.4.21) (2023-05-09)
7
+
8
+ **Note:** Version bump only for package @contentful/field-editor-rich-text
9
+
10
+ ## [3.4.20](https://github.com/contentful/field-editors/compare/@contentful/field-editor-rich-text@3.4.19...@contentful/field-editor-rich-text@3.4.20) (2023-04-21)
11
+
12
+ ### Bug Fixes
13
+
14
+ - [RTE] embed entries in correct place when using hotkeys ([#1400](https://github.com/contentful/field-editors/issues/1400)) ([e9712b5](https://github.com/contentful/field-editors/commit/e9712b5892c6b3cacb50127082df146ed39149e8))
15
+
6
16
  ## [3.4.19](https://github.com/contentful/field-editors/compare/@contentful/field-editor-rich-text@3.4.18...@contentful/field-editor-rich-text@3.4.19) (2023-04-19)
7
17
 
8
18
  **Note:** Version bump only for package @contentful/field-editor-rich-text
@@ -1772,6 +1772,9 @@ async function selectEntityAndInsert(nodeType, sdk, editor, logAction) {
1772
1772
  const config = { ...baseConfig,
1773
1773
  withCreate: true
1774
1774
  };
1775
+ const {
1776
+ selection
1777
+ } = editor;
1775
1778
  const rteSlide = watchCurrentSlide(sdk.navigator);
1776
1779
  const entity = await selectEntity(config);
1777
1780
 
@@ -1780,6 +1783,9 @@ async function selectEntityAndInsert(nodeType, sdk, editor, logAction) {
1780
1783
  nodeType
1781
1784
  });
1782
1785
  } else {
1786
+ // Selection prevents incorrect position of inserted ref when RTE doesn't have focus
1787
+ // (i.e. when using hotkeys and slide-in)
1788
+ select(editor, selection);
1783
1789
  insertBlock$1(editor, nodeType, entity);
1784
1790
  ensureFollowingParagraph(editor);
1785
1791
  logAction('insert', {
@@ -2163,6 +2169,9 @@ async function selectEntityAndInsert$1(editor, sdk, logAction) {
2163
2169
  const config = { ...newEntitySelectorConfigFromRichTextField(sdk.field, Contentful.INLINES.EMBEDDED_ENTRY),
2164
2170
  withCreate: true
2165
2171
  };
2172
+ const {
2173
+ selection
2174
+ } = editor;
2166
2175
  const rteSlide = watchCurrentSlide(sdk.navigator);
2167
2176
  const entry = await sdk.dialogs.selectSingleEntry(config);
2168
2177
 
@@ -2171,6 +2180,9 @@ async function selectEntityAndInsert$1(editor, sdk, logAction) {
2171
2180
  nodeType: Contentful.INLINES.EMBEDDED_ENTRY
2172
2181
  });
2173
2182
  } else {
2183
+ // Selection prevents incorrect position of inserted ref when RTE doesn't have focus
2184
+ // (i.e. when using hotkeys and slide-in)
2185
+ select(editor, selection);
2174
2186
  insertNodes(editor, createInlineEntryNode$1(entry.sys.id));
2175
2187
  logAction('insert', {
2176
2188
  nodeType: Contentful.INLINES.EMBEDDED_ENTRY