@atlaskit/editor-plugin-help-dialog 0.3.7 → 0.3.9

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
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-help-dialog
2
2
 
3
+ ## 0.3.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [#68572](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/68572) [`15d407fe5143`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/15d407fe5143) - Upgrading @atlaskit/editor-prosemirror dependency
8
+
9
+ ## 0.3.8
10
+
11
+ ### Patch Changes
12
+
13
+ - [#65334](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/65334) [`089979f0308f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/089979f0308f) - [ux] ECA11Y-111/ECA11Y-86 Help dialog - resize table and media information
14
+
3
15
  ## 0.3.7
4
16
 
5
17
  ### Patch Changes
@@ -25,64 +25,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
25
25
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
26
26
  /** @jsx jsx */
27
27
 
28
- var messages = (0, _reactIntlNext.defineMessages)({
29
- editorHelp: {
30
- id: 'fabric.editor.editorHelp',
31
- defaultMessage: 'Editor help',
32
- description: 'Title of editor help dialog.'
33
- },
34
- helpDialogTips: {
35
- id: 'fabric.editor.helpDialogTips',
36
- defaultMessage: 'Press {keyMap} to quickly open this dialog at any time',
37
- description: 'Hint about how to open a dialog quickly using a shortcut.'
38
- },
39
- keyboardShortcuts: {
40
- id: 'fabric.editor.keyboardShortcuts',
41
- defaultMessage: 'Keyboard shortcuts',
42
- description: ''
43
- },
44
- markdown: {
45
- id: 'fabric.editor.markdown',
46
- defaultMessage: 'Markdown',
47
- description: 'It is a name of popular markup language.'
48
- },
49
- pastePlainText: {
50
- id: 'fabric.editor.pastePlainText',
51
- defaultMessage: 'Paste plain text',
52
- description: ''
53
- },
54
- CheckUncheckActionItem: {
55
- id: 'fabric.editor.checkUncheckActionItem',
56
- defaultMessage: 'Toggle action item',
57
- description: 'For Check/Uncheck Action item use shortcut'
58
- },
59
- altText: {
60
- id: 'fabric.editor.altText',
61
- defaultMessage: 'Alt text',
62
- description: 'Alternative text for image.'
63
- },
64
- selectTableRow: {
65
- id: 'fabric.editor.selectTableRow',
66
- defaultMessage: 'Select table row',
67
- description: 'Hint for selecting a table row using a shortcut'
68
- },
69
- selectTableColumn: {
70
- id: 'fabric.editor.selectTableColumn',
71
- defaultMessage: 'Select table column',
72
- description: 'Hint for selecting a table column using a shortcut'
73
- },
74
- closeHelpDialog: {
75
- id: 'fabric.editor.closeHelpDialog',
76
- defaultMessage: 'Close help dialog',
77
- description: ''
78
- },
79
- // TODO: Move it inside quick insert plugin
80
- quickInsert: {
81
- id: 'fabric.editor.quickInsert',
82
- defaultMessage: 'Quick insert',
83
- description: 'Name of a feature, which let you insert items quickly.'
84
- }
85
- });
86
28
  var navigationKeymaps = function navigationKeymaps(_ref) {
87
29
  var formatMessage = _ref.formatMessage;
88
30
  return [{
@@ -385,7 +327,7 @@ var otherFormatting = function otherFormatting(_ref3) {
385
327
  return _keymaps.redo;
386
328
  }
387
329
  }, {
388
- name: formatMessage(messages.pastePlainText),
330
+ name: formatMessage(_messages.helpDialogMessages.pastePlainText),
389
331
  type: 'paste',
390
332
  keymap: function keymap() {
391
333
  return _keymaps.pastePlainText;
@@ -397,13 +339,13 @@ var otherFormatting = function otherFormatting(_ref3) {
397
339
  return _keymaps.addInlineComment;
398
340
  }
399
341
  }, {
400
- name: formatMessage(messages.CheckUncheckActionItem),
342
+ name: formatMessage(_messages.helpDialogMessages.CheckUncheckActionItem),
401
343
  type: 'checkbox',
402
344
  keymap: function keymap() {
403
345
  return _keymaps.toggleTaskItemCheckbox;
404
346
  }
405
347
  }].concat((0, _toConsumableArray2.default)((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y.table-selection_9uv33') ? [{
406
- name: formatMessage(messages.selectTableRow),
348
+ name: formatMessage(_messages.helpDialogMessages.selectTableRow),
407
349
  type: 'table',
408
350
  autoFormatting: function autoFormatting() {
409
351
  return (0, _react2.jsx)("span", {
@@ -427,7 +369,7 @@ var otherFormatting = function otherFormatting(_ref3) {
427
369
  }, "\u2192")));
428
370
  }
429
371
  }, {
430
- name: formatMessage(messages.selectTableColumn),
372
+ name: formatMessage(_messages.helpDialogMessages.selectTableColumn),
431
373
  type: 'table',
432
374
  autoFormatting: function autoFormatting() {
433
375
  return (0, _react2.jsx)("span", {
@@ -452,19 +394,45 @@ var otherFormatting = function otherFormatting(_ref3) {
452
394
  }
453
395
  }] : []));
454
396
  };
397
+ var resizeInformationFormatting = function resizeInformationFormatting(_ref4) {
398
+ var formatMessage = _ref4.formatMessage;
399
+ return [{
400
+ name: formatMessage(_messages.helpDialogMessages.increaseSize),
401
+ type: 'media',
402
+ keymap: function keymap() {
403
+ return _keymaps.increaseMediaSize;
404
+ }
405
+ }, {
406
+ name: formatMessage(_messages.helpDialogMessages.decreaseSize),
407
+ type: 'media',
408
+ keymap: function keymap() {
409
+ return _keymaps.decreaseMediaSize;
410
+ }
411
+ }];
412
+ };
413
+ var focusTableResizeHandleFormatting = function focusTableResizeHandleFormatting(_ref5) {
414
+ var formatMessage = _ref5.formatMessage;
415
+ return [{
416
+ name: formatMessage(_messages.helpDialogMessages.focusTableResizeHandle),
417
+ type: 'navigation',
418
+ keymap: function keymap() {
419
+ return _keymaps.focusTableResizer;
420
+ }
421
+ }];
422
+ };
455
423
  var imageAutoFormat = {
456
424
  name: 'Image',
457
425
  type: 'image',
458
426
  autoFormatting: function autoFormatting() {
459
427
  return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
460
428
  css: _styles.codeLg
461
- }, "![", (0, _react2.jsx)(_reactIntlNext.FormattedMessage, messages.altText), "](http://www.image.com)"));
429
+ }, "![", (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.helpDialogMessages.altText), "](http://www.image.com)"));
462
430
  }
