@contentful/field-editor-rich-text 3.4.0 → 3.4.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,12 @@
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.1](https://github.com/contentful/field-editors/compare/@contentful/field-editor-rich-text@3.4.0...@contentful/field-editor-rich-text@3.4.1) (2023-01-20)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **rte:** [TOL-989] command prompt not always visible and working ([#1327](https://github.com/contentful/field-editors/issues/1327)) ([1ded2f0](https://github.com/contentful/field-editors/commit/1ded2f0a6da25470ae639fac51a617f0ab233917))
11
+
6
12
  # [3.4.0](https://github.com/contentful/field-editors/compare/@contentful/field-editor-rich-text@3.3.5...@contentful/field-editor-rich-text@3.4.0) (2023-01-18)
7
13
 
8
14
  ### Features
@@ -2087,6 +2087,9 @@ var styles = {
2087
2087
  marginLeft: 0
2088
2088
  }
2089
2089
  }),
2090
+ menuPoper: /*#__PURE__*/emotion.css({
2091
+ zIndex: tokens.zIndexModal
2092
+ }),
2090
2093
  menuContent: /*#__PURE__*/emotion.css({
2091
2094
  width: '400px',
2092
2095
  maxHeight: '300px'
@@ -2259,6 +2262,7 @@ var CommandList = function CommandList(_ref5) {
2259
2262
  }, /*#__PURE__*/React.createElement(f36Components.ScreenReaderOnly, null, "Richtext commands. Currently focused item: ", selectedItem, ". Press ", /*#__PURE__*/React.createElement("kbd", null, "enter"), " to select, ", /*#__PURE__*/React.createElement("kbd", null, "arrows"), " to navigate, ", /*#__PURE__*/React.createElement("kbd", null, "escape"), " to close.")), /*#__PURE__*/React.createElement(f36Utils.Portal, null, /*#__PURE__*/React.createElement("div", _extends({
2260
2263
  "aria-hidden": true,
2261
2264
  ref: popoverContainer,
2265
+ className: styles.menuPoper,
2262
2266
  style: popper.styles.popper
2263
2267
  }, popper.attributes.popper), /*#__PURE__*/React.createElement(f36Components.Popover, {
2264
2268
  isOpen: isOpen,
@@ -2314,7 +2318,13 @@ var CommandPrompt = function CommandPrompt(props) {
2314
2318
  var createOnKeyDown = function createOnKeyDown() {
2315
2319
  return function (editor) {
2316
2320
  return function (event) {
2317
- if (isHotkey('/', event)) {
2321
+ // Support for different keyboard layouts:
2322
+ // `isHotKey` uses by default `event.which`, which will never generates a match for all layouts (QWERTY: `/`, QWERTZ: `shift+7`)
2323
+ // with `byKey: true` `isHotKey` uses `event.key` which will return the interpreted key '/'
2324
+ // It would still fail without the the optional `shift?` param, as it first checks the modKeys (`shiftKey` would be true on QWERTZ)
2325
+ if (isHotkey('shift?+/', {
2326
+ byKey: true
2327
+ }, event)) {
2318
2328
  addMark(editor, COMMAND_PROMPT);
2319
2329
  editor.tracking.onCommandPaletteAction('openRichTextCommandPalette');
2320
2330
  }
@@ -5541,7 +5551,13 @@ var createCodePlugin = function createCodePlugin() {
5541
5551
  type: Contentful.MARKS.CODE,
5542
5552
  component: Code,
5543
5553
  options: {
5544
- hotkey: ['mod+/']
5554
+ // We need to define multiple hotkeys here,
5555
+ // - mod+/ -> QWERTY keyboard layout
5556
+ // - mod+shift+7 -> QWERTZ keyboard layout
5557
+ // The workaround like in packages/rich-text/src/plugins/CommandPalette/onKeyDown.ts is sadly not working here,
5558
+ // as `shift+7` is not interpreted as `/` with the `mod` key by the OS.
5559
+ // TODO: there are a lot more different keyboard layouts out there
5560
+ hotkey: ['mod+/', 'mod+shift+7']
5545
5561
  },
5546
5562
  handlers: {
5547
5563
  onKeyDown: buildMarkEventHandler(Contentful.MARKS.CODE)