@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.
@@ -2080,6 +2080,9 @@ var styles = {
2080
2080
  marginLeft: 0
2081
2081
  }
2082
2082
  }),
2083
+ menuPoper: /*#__PURE__*/css({
2084
+ zIndex: tokens.zIndexModal
2085
+ }),
2083
2086
  menuContent: /*#__PURE__*/css({
2084
2087
  width: '400px',
2085
2088
  maxHeight: '300px'
@@ -2252,6 +2255,7 @@ var CommandList = function CommandList(_ref5) {
2252
2255
  }, /*#__PURE__*/createElement(ScreenReaderOnly, null, "Richtext commands. Currently focused item: ", selectedItem, ". Press ", /*#__PURE__*/createElement("kbd", null, "enter"), " to select, ", /*#__PURE__*/createElement("kbd", null, "arrows"), " to navigate, ", /*#__PURE__*/createElement("kbd", null, "escape"), " to close.")), /*#__PURE__*/createElement(Portal, null, /*#__PURE__*/createElement("div", _extends({
2253
2256
  "aria-hidden": true,
2254
2257
  ref: popoverContainer,
2258
+ className: styles.menuPoper,
2255
2259
  style: popper.styles.popper
2256
2260
  }, popper.attributes.popper), /*#__PURE__*/createElement(Popover, {
2257
2261
  isOpen: isOpen,
@@ -2307,7 +2311,13 @@ var CommandPrompt = function CommandPrompt(props) {
2307
2311
  var createOnKeyDown = function createOnKeyDown() {
2308
2312
  return function (editor) {
2309
2313
  return function (event) {
2310
- if (isHotkey('/', event)) {
2314
+ // Support for different keyboard layouts:
2315
+ // `isHotKey` uses by default `event.which`, which will never generates a match for all layouts (QWERTY: `/`, QWERTZ: `shift+7`)
2316
+ // with `byKey: true` `isHotKey` uses `event.key` which will return the interpreted key '/'
2317
+ // It would still fail without the the optional `shift?` param, as it first checks the modKeys (`shiftKey` would be true on QWERTZ)
2318
+ if (isHotkey('shift?+/', {
2319
+ byKey: true
2320
+ }, event)) {
2311
2321
  addMark(editor, COMMAND_PROMPT);
2312
2322
  editor.tracking.onCommandPaletteAction('openRichTextCommandPalette');
2313
2323
  }
@@ -5534,7 +5544,13 @@ var createCodePlugin = function createCodePlugin() {
5534
5544
  type: MARKS.CODE,
5535
5545
  component: Code,
5536
5546
  options: {
5537
- hotkey: ['mod+/']
5547
+ // We need to define multiple hotkeys here,
5548
+ // - mod+/ -> QWERTY keyboard layout
5549
+ // - mod+shift+7 -> QWERTZ keyboard layout
5550
+ // The workaround like in packages/rich-text/src/plugins/CommandPalette/onKeyDown.ts is sadly not working here,
5551
+ // as `shift+7` is not interpreted as `/` with the `mod` key by the OS.
5552
+ // TODO: there are a lot more different keyboard layouts out there
5553
+ hotkey: ['mod+/', 'mod+shift+7']
5538
5554
  },
5539
5555
  handlers: {
5540
5556
  onKeyDown: buildMarkEventHandler(MARKS.CODE)