463
431
  };
464
- var quickInsertAutoFormat = function quickInsertAutoFormat(_ref4) {
465
- var formatMessage = _ref4.formatMessage;
432
+ var quickInsertAutoFormat = function quickInsertAutoFormat(_ref6) {
433
+ var formatMessage = _ref6.formatMessage;
466
434
  return {
467
- name: formatMessage(messages.quickInsert),
435
+ name: formatMessage(_messages.helpDialogMessages.quickInsert),
468
436
  type: 'quickInsert',
469
437
  autoFormatting: function autoFormatting() {
470
438
  return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
@@ -480,15 +448,18 @@ var getKeyParts = function getKeyParts(keymap) {
480
448
  }
481
449
  return shortcut.replace(/\-(?=.)/g, ' + ').split(' ');
482
450
  };
451
+ var isAnyA11yResizeFeatureFlagEnabled = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-media-resizing_b5v0o') || (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-table-resizing_uapcv');
483
452
  var getSupportedFormatting = exports.getSupportedFormatting = function getSupportedFormatting(schema, intl, imageEnabled, quickInsertEnabled) {
484
453
  var supportedBySchema = formatting(intl).filter(function (format) {
485
454
  return schema.nodes[format.type] || schema.marks[format.type];
486
455
  });
487
- return [].concat((0, _toConsumableArray2.default)(navigationKeymaps(intl)), (0, _toConsumableArray2.default)(supportedBySchema), (0, _toConsumableArray2.default)(imageEnabled ? [imageAutoFormat] : []), (0, _toConsumableArray2.default)(quickInsertEnabled ? [quickInsertAutoFormat(intl)] : []), (0, _toConsumableArray2.default)(otherFormatting(intl)));
456
+ return [].concat((0, _toConsumableArray2.default)(navigationKeymaps(intl)), (0, _toConsumableArray2.default)(supportedBySchema), (0, _toConsumableArray2.default)(imageEnabled ? [imageAutoFormat] : []), (0, _toConsumableArray2.default)(quickInsertEnabled ? [quickInsertAutoFormat(intl)] : []), (0, _toConsumableArray2.default)(otherFormatting(intl)), (0, _toConsumableArray2.default)(isAnyA11yResizeFeatureFlagEnabled ? resizeInformationFormatting(intl) : []), (0, _toConsumableArray2.default)((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-table-resizing_uapcv') ? focusTableResizeHandleFormatting(intl) : []));
488
457
  };
489
458
  var getComponentFromKeymap = exports.getComponentFromKeymap = function getComponentFromKeymap(keymap) {
490
459
  var keyParts = getKeyParts(keymap);
491
- return (0, _react2.jsx)("span", null, keyParts.map(function (part, index) {
460
+ return (0, _react2.jsx)("span", {
461
+ css: _styles.componentFromKeymapWrapperStyles
462
+ }, keyParts.map(function (part, index) {
492
463
  if (part === '+') {
493
464
  return (0, _react2.jsx)("span", {
494
465
  key: "".concat(keyParts, "-").concat(index)
@@ -520,22 +491,22 @@ var getComponentFromKeymap = exports.getComponentFromKeymap = function getCompon
520
491
  }, part.toUpperCase());
521
492
  }));
522
493
  };
523
- var ModalHeader = (0, _reactIntlNext.injectIntl)(function (_ref5) {
524
- var formatMessage = _ref5.intl.formatMessage;
494
+ var ModalHeader = (0, _reactIntlNext.injectIntl)(function (_ref7) {
495
+ var formatMessage = _ref7.intl.formatMessage;
525
496
  var _useModal = (0, _modalDialog.useModal)(),
526
497
  onClose = _useModal.onClose;
527
498
  return (0, _react2.jsx)("div", {
528
499
  css: _styles.header
529
500
  }, (0, _react2.jsx)("h1", {
530
501
  css: _styles.dialogHeader
531
- }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, messages.editorHelp)), (0, _react2.jsx)("div", null, (0, _react2.jsx)(_uiMenu.ToolbarButton
502
+ }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.helpDialogMessages.editorHelp)), (0, _react2.jsx)("div", null, (0, _react2.jsx)(_uiMenu.ToolbarButton
532
503
  // @ts-ignore
533
504
  , {
534
505
  onClick: onClose,
535
- title: formatMessage(messages.closeHelpDialog),
506
+ title: formatMessage(_messages.helpDialogMessages.closeHelpDialog),
536
507
  spacing: "compact",
537
508
  iconBefore: (0, _react2.jsx)(_cross.default, {
538
- label: formatMessage(messages.closeHelpDialog),
509
+ label: formatMessage(_messages.helpDialogMessages.closeHelpDialog),
539
510
  size: "medium"
540
511
  })
541
512
  })));
@@ -543,17 +514,17 @@ var ModalHeader = (0, _reactIntlNext.injectIntl)(function (_ref5) {
543
514
  var ModalFooter = function ModalFooter() {
544
515
  return (0, _react2.jsx)("div", {
545
516
  css: _styles.footer
546
- }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, messages.helpDialogTips, {
517
+ }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _messages.helpDialogMessages.helpDialogTips, {
547
518
  values: {
548
519
  keyMap: getComponentFromKeymap(_keymaps.openHelp)
549
520
  }
550
521
  })));
551
522
  };
552
- var HelpDialog = function HelpDialog(_ref6) {
553
- var pluginInjectionApi = _ref6.pluginInjectionApi,
554
- editorView = _ref6.editorView,
555
- quickInsertEnabled = _ref6.quickInsertEnabled,
556
- intl = _ref6.intl;
523
+ var HelpDialog = function HelpDialog(_ref8) {
524
+ var pluginInjectionApi = _ref8.pluginInjectionApi,
525
+ editorView = _ref8.editorView,
526
+ quickInsertEnabled = _ref8.quickInsertEnabled,
527
+ intl = _ref8.intl;
557
528
  var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['helpDialog']),
558
529
  helpDialogState = _useSharedPluginState.helpDialogState;
559
530
  var closeDialog = (0, _react.useCallback)(function () {
@@ -587,7 +558,7 @@ var HelpDialog = function HelpDialog(_ref6) {
587
558
  css: _styles.column
588
559
  }, (0, _react2.jsx)("h2", {
589
560
  css: _styles.title
590
- }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, messages.keyboardShortcuts)), (0, _react2.jsx)("ul", null, formatting.filter(function (form) {
561
+ }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.helpDialogMessages.keyboardShortcuts)), (0, _react2.jsx)("ul", null, formatting.filter(function (form) {
591
562
  var keymap = form.keymap && form.keymap();
592
563
  return keymap && keymap[_utils.browser.mac ? 'mac' : 'windows'];
593
564
  }).map(function (form) {
@@ -610,7 +581,7 @@ var HelpDialog = function HelpDialog(_ref6) {
610
581
  css: _styles.column
611
582
  }, (0, _react2.jsx)("h2", {
612
583
  css: _styles.title
613
- }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, messages.markdown)), (0, _react2.jsx)("ul", null, formatting.filter(function (form) {
584
+ }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.helpDialogMessages.markdown)), (0, _react2.jsx)("ul", null, formatting.filter(function (form) {
614
585
  return shortcutNamesWithoutKeymap.indexOf(form.type) === -1;
615
586
  }).map(function (form) {
616
587
  return form.autoFormatting && (0, _react2.jsx)("li", {
@@ -5,14 +5,14 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.title = exports.shortcutsArray = exports.row = exports.line = exports.header = exports.footer = exports.dialogHeader = exports.contentWrapper = exports.content = exports.column = exports.codeSm = exports.codeMd = exports.codeLg = void 0;
8
+ exports.title = exports.shortcutsArray = exports.row = exports.line = exports.header = exports.footer = exports.dialogHeader = exports.contentWrapper = exports.content = exports.componentFromKeymapWrapperStyles = exports.column = exports.codeSm = exports.codeMd = exports.codeLg = void 0;
9
9
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
10
10
  var _react = require("@emotion/react");
11
11
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
12
12
  var _colors = _interopRequireWildcard(require("@atlaskit/theme/colors"));
13
13
  var colors = _colors;
14
14
  var _constants = require("@atlaskit/theme/constants");
15
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
15
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
16
16
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
17
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
18
18
  var header = exports.header = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n z-index: ", ";\n min-height: 24px;\n padding: ", " ", ";\n font-size: ", ";\n display: flex;\n justify-content: space-between;\n align-items: center;\n box-shadow: 'none';\n color: ", ";\n background-color: ", ";\n border-radius: ", "px;\n"])), _editorSharedStyles.akEditorUnitZIndex, "var(--ds-space-250, 20px)", "var(--ds-space-500, 40px)", (0, _editorSharedStyles.relativeFontSizeToBase16)(24), "var(--ds-text, ".concat(colors.N400, ")"), "var(--ds-background-neutral-subtle, ".concat(colors.N0, ")"), (0, _constants.borderRadius)());
@@ -48,4 +48,5 @@ var title = exports.title = {
48
48
  var codeSm = exports.codeSm = (0, _react.css)(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n background-color: ", ";\n border-radius: ", "px;\n width: 24px;\n display: inline-block;\n height: 24px;\n line-height: 24px;\n text-align: center;\n"])), "var(--ds-background-neutral, ".concat(colors.N20, ")"), (0, _constants.borderRadius)());
49
49
  var codeMd = exports.codeMd = (0, _react.css)(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n background-color: ", ";\n border-radius: ", "px;\n display: inline-block;\n height: 24px;\n line-height: 24px;\n width: 50px;\n text-align: center;\n"])), "var(--ds-background-neutral, ".concat(colors.N20, ")"), (0, _constants.borderRadius)());
50
50
  var codeLg = exports.codeLg = (0, _react.css)(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n background-color: ", ";\n border-radius: ", "px;\n display: inline-block;\n height: 24px;\n line-height: 24px;\n padding: 0 10px;\n text-align: center;\n"])), "var(--ds-background-neutral, ".concat(colors.N20, ")"), (0, _constants.borderRadius)());
51
- var shortcutsArray = exports.shortcutsArray = (0, _react.css)(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n gap: ", ";\n"])), "var(--ds-space-150, 12px)");
51
+ var shortcutsArray = exports.shortcutsArray = (0, _react.css)(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n gap: ", ";\n"])), "var(--ds-space-150, 12px)");
52
+ var componentFromKeymapWrapperStyles = exports.componentFromKeymapWrapperStyles = (0, _react.css)(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2.default)(["\n flex-shrink: 0;\n"])));
@@ -2,75 +2,17 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  /** @jsx jsx */
3
3
  import { useCallback, useEffect } from 'react';
4
4
  import { jsx } from '@emotion/react';
5
- import { defineMessages, FormattedMessage, injectIntl } from 'react-intl-next';
5
+ import { FormattedMessage, injectIntl } from 'react-intl-next';
6
6
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
7
- import { addInlineComment, addLink, alignLeft, clearFormatting, insertRule, navToEditorToolbar, navToFloatingToolbar, openHelp, pastePlainText, redo, setNormalText, toggleBlockQuote, toggleBold, toggleBulletList, toggleCode, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6, toggleItalic, toggleOrderedList, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleTaskItemCheckbox, toggleUnderline, undo } from '@atlaskit/editor-common/keymaps';
8
- import { alignmentMessages, annotationMessages, blockTypeMessages, listMessages, toolbarInsertBlockMessages, toolbarMessages, undoRedoMessages } from '@atlaskit/editor-common/messages';
7
+ import { addInlineComment, addLink, alignLeft, clearFormatting, decreaseMediaSize, focusTableResizer, increaseMediaSize, insertRule, navToEditorToolbar, navToFloatingToolbar, openHelp, pastePlainText, redo, setNormalText, toggleBlockQuote, toggleBold, toggleBulletList, toggleCode, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6, toggleItalic, toggleOrderedList, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleTaskItemCheckbox, toggleUnderline, undo } from '@atlaskit/editor-common/keymaps';
8
+ import { alignmentMessages, annotationMessages, blockTypeMessages, listMessages, helpDialogMessages as messages, toolbarInsertBlockMessages, toolbarMessages, undoRedoMessages } from '@atlaskit/editor-common/messages';
9
9
  import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
10
10
  import { browser } from '@atlaskit/editor-common/utils';
11
11
  import CrossIcon from '@atlaskit/icon/glyph/cross';
12
12
  import AkModalDialog, { ModalTransition, useModal } from '@atlaskit/modal-dialog';
13
13
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
14
14
  import { closeHelpCommand } from '../commands';
15
- import { codeLg, codeMd, codeSm, column, content, contentWrapper, dialogHeader, footer, header, line, row, shortcutsArray, title } from './styles';
16
- const messages = defineMessages({
17
- editorHelp: {
18
- id: 'fabric.editor.editorHelp',
19
- defaultMessage: 'Editor help',
20
- description: 'Title of editor help dialog.'
21
- },
22
- helpDialogTips: {
23
- id: 'fabric.editor.helpDialogTips',
24
- defaultMessage: 'Press {keyMap} to quickly open this dialog at any time',
25
- description: 'Hint about how to open a dialog quickly using a shortcut.'
26
- },
27
- keyboardShortcuts: {
28
- id: 'fabric.editor.keyboardShortcuts',
29
- defaultMessage: 'Keyboard shortcuts',
30
- description: ''
31
- },
32
- markdown: {
33
- id: 'fabric.editor.markdown',
34
- defaultMessage: 'Markdown',
35
- description: 'It is a name of popular markup language.'
36
- },
37
- pastePlainText: {
38
- id: 'fabric.editor.pastePlainText',
39
- defaultMessage: 'Paste plain text',
40
- description: ''
41
- },
42
- CheckUncheckActionItem: {
43
- id: 'fabric.editor.checkUncheckActionItem',
44
- defaultMessage: 'Toggle action item',
45
- description: 'For Check/Uncheck Action item use shortcut'
46
- },
47
- altText: {
48
- id: 'fabric.editor.altText',
49
- defaultMessage: 'Alt text',
50
- description: 'Alternative text for image.'
51
- },
52
- selectTableRow: {
53
- id: 'fabric.editor.selectTableRow',
54
- defaultMessage: 'Select table row',
55
- description: 'Hint for selecting a table row using a shortcut'
56
- },
57
- selectTableColumn: {
58
- id: 'fabric.editor.selectTableColumn',
59
- defaultMessage: 'Select table column',
60
- description: 'Hint for selecting a table column using a shortcut'
61
- },
62
- closeHelpDialog: {
63
- id: 'fabric.editor.closeHelpDialog',
64
- defaultMessage: 'Close help dialog',
65
- description: ''
66
- },
67
- // TODO: Move it inside quick insert plugin
68
- quickInsert: {
69
- id: 'fabric.editor.quickInsert',
70
- defaultMessage: 'Quick insert',
71
- description: 'Name of a feature, which let you insert items quickly.'
72
- }
73
- });
15
+ import { codeLg, codeMd, codeSm, column, componentFromKeymapWrapperStyles, content, contentWrapper, dialogHeader, footer, header, line, row, shortcutsArray, title } from './styles';
74
16
  const navigationKeymaps = ({
75
17
  formatMessage
76
18
  }) => [{
@@ -337,6 +279,24 @@ const otherFormatting = ({
337
279
  css: codeSm
338
280
  }, "\u2193")))
339
281
  }] : [])];
282
+ const resizeInformationFormatting = ({
283
+ formatMessage
284
+ }) => [{
285
+ name: formatMessage(messages.increaseSize),
286
+ type: 'media',
287
+ keymap: () => increaseMediaSize
288
+ }, {
289
+ name: formatMessage(messages.decreaseSize),
290
+ type: 'media',
291
+ keymap: () => decreaseMediaSize
292
+ }];
293
+ const focusTableResizeHandleFormatting = ({
294
+ formatMessage
295
+ }) => [{
296
+ name: formatMessage(messages.focusTableResizeHandle),
297
+ type: 'navigation',
298
+ keymap: () => focusTableResizer
299
+ }];
340
300
  const imageAutoFormat = {
341
301
  name: 'Image',
342
302
  type: 'image',
@@ -360,13 +320,16 @@ const getKeyParts = keymap => {
360
320
  }
361
321
  return shortcut.replace(/\-(?=.)/g, ' + ').split(' ');
362
322
  };
323
+ const isAnyA11yResizeFeatureFlagEnabled = getBooleanFF('platform.editor.a11y-media-resizing_b5v0o') || getBooleanFF('platform.editor.a11y-table-resizing_uapcv');
363
324
  export const getSupportedFormatting = (schema, intl, imageEnabled, quickInsertEnabled) => {
364
325
  const supportedBySchema = formatting(intl).filter(format => schema.nodes[format.type] || schema.marks[format.type]);
365
- return [...navigationKeymaps(intl), ...supportedBySchema, ...(imageEnabled ? [imageAutoFormat] : []), ...(quickInsertEnabled ? [quickInsertAutoFormat(intl)] : []), ...otherFormatting(intl)];
326
+ return [...navigationKeymaps(intl), ...supportedBySchema, ...(imageEnabled ? [imageAutoFormat] : []), ...(quickInsertEnabled ? [quickInsertAutoFormat(intl)] : []), ...otherFormatting(intl), ...(isAnyA11yResizeFeatureFlagEnabled ? resizeInformationFormatting(intl) : []), ...(getBooleanFF('platform.editor.a11y-table-resizing_uapcv') ? focusTableResizeHandleFormatting(intl) : [])];
366
327
  };
367
328
  export const getComponentFromKeymap = keymap => {
368
329
  const keyParts = getKeyParts(keymap);
369
- return jsx("span", null, keyParts.map((part, index) => {
330
+ return jsx("span", {
331
+ css: componentFromKeymapWrapperStyles
332
+ }, keyParts.map((part, index) => {
370
333
  if (part === '+') {
371
334
  return jsx("span", {
372
335
  key: `${keyParts}-${index}`
@@ -113,4 +113,7 @@ export const shortcutsArray = css`
113
113
  flex-direction: column;
114
114
  flex-shrink: 0;
115
115
  gap: ${"var(--ds-space-150, 12px)"};
116
+ `;
117
+ export const componentFromKeymapWrapperStyles = css`
118
+ flex-shrink: 0;
116
119
  `;
@@ -3,75 +3,17 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
3
  /** @jsx jsx */
4
4
  import { useCallback, useEffect } from 'react';
5
5
  import { jsx } from '@emotion/react';
6
- import { defineMessages, FormattedMessage, injectIntl } from 'react-intl-next';
6
+ import { FormattedMessage, injectIntl } from 'react-intl-next';
7
7
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
8
- import { addInlineComment, addLink, alignLeft, clearFormatting, insertRule, navToEditorToolbar, navToFloatingToolbar, openHelp, pastePlainText, redo, setNormalText, toggleBlockQuote, toggleBold, toggleBulletList, toggleCode, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6, toggleItalic, toggleOrderedList, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleTaskItemCheckbox, toggleUnderline, undo } from '@atlaskit/editor-common/keymaps';
9
- import { alignmentMessages, annotationMessages, blockTypeMessages, listMessages, toolbarInsertBlockMessages, toolbarMessages, undoRedoMessages } from '@atlaskit/editor-common/messages';
8
+ import { addInlineComment, addLink, alignLeft, clearFormatting, decreaseMediaSize, focusTableResizer, increaseMediaSize, insertRule, navToEditorToolbar, navToFloatingToolbar, openHelp, pastePlainText, redo, setNormalText, toggleBlockQuote, toggleBold, toggleBulletList, toggleCode, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6, toggleItalic, toggleOrderedList, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleTaskItemCheckbox, toggleUnderline, undo } from '@atlaskit/editor-common/keymaps';
9
+ import { alignmentMessages, annotationMessages, blockTypeMessages, listMessages, helpDialogMessages as messages, toolbarInsertBlockMessages, toolbarMessages, undoRedoMessages } from '@atlaskit/editor-common/messages';
10
10
  import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
11
11
  import { browser } from '@atlaskit/editor-common/utils';
12
12
  import CrossIcon from '@atlaskit/icon/glyph/cross';
13
13
  import AkModalDialog, { ModalTransition, useModal } from '@atlaskit/modal-dialog';
14
14
  import { getBooleanFF } from '@atlaskit/platform-feature-flags';
15
15
  import { closeHelpCommand } from '../commands';
16
- import { codeLg, codeMd, codeSm, column, content, contentWrapper, dialogHeader, footer, header, line, row, shortcutsArray, title } from './styles';
17
- var messages = defineMessages({
18
- editorHelp: {
19
- id: 'fabric.editor.editorHelp',
20
- defaultMessage: 'Editor help',
21
- description: 'Title of editor help dialog.'
22
- },
23
- helpDialogTips: {
24
- id: 'fabric.editor.helpDialogTips',
25
- defaultMessage: 'Press {keyMap} to quickly open this dialog at any time',
26
- description: 'Hint about how to open a dialog quickly using a shortcut.'
27
- },
28
- keyboardShortcuts: {
29
- id: 'fabric.editor.keyboardShortcuts',
30
- defaultMessage: 'Keyboard shortcuts',
31
- description: ''
32
- },
33
- markdown: {
34
- id: 'fabric.editor.markdown',
35
- defaultMessage: 'Markdown',
36
- description: 'It is a name of popular markup language.'
37
- },
38
- pastePlainText: {
39
- id: 'fabric.editor.pastePlainText',
40
- defaultMessage: 'Paste plain text',
41
- description: ''
42
- },
43
- CheckUncheckActionItem: {
44
- id: 'fabric.editor.checkUncheckActionItem',
45
- defaultMessage: 'Toggle action item',
46
- description: 'For Check/Uncheck Action item use shortcut'
47
- },
48
- altText: {
49
- id: 'fabric.editor.altText',
50
- defaultMessage: 'Alt text',
51
- description: 'Alternative text for image.'
52
- },
53
- selectTableRow: {
54
- id: 'fabric.editor.selectTableRow',
55
- defaultMessage: 'Select table row',
56
- description: 'Hint for selecting a table row using a shortcut'
57
- },
58
- selectTableColumn: {
59
- id: 'fabric.editor.selectTableColumn',
60
- defaultMessage: 'Select table column',
61
- description: 'Hint for selecting a table column using a shortcut'
62
- },
63
- closeHelpDialog: {
64
- id: 'fabric.editor.closeHelpDialog',
65
- defaultMessage: 'Close help dialog',
66
- description: ''
67
- },
68
- // TODO: Move it inside quick insert plugin
69
- quickInsert: {
70
- id: 'fabric.editor.quickInsert',
71
- defaultMessage: 'Quick insert',
72
- description: 'Name of a feature, which let you insert items quickly.'
73
- }
74
- });
16
+ import { codeLg, codeMd, codeSm, column, componentFromKeymapWrapperStyles, content, contentWrapper, dialogHeader, footer, header, line, row, shortcutsArray, title } from './styles';
75
17
  var navigationKeymaps = function navigationKeymaps(_ref) {
76
18
  var formatMessage = _ref.formatMessage;
77
19
  return [{
@@ -441,6 +383,32 @@ var otherFormatting = function otherFormatting(_ref3) {
441
383
  }
442
384
  }] : []));
443
385
  };
386
+ var resizeInformationFormatting = function resizeInformationFormatting(_ref4) {
387
+ var formatMessage = _ref4.formatMessage;
388
+ return [{
389
+ name: formatMessage(messages.increaseSize),
390
+ type: 'media',
391
+ keymap: function keymap() {
392
+ return increaseMediaSize;
393
+ }
394
+ }, {
395
+ name: formatMessage(messages.decreaseSize),
396
+ type: 'media',
397
+ keymap: function keymap() {
398
+ return decreaseMediaSize;
399
+ }
400
+ }];
401
+ };
402
+ var focusTableResizeHandleFormatting = function focusTableResizeHandleFormatting(_ref5) {
403
+ var formatMessage = _ref5.formatMessage;
404
+ return [{
405
+ name: formatMessage(messages.focusTableResizeHandle),
406
+ type: 'navigation',
407
+ keymap: function keymap() {
408
+ return focusTableResizer;
409
+ }
410
+ }];
411
+ };
444
412
  var imageAutoFormat = {
445
413
  name: 'Image',
446
414
  type: 'image',
@@ -450,8 +418,8 @@ var imageAutoFormat = {
450
418
  }, "![", jsx(FormattedMessage, messages.altText), "](http://www.image.com)"));
451
419
  }
452
420
  };
453
- var quickInsertAutoFormat = function quickInsertAutoFormat(_ref4) {
454
- var formatMessage = _ref4.formatMessage;
421
+ var quickInsertAutoFormat = function quickInsertAutoFormat(_ref6) {
422
+ var formatMessage = _ref6.formatMessage;
455
423
  return {
456
424
  name: formatMessage(messages.quickInsert),
457
425
  type: 'quickInsert',
@@ -469,15 +437,18 @@ var getKeyParts = function getKeyParts(keymap) {
469
437
  }
470
438
  return shortcut.replace(/\-(?=.)/g, ' + ').split(' ');
471
439
  };
440
+ var isAnyA11yResizeFeatureFlagEnabled = getBooleanFF('platform.editor.a11y-media-resizing_b5v0o') || getBooleanFF('platform.editor.a11y-table-resizing_uapcv');
472
441
  export var getSupportedFormatting = function getSupportedFormatting(schema, intl, imageEnabled, quickInsertEnabled) {
473
442
  var supportedBySchema = formatting(intl).filter(function (format) {
474
443
  return schema.nodes[format.type] || schema.marks[format.type];
475
444
  });
476
- return [].concat(_toConsumableArray(navigationKeymaps(intl)), _toConsumableArray(supportedBySchema), _toConsumableArray(imageEnabled ? [imageAutoFormat] : []), _toConsumableArray(quickInsertEnabled ? [quickInsertAutoFormat(intl)] : []), _toConsumableArray(otherFormatting(intl)));
445
+ return [].concat(_toConsumableArray(navigationKeymaps(intl)), _toConsumableArray(supportedBySchema), _toConsumableArray(imageEnabled ? [imageAutoFormat] : []), _toConsumableArray(quickInsertEnabled ? [quickInsertAutoFormat(intl)] : []), _toConsumableArray(otherFormatting(intl)), _toConsumableArray(isAnyA11yResizeFeatureFlagEnabled ? resizeInformationFormatting(intl) : []), _toConsumableArray(getBooleanFF('platform.editor.a11y-table-resizing_uapcv') ? focusTableResizeHandleFormatting(intl) : []));
477
446
  };
478
447
  export var getComponentFromKeymap = function getComponentFromKeymap(keymap) {
479
448
  var keyParts = getKeyParts(keymap);
480
- return jsx("span", null, keyParts.map(function (part, index) {
449
+ return jsx("span", {
450
+ css: componentFromKeymapWrapperStyles
451
+ }, keyParts.map(function (part, index) {
481
452
  if (part === '+') {
482
453
  return jsx("span", {
483
454
  key: "".concat(keyParts, "-").concat(index)
@@ -509,8 +480,8 @@ export var getComponentFromKeymap = function getComponentFromKeymap(keymap) {
509
480
  }, part.toUpperCase());
510
481
  }));
511
482
  };
512
- var ModalHeader = injectIntl(function (_ref5) {
513
- var formatMessage = _ref5.intl.formatMessage;
483
+ var ModalHeader = injectIntl(function (_ref7) {
484
+ var formatMessage = _ref7.intl.formatMessage;
514
485
  var _useModal = useModal(),
515
486
  onClose = _useModal.onClose;
516
487
  return jsx("div", {
@@ -538,11 +509,11 @@ var ModalFooter = function ModalFooter() {
538
509
  }
539
510
  })));
540
511
  };
541
- var HelpDialog = function HelpDialog(_ref6) {
542
- var pluginInjectionApi = _ref6.pluginInjectionApi,
543
- editorView = _ref6.editorView,
544
- quickInsertEnabled = _ref6.quickInsertEnabled,
545
- intl = _ref6.intl;
512
+ var HelpDialog = function HelpDialog(_ref8) {
513
+ var pluginInjectionApi = _ref8.pluginInjectionApi,
514
+ editorView = _ref8.editorView,
515
+ quickInsertEnabled = _ref8.quickInsertEnabled,
516
+ intl = _ref8.intl;
546
517
  var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['helpDialog']),
547
518
  helpDialogState = _useSharedPluginState.helpDialogState;
548
519
  var closeDialog = useCallback(function () {
@@ -1,5 +1,5 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10;
2
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
3
3
  import { css } from '@emotion/react';
4
4
  import { akEditorUnitZIndex, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
5
5
  import * as colors from '@atlaskit/theme/colors';
@@ -38,4 +38,5 @@ export var title = {
38
38
  export var codeSm = css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n background-color: ", ";\n border-radius: ", "px;\n width: 24px;\n display: inline-block;\n height: 24px;\n line-height: 24px;\n text-align: center;\n"])), "var(--ds-background-neutral, ".concat(colors.N20, ")"), borderRadius());
39
39
  export var codeMd = css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n background-color: ", ";\n border-radius: ", "px;\n display: inline-block;\n height: 24px;\n line-height: 24px;\n width: 50px;\n text-align: center;\n"])), "var(--ds-background-neutral, ".concat(colors.N20, ")"), borderRadius());
40
40
  export var codeLg = css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n background-color: ", ";\n border-radius: ", "px;\n display: inline-block;\n height: 24px;\n line-height: 24px;\n padding: 0 10px;\n text-align: center;\n"])), "var(--ds-background-neutral, ".concat(colors.N20, ")"), borderRadius());
41
- export var shortcutsArray = css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n gap: ", ";\n"])), "var(--ds-space-150, 12px)");
41
+ export var shortcutsArray = css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n gap: ", ";\n"])), "var(--ds-space-150, 12px)");
42
+ export var componentFromKeymapWrapperStyles = css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n flex-shrink: 0;\n"])));
@@ -32,3 +32,4 @@ export declare const codeSm: import("@emotion/react").SerializedStyles;
32
32
  export declare const codeMd: import("@emotion/react").SerializedStyles;
33
33
  export declare const codeLg: import("@emotion/react").SerializedStyles;
34
34
  export declare const shortcutsArray: import("@emotion/react").SerializedStyles;
35
+ export declare const componentFromKeymapWrapperStyles: import("@emotion/react").SerializedStyles;
@@ -32,3 +32,4 @@ export declare const codeSm: import("@emotion/react").SerializedStyles;
32
32
  export declare const codeMd: import("@emotion/react").SerializedStyles;
33
33
  export declare const codeLg: import("@emotion/react").SerializedStyles;
34
34
  export declare const shortcutsArray: import("@emotion/react").SerializedStyles;
35
+ export declare const componentFromKeymapWrapperStyles: import("@emotion/react").SerializedStyles;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-help-dialog",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
4
4
  "description": "Help Dialog plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,16 +32,16 @@
32
32
  ".": "./src/index.ts"
33
33
  },
34
34
  "dependencies": {
35
- "@atlaskit/editor-common": "^77.0.0",
35
+ "@atlaskit/editor-common": "^77.3.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^0.4.0",
37
37
  "@atlaskit/editor-plugin-quick-insert": "^0.2.0",
38
- "@atlaskit/editor-prosemirror": "1.1.0",
38
+ "@atlaskit/editor-prosemirror": "3.0.0",
39
39
  "@atlaskit/editor-shared-styles": "^2.9.0",
40
40
  "@atlaskit/icon": "^22.0.0",
41
41
  "@atlaskit/modal-dialog": "^12.10.0",
42
42
  "@atlaskit/platform-feature-flags": "^0.2.5",
43
43
  "@atlaskit/theme": "^12.6.0",
44
- "@atlaskit/tokens": "^1.34.0",
44
+ "@atlaskit/tokens": "^1.35.0",
45
45
  "@babel/runtime": "^7.0.0",
46
46
  "@emotion/react": "^11.7.1",
47
47
  "react-intl-next": "npm:react-intl@^5.18.1",
@@ -90,6 +90,12 @@
90
90
  "platform-feature-flags": {
91
91
  "platform.editor.a11y.table-selection_9uv33": {
92
92
  "type": "boolean"
93
+ },
94
+ "platform.editor.a11y-media-resizing_b5v0o": {
95
+ "type": "boolean"
96
+ },
97
+ "platform.editor.a11y-table-resizing_uapcv": {
98
+ "type": "boolean"
93
99
  }
94
100
  }
95
101
  }