@atlaskit/editor-plugin-help-dialog 1.1.1 → 1.1.2

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/cjs/ui/Format.js +5 -0
  3. package/dist/cjs/ui/Modal.js +21 -0
  4. package/dist/cjs/ui/ModalContent.js +67 -0
  5. package/dist/cjs/ui/ModalFooter.js +26 -0
  6. package/dist/cjs/ui/ModalHeader.js +35 -0
  7. package/dist/cjs/ui/formatting.js +492 -0
  8. package/dist/cjs/ui/index.js +12 -561
  9. package/dist/cjs/ui/utils.js +55 -0
  10. package/dist/es2019/ui/Format.js +1 -0
  11. package/dist/es2019/ui/Modal.js +16 -0
  12. package/dist/es2019/ui/ModalContent.js +48 -0
  13. package/dist/es2019/ui/ModalFooter.js +16 -0
  14. package/dist/es2019/ui/ModalHeader.js +30 -0
  15. package/dist/es2019/ui/formatting.js +355 -0
  16. package/dist/es2019/ui/index.js +7 -423
  17. package/dist/es2019/ui/utils.js +48 -0
  18. package/dist/esm/ui/Format.js +1 -0
  19. package/dist/esm/ui/Modal.js +14 -0
  20. package/dist/esm/ui/ModalContent.js +59 -0
  21. package/dist/esm/ui/ModalFooter.js +18 -0
  22. package/dist/esm/ui/ModalHeader.js +27 -0
  23. package/dist/esm/ui/formatting.js +484 -0
  24. package/dist/esm/ui/index.js +12 -561
  25. package/dist/esm/ui/utils.js +48 -0
  26. package/dist/types/ui/Format.d.ts +8 -0
  27. package/dist/types/ui/Modal.d.ts +8 -0
  28. package/dist/types/ui/ModalContent.d.ts +9 -0
  29. package/dist/types/ui/ModalFooter.d.ts +4 -0
  30. package/dist/types/ui/ModalHeader.d.ts +10 -0
  31. package/dist/types/ui/formatting.d.ts +5 -0
  32. package/dist/types/ui/index.d.ts +3 -16
  33. package/dist/types/ui/utils.d.ts +5 -0
  34. package/dist/types-ts4.5/ui/Format.d.ts +8 -0
  35. package/dist/types-ts4.5/ui/Modal.d.ts +8 -0
  36. package/dist/types-ts4.5/ui/ModalContent.d.ts +9 -0
  37. package/dist/types-ts4.5/ui/ModalFooter.d.ts +4 -0
  38. package/dist/types-ts4.5/ui/ModalHeader.d.ts +10 -0
  39. package/dist/types-ts4.5/ui/formatting.d.ts +5 -0
  40. package/dist/types-ts4.5/ui/index.d.ts +3 -16
  41. package/dist/types-ts4.5/ui/utils.d.ts +5 -0
  42. package/package.json +11 -13
@@ -5,535 +5,24 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.getSupportedFormatting = exports.getComponentFromKeymap = exports.formatting = exports.default = void 0;
9
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
- var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
8
+ exports.default = void 0;
11
9
  var _react = require("react");
12
10
  var _react2 = require("@emotion/react");
13
11
  var _reactIntlNext = require("react-intl-next");
14
12
  var _hooks = require("@atlaskit/editor-common/hooks");
15
- var _keymaps = require("@atlaskit/editor-common/keymaps");
16
- var _messages = require("@atlaskit/editor-common/messages");
17
- var _uiMenu = require("@atlaskit/editor-common/ui-menu");
18
- var _utils = require("@atlaskit/editor-common/utils");
19
- var _cross = _interopRequireDefault(require("@atlaskit/icon/glyph/cross"));
20
13
  var _modalDialog = _interopRequireWildcard(require("@atlaskit/modal-dialog"));
21
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
22
14
  var _commands = require("../commands");
23
- var _styles = require("./styles");
15
+ var _formatting = require("./formatting");
16
+ var _Modal = _interopRequireDefault(require("./Modal"));
24
17
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
25
18
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
26
19
  /** @jsx jsx */
27
20
 
28
- var navigationKeymaps = function navigationKeymaps(_ref) {
29
- var formatMessage = _ref.formatMessage;
30
- return [{
31
- name: formatMessage(_messages.toolbarMessages.navigateToEditorToolbar),
32
- type: 'navigation',
33
- keymap: function keymap() {
34
- return _keymaps.navToEditorToolbar;
35
- }
36
- }, {
37
- name: formatMessage(_messages.toolbarMessages.navigateToFloatingToolbar),
38
- type: 'navigation',
39
- keymap: function keymap() {
40
- return _keymaps.navToFloatingToolbar;
41
- }
42
- }];
43
- };
44
- var formatting = exports.formatting = function formatting(_ref2) {
45
- var formatMessage = _ref2.formatMessage;
46
- return [{
47
- name: formatMessage(_messages.toolbarMessages.bold),
48
- type: 'strong',
49
- keymap: function keymap() {
50
- return _keymaps.toggleBold;
51
- },
52
- autoFormatting: function autoFormatting() {
53
- return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
54
- css: _styles.codeLg
55
- }, "**", (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.toolbarMessages.bold), "**"));
56
- }
57
- }, {
58
- name: formatMessage(_messages.toolbarMessages.italic),
59
- type: 'em',
60
- keymap: function keymap() {
61
- return _keymaps.toggleItalic;
62
- },
63
- autoFormatting: function autoFormatting() {
64
- return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
65
- css: _styles.codeLg
66
- }, "*", (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.toolbarMessages.italic), "*"));
67
- }
68
- }, {
69
- name: formatMessage(_messages.toolbarMessages.underline),
70
- type: 'underline',
71
- keymap: function keymap() {
72
- return _keymaps.toggleUnderline;
73
- }
74
- }, {
75
- name: formatMessage(_messages.toolbarMessages.strike),
76
- type: 'strike',
77
- keymap: function keymap() {
78
- return _keymaps.toggleStrikethrough;
79
- },
80
- autoFormatting: function autoFormatting() {
81
- return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
82
- css: _styles.codeLg
83
- }, "~~", (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.toolbarMessages.strike), "~~"));
84
- }
85
- }, {
86
- name: formatMessage(_messages.toolbarMessages.subscript),
87
- type: 'subsup',
88
- keymap: function keymap() {
89
- return _keymaps.toggleSubscript;
90
- }
91
- }, {
92
- name: formatMessage(_messages.toolbarMessages.superscript),
93
- type: 'subsup',
94
- keymap: function keymap() {
95
- return _keymaps.toggleSuperscript;
96
- }
97
- }, {
98
- name: formatMessage(_messages.blockTypeMessages.heading1),
99
- type: 'heading',
100
- keymap: function keymap() {
101
- return _keymaps.toggleHeading1;
102
- },
103
- autoFormatting: function autoFormatting() {
104
- return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
105
- css: _styles.codeSm
106
- }, "#"), " ", (0, _react2.jsx)("span", {
107
- css: _styles.codeLg
108
- }, "Space"));
109
- }
110
- }, {
111
- name: formatMessage(_messages.blockTypeMessages.heading2),
112
- type: 'heading',
113
- keymap: function keymap() {
114
- return _keymaps.toggleHeading2;
115
- },
116
- autoFormatting: function autoFormatting() {
117
- return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
118
- css: _styles.codeLg
119
- }, "##"), " ", (0, _react2.jsx)("span", {
120
- css: _styles.codeLg
121
- }, "Space"));
122
- }
123
- }, {
124
- name: formatMessage(_messages.blockTypeMessages.heading3),
125
- type: 'heading',
126
- keymap: function keymap() {
127
- return _keymaps.toggleHeading3;
128
- },
129
- autoFormatting: function autoFormatting() {
130
- return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
131
- css: _styles.codeLg
132
- }, "###"), " ", (0, _react2.jsx)("span", {
133
- css: _styles.codeLg
134
- }, "Space"));
135
- }
136
- }, {
137
- name: formatMessage(_messages.blockTypeMessages.heading4),
138
- type: 'heading',
139
- keymap: function keymap() {
140
- return _keymaps.toggleHeading4;
141
- },
142
- autoFormatting: function autoFormatting() {
143
- return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
144
- css: _styles.codeLg
145
- }, "####"), " ", (0, _react2.jsx)("span", {
146
- css: _styles.codeLg
147
- }, "Space"));
148
- }
149
- }, {
150
- name: formatMessage(_messages.blockTypeMessages.heading5),
151
- type: 'heading',
152
- keymap: function keymap() {
153
- return _keymaps.toggleHeading5;
154
- },
155
- autoFormatting: function autoFormatting() {
156
- return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
157
- css: _styles.codeLg
158
- }, "#####"), " ", (0, _react2.jsx)("span", {
159
- css: _styles.codeLg
160
- }, "Space"));
161
- }
162
- }, {
163
- name: formatMessage(_messages.blockTypeMessages.heading6),
164
- type: 'heading',
165
- keymap: function keymap() {
166
- return _keymaps.toggleHeading6;
167
- },
168
- autoFormatting: function autoFormatting() {
169
- return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
170
- css: _styles.codeLg
171
- }, "######"), " ", (0, _react2.jsx)("span", {
172
- css: _styles.codeLg
173
- }, "Space"));
174
- }
175
- }, {
176
- name: formatMessage(_messages.blockTypeMessages.normal),
177
- type: 'paragraph',
178
- keymap: function keymap() {
179
- return _keymaps.setNormalText;
180
- }
181
- }, {
182
- name: formatMessage(_messages.listMessages.orderedList),
183
- type: 'orderedList',
184
- keymap: function keymap() {
185
- return _keymaps.toggleOrderedList;
186
- },
187
- autoFormatting: function autoFormatting() {
188
- return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
189
- css: _styles.codeSm
190
- }, "1."), " ", (0, _react2.jsx)("span", {
191
- css: _styles.codeLg
192
- }, "Space"));
193
- }
194
- }, {
195
- name: formatMessage(_messages.listMessages.unorderedList),
196
- type: 'bulletList',
197
- keymap: function keymap() {
198
- return _keymaps.toggleBulletList;
199
- },
200
- autoFormatting: function autoFormatting() {
201
- return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
202
- css: _styles.codeSm
203
- }, "*"), " ", (0, _react2.jsx)("span", {
204
- css: _styles.codeLg
205
- }, "Space"));
206
- }
207
- }, {
208
- name: formatMessage(_messages.blockTypeMessages.blockquote),
209
- type: 'blockquote',
210
- keymap: function keymap() {
211
- return _keymaps.toggleBlockQuote;
212
- },
213
- autoFormatting: function autoFormatting() {
214
- return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
215
- css: _styles.codeLg
216
- }, '>'), " ", (0, _react2.jsx)("span", {
217
- css: _styles.codeLg
218
- }, "Space"));
219
- }
220
- }, {
221
- name: formatMessage(_messages.blockTypeMessages.codeblock),
222
- type: 'codeBlock',
223
- autoFormatting: function autoFormatting() {
224
- return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
225
- css: _styles.codeLg
226
- }, "```"));
227
- }
228
- }, {
229
- name: formatMessage(_messages.toolbarInsertBlockMessages.horizontalRule),
230
- type: 'rule',
231
- keymap: function keymap() {
232
- return _keymaps.insertRule;
233
- },
234
- autoFormatting: function autoFormatting() {
235
- return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
236
- css: _styles.codeLg
237
- }, "---"));
238
- }
239
- }, {
240
- name: formatMessage(_messages.toolbarInsertBlockMessages.link),
241
- type: 'link',
242
- keymap: function keymap() {
243
- return _keymaps.addLink;
244
- },
245
- autoFormatting: function autoFormatting() {
246
- return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
247
- css: _styles.codeLg
248
- }, "[", (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.toolbarInsertBlockMessages.link), "](http://a.com)"));
249
- }
250
- }, {
251
- name: formatMessage(_messages.toolbarMessages.code),
252
- type: 'code',
253
- keymap: function keymap() {
254
- return _keymaps.toggleCode;
255
- },
256
- autoFormatting: function autoFormatting() {
257
- return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
258
- css: _styles.codeLg
259
- }, "`", (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.toolbarMessages.code), "`"));
260
- }
261
- }, {
262
- name: formatMessage(_messages.toolbarInsertBlockMessages.action),
263
- type: 'taskItem',
264
- autoFormatting: function autoFormatting() {
265
- return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
266
- css: _styles.codeSm
267
- }, "[]"), " ", (0, _react2.jsx)("span", {
268
- css: _styles.codeLg
269
- }, "Space"));
270
- }
271
- }, {
272
- name: formatMessage(_messages.toolbarInsertBlockMessages.decision),
273
- type: 'decisionItem',
274
- autoFormatting: function autoFormatting() {
275
- return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
276
- css: _styles.codeSm
277
- }, "<>"), " ", (0, _react2.jsx)("span", {
278
- css: _styles.codeLg
279
- }, "Space"));
280
- }
281
- }, {
282
- name: formatMessage(_messages.toolbarInsertBlockMessages.emoji),
283
- type: 'emoji',
284
- autoFormatting: function autoFormatting() {
285
- return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
286
- css: _styles.codeLg
287
- }, ":"));
288
- }
289
- }, {
290
- name: formatMessage(_messages.toolbarInsertBlockMessages.mention),
291
- type: 'mention',
292
- autoFormatting: function autoFormatting() {
293
- return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
294
- css: _styles.codeLg
295
- }, "@"));
296
- }
297
- }, {
298
- name: formatMessage(_messages.alignmentMessages.alignLeft),
299
- type: 'alignment',
300
- keymap: function keymap() {
301
- return _keymaps.alignLeft;
302
- }
303
- }].concat((0, _toConsumableArray2.default)((0, _platformFeatureFlags.getBooleanFF)('platform.editor.text-alignment-keyboard-shortcuts') ? [{
304
- name: formatMessage(_messages.alignmentMessages.alignCenter),
305
- type: 'alignment',
306
- keymap: function keymap() {
307
- return _keymaps.alignCenter;
308
- }
309
- }, {
310
- name: formatMessage(_messages.alignmentMessages.alignRight),
311
- type: 'alignment',
312
- keymap: function keymap() {
313
- return _keymaps.alignRight;
314
- }
315
- }] : []));
316
- };
317
- var shortcutNamesWithoutKeymap = ['emoji', 'mention', 'quickInsert'];
318
- var otherFormatting = function otherFormatting(_ref3) {
319
- var formatMessage = _ref3.formatMessage;
320
- return [{
321
- name: formatMessage(_messages.toolbarMessages.clearFormatting),
322
- type: 'clearFormatting',
323
- keymap: function keymap() {
324
- return _keymaps.clearFormatting;
325
- }
326
- }, {
327
- name: formatMessage(_messages.undoRedoMessages.undo),
328
- type: 'undo',
329
- keymap: function keymap() {
330
- return _keymaps.undo;
331
- }
332
- }, {
333
- name: formatMessage(_messages.undoRedoMessages.redo),
334
- type: 'redo',
335
- keymap: function keymap() {
336
- return _keymaps.redo;
337
- }
338
- }, {
339
- name: formatMessage(_messages.helpDialogMessages.pastePlainText),
340
- type: 'paste',
341
- keymap: function keymap() {
342
- return _keymaps.pastePlainText;
343
- }
344
- }, {
345
- name: formatMessage(_messages.annotationMessages.createComment),
346
- type: 'annotation',
347
- keymap: function keymap() {
348
- return _keymaps.addInlineComment;
349
- }
350
- }, {
351
- name: formatMessage(_messages.helpDialogMessages.CheckUncheckActionItem),
352
- type: 'checkbox',
353
- keymap: function keymap() {
354
- return _keymaps.toggleTaskItemCheckbox;
355
- }
356
- }].concat((0, _toConsumableArray2.default)((0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y.table-selection_9uv33') ? [{
357
- name: formatMessage(_messages.helpDialogMessages.selectTableRow),
358
- type: 'table',
359
- autoFormatting: function autoFormatting() {
360
- return (0, _react2.jsx)("span", {
361
- css: _styles.shortcutsArray
362
- }, (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
363
- css: _styles.codeSm
364
- }, _utils.browser.mac ? '⌘' : 'Ctrl'), ' + ', (0, _react2.jsx)("span", {
365
- css: _styles.codeMd
366
- }, _utils.browser.mac ? 'Opt' : 'Alt'), ' + ', (0, _react2.jsx)("span", {
367
- css: _styles.codeMd
368
- }, "Shift"), ' + ', (0, _react2.jsx)("span", {
369
- css: _styles.codeSm
370
- }, "\u2190")), (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
371
- css: _styles.codeSm
372
- }, _utils.browser.mac ? '⌘' : 'Ctrl'), ' + ', (0, _react2.jsx)("span", {
373
- css: _styles.codeMd
374
- }, _utils.browser.mac ? 'Opt' : 'Alt'), ' + ', (0, _react2.jsx)("span", {
375
- css: _styles.codeMd
376
- }, "Shift"), ' + ', (0, _react2.jsx)("span", {
377
- css: _styles.codeSm
378
- }, "\u2192")));
379
- }
380
- }, {
381
- name: formatMessage(_messages.helpDialogMessages.selectTableColumn),
382
- type: 'table',
383
- autoFormatting: function autoFormatting() {
384
- return (0, _react2.jsx)("span", {
385
- css: _styles.shortcutsArray
386
- }, (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
387
- css: _styles.codeSm
388
- }, _utils.browser.mac ? '⌘' : 'Ctrl'), ' + ', (0, _react2.jsx)("span", {
389
- css: _styles.codeMd
390
- }, _utils.browser.mac ? 'Opt' : 'Alt'), ' + ', (0, _react2.jsx)("span", {
391
- css: _styles.codeMd
392
- }, "Shift"), ' + ', (0, _react2.jsx)("span", {
393
- css: _styles.codeSm
394
- }, "\u2191")), (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
395
- css: _styles.codeSm
396
- }, _utils.browser.mac ? '⌘' : 'Ctrl'), ' + ', (0, _react2.jsx)("span", {
397
- css: _styles.codeMd
398
- }, _utils.browser.mac ? 'Opt' : 'Alt'), ' + ', (0, _react2.jsx)("span", {
399
- css: _styles.codeMd
400
- }, "Shift"), ' + ', (0, _react2.jsx)("span", {
401
- css: _styles.codeSm
402
- }, "\u2193")));
403
- }
404
- }] : []));
405
- };
406
- var resizeInformationFormatting = function resizeInformationFormatting(_ref4) {
407
- var formatMessage = _ref4.formatMessage;
408
- return [{
409
- name: formatMessage(_messages.helpDialogMessages.increaseSize),
410
- type: 'media',
411
- keymap: function keymap() {
412
- return _keymaps.increaseMediaSize;
413
- }
414
- }, {
415
- name: formatMessage(_messages.helpDialogMessages.decreaseSize),
416
- type: 'media',
417
- keymap: function keymap() {
418
- return _keymaps.decreaseMediaSize;
419
- }
420
- }];
421
- };
422
- var focusTableResizeHandleFormatting = function focusTableResizeHandleFormatting(_ref5) {
423
- var formatMessage = _ref5.formatMessage;
424
- return [{
425
- name: formatMessage(_messages.helpDialogMessages.focusTableResizeHandle),
426
- type: 'navigation',
427
- keymap: function keymap() {
428
- return _keymaps.focusTableResizer;
429
- }
430
- }];
431
- };
432
- var imageAutoFormat = {
433
- name: 'Image',
434
- type: 'image',
435
- autoFormatting: function autoFormatting() {
436
- return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
437
- css: _styles.codeLg
438
- }, "![", (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.helpDialogMessages.altText), "](http://www.image.com)"));
439
- }
440
- };
441
- var quickInsertAutoFormat = function quickInsertAutoFormat(_ref6) {
442
- var formatMessage = _ref6.formatMessage;
443
- return {
444
- name: formatMessage(_messages.helpDialogMessages.quickInsert),
445
- type: 'quickInsert',
446
- autoFormatting: function autoFormatting() {
447
- return (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
448
- css: _styles.codeLg
449
- }, "/"));
450
- }
451
- };
452
- };
453
- var getKeyParts = function getKeyParts(keymap) {
454
- var shortcut = keymap[_utils.browser.mac ? 'mac' : 'windows'];
455
- if (_utils.browser.mac) {
456
- shortcut = shortcut.replace('Alt', 'Opt');
457
- }
458
- return shortcut.replace(/\-(?=.)/g, ' + ').split(' ');
459
- };
460
- var isAnyA11yResizeFeatureFlagEnabled = (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-media-resizing_b5v0o') || (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-table-resizing_uapcv');
461
- var getSupportedFormatting = exports.getSupportedFormatting = function getSupportedFormatting(schema, intl, imageEnabled, quickInsertEnabled) {
462
- var supportedBySchema = formatting(intl).filter(function (format) {
463
- return schema.nodes[format.type] || schema.marks[format.type];
464
- });
465
- 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) : []));
466
- };
467
- var getComponentFromKeymap = exports.getComponentFromKeymap = function getComponentFromKeymap(keymap) {
468
- var keyParts = getKeyParts(keymap);
469
- return (0, _react2.jsx)("span", {
470
- css: _styles.componentFromKeymapWrapperStyles
471
- }, keyParts.map(function (part, index) {
472
- if (part === '+') {
473
- return (0, _react2.jsx)("span", {
474
- key: "".concat(keyParts, "-").concat(index)
475
- }, ' + ');
476
- } else if (part === 'Cmd') {
477
- return (0, _react2.jsx)("span", {
478
- css: _styles.codeSm,
479
- key: "".concat(keyParts, "-").concat(index)
480
- }, "\u2318");
481
- } else if (['ctrl', 'alt', 'opt', 'shift'].indexOf(part.toLowerCase()) >= 0) {
482
- return (0, _react2.jsx)("span", {
483
- css: _styles.codeMd,
484
- key: "".concat(keyParts, "-").concat(index)
485
- }, part);
486
- } else if (['f9', 'f10'].indexOf(part.toLowerCase()) >= 0) {
487
- return (0, _react2.jsx)("span", {
488
- css: _styles.codeLg,
489
- key: "".concat(keyParts, "-").concat(index)
490
- }, part);
491
- } else if (part.toLowerCase() === 'enter') {
492
- return (0, _react2.jsx)("span", {
493
- css: _styles.codeSm,
494
- key: "".concat(keyParts, "-").concat(index)
495
- }, '⏎');
496
- }
497
- return (0, _react2.jsx)("span", {
498
- css: _styles.codeSm,
499
- key: "".concat(keyParts, "-").concat(index)
500
- }, part.toUpperCase());
501
- }));
502
- };
503
- var ModalHeader = (0, _reactIntlNext.injectIntl)(function (_ref7) {
504
- var formatMessage = _ref7.intl.formatMessage;
505
- var _useModal = (0, _modalDialog.useModal)(),
506
- onClose = _useModal.onClose;
507
- return (0, _react2.jsx)("div", {
508
- css: _styles.header
509
- }, (0, _react2.jsx)("h1", {
510
- css: _styles.dialogHeader
511
- }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.helpDialogMessages.editorHelp)), (0, _react2.jsx)("div", null, (0, _react2.jsx)(_uiMenu.ToolbarButton
512
- // @ts-ignore
513
- , {
514
- onClick: onClose,
515
- title: formatMessage(_messages.helpDialogMessages.closeHelpDialog),
516
- spacing: "compact",
517
- iconBefore: (0, _react2.jsx)(_cross.default, {
518
- label: formatMessage(_messages.helpDialogMessages.closeHelpDialog),
519
- size: "medium"
520
- })
521
- })));
522
- });
523
- var ModalFooter = function ModalFooter() {
524
- return (0, _react2.jsx)("div", {
525
- css: _styles.footer
526
- }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, (0, _extends2.default)({}, _messages.helpDialogMessages.helpDialogTips, {
527
- values: {
528
- keyMap: getComponentFromKeymap(_keymaps.openHelp)
529
- }
530
- })));
531
- };
532
- var HelpDialog = function HelpDialog(_ref8) {
533
- var pluginInjectionApi = _ref8.pluginInjectionApi,
534
- editorView = _ref8.editorView,
535
- quickInsertEnabled = _ref8.quickInsertEnabled,
536
- intl = _ref8.intl;
21
+ var HelpDialog = function HelpDialog(_ref) {
22
+ var pluginInjectionApi = _ref.pluginInjectionApi,
23
+ editorView = _ref.editorView,
24
+ quickInsertEnabled = _ref.quickInsertEnabled,
25
+ intl = _ref.intl;
537
26
  var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['helpDialog']),
538
27
  helpDialogState = _useSharedPluginState.helpDialogState;
539
28
  var closeDialog = (0, _react.useCallback)(function () {
@@ -552,51 +41,13 @@ var HelpDialog = function HelpDialog(_ref8) {
552
41
  document.removeEventListener('keydown', handleEsc);
553
42
  };
554
43
  }, [handleEsc]);
555
- var formatting = getSupportedFormatting(editorView.state.schema, intl, helpDialogState === null || helpDialogState === void 0 ? void 0 : helpDialogState.imageEnabled, quickInsertEnabled);
44
+ var formatting = (0, _formatting.getSupportedFormatting)(editorView.state.schema, intl, helpDialogState === null || helpDialogState === void 0 ? void 0 : helpDialogState.imageEnabled, quickInsertEnabled);
556
45
  return (0, _react2.jsx)(_modalDialog.ModalTransition, null, helpDialogState !== null && helpDialogState !== void 0 && helpDialogState.isVisible ? (0, _react2.jsx)(_modalDialog.default, {
557
46
  width: "large",
558
47
  onClose: closeDialog,
559
48
  testId: "help-modal-dialog"
560
- }, (0, _react2.jsx)(ModalHeader, null), (0, _react2.jsx)("div", {
561
- css: _styles.contentWrapper
562
- }, (0, _react2.jsx)("div", {
563
- css: _styles.line
564
- }), (0, _react2.jsx)("div", {
565
- css: _styles.content
566
- }, (0, _react2.jsx)("div", {
567
- css: _styles.column
568
- }, (0, _react2.jsx)("h2", {
569
- css: _styles.title
570
- }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.helpDialogMessages.keyboardShortcuts)), (0, _react2.jsx)("ul", null, formatting.filter(function (form) {
571
- var keymap = form.keymap && form.keymap();
572
- return keymap && keymap[_utils.browser.mac ? 'mac' : 'windows'];
573
- }).map(function (form) {
574
- return (0, _react2.jsx)("li", {
575
- css: _styles.row,
576
- key: "textFormatting-".concat(form.name)
577
- }, (0, _react2.jsx)("span", null, form.name), getComponentFromKeymap(form.keymap()));
578
- }), formatting.filter(function (form) {
579
- return shortcutNamesWithoutKeymap.indexOf(form.type) !== -1;
580
- }).filter(function (form) {
581
- return form.autoFormatting;
582
- }).map(function (form) {
583
- return (0, _react2.jsx)("li", {
584
- css: _styles.row,
585
- key: "autoFormatting-".concat(form.name)
586
- }, (0, _react2.jsx)("span", null, form.name), form.autoFormatting());
587
- }))), (0, _react2.jsx)("div", {
588
- css: _styles.line
589
- }), (0, _react2.jsx)("div", {
590
- css: _styles.column
591
- }, (0, _react2.jsx)("h2", {
592
- css: _styles.title
593
- }, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.helpDialogMessages.markdown)), (0, _react2.jsx)("ul", null, formatting.filter(function (form) {
594
- return shortcutNamesWithoutKeymap.indexOf(form.type) === -1;
595
- }).map(function (form) {
596
- return form.autoFormatting && (0, _react2.jsx)("li", {
597
- key: "autoFormatting-".concat(form.name),
598
- css: _styles.row
599
- }, (0, _react2.jsx)("span", null, form.name), form.autoFormatting());
600
- }))))), (0, _react2.jsx)(ModalFooter, null)) : null);
49
+ }, (0, _react2.jsx)(_Modal.default, {
50
+ formatting: formatting
51
+ })) : null);
601
52
  };
602
53
  var _default = exports.default = (0, _reactIntlNext.injectIntl)(HelpDialog);
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.shortcutNamesWithoutKeymap = exports.getComponentFromKeymap = void 0;
7
+ var _react = require("@emotion/react");
8
+ var _utils = require("@atlaskit/editor-common/utils");
9
+ var _styles = require("./styles");
10
+ /** @jsx jsx */
11
+
12
+ var getKeyParts = function getKeyParts(keymap) {
13
+ var shortcut = keymap[_utils.browser.mac ? 'mac' : 'windows'];
14
+ if (_utils.browser.mac) {
15
+ shortcut = shortcut.replace('Alt', 'Opt');
16
+ }
17
+ return shortcut.replace(/\-(?=.)/g, ' + ').split(' ');
18
+ };
19
+ var shortcutNamesWithoutKeymap = exports.shortcutNamesWithoutKeymap = ['emoji', 'mention', 'quickInsert'];
20
+ var getComponentFromKeymap = exports.getComponentFromKeymap = function getComponentFromKeymap(keymap) {
21
+ var keyParts = getKeyParts(keymap);
22
+ return (0, _react.jsx)("span", {
23
+ css: _styles.componentFromKeymapWrapperStyles
24
+ }, keyParts.map(function (part, index) {
25
+ if (part === '+') {
26
+ return (0, _react.jsx)("span", {
27
+ key: "".concat(keyParts, "-").concat(index)
28
+ }, ' + ');
29
+ } else if (part === 'Cmd') {
30
+ return (0, _react.jsx)("span", {
31
+ css: _styles.codeSm,
32
+ key: "".concat(keyParts, "-").concat(index)
33
+ }, "\u2318");
34
+ } else if (['ctrl', 'alt', 'opt', 'shift'].indexOf(part.toLowerCase()) >= 0) {
35
+ return (0, _react.jsx)("span", {
36
+ css: _styles.codeMd,
37
+ key: "".concat(keyParts, "-").concat(index)
38
+ }, part);
39
+ } else if (['f9', 'f10'].indexOf(part.toLowerCase()) >= 0) {
40
+ return (0, _react.jsx)("span", {
41
+ css: _styles.codeLg,
42
+ key: "".concat(keyParts, "-").concat(index)
43
+ }, part);
44
+ } else if (part.toLowerCase() === 'enter') {
45
+ return (0, _react.jsx)("span", {
46
+ css: _styles.codeSm,
47
+ key: "".concat(keyParts, "-").concat(index)
48
+ }, '⏎');
49
+ }
50
+ return (0, _react.jsx)("span", {
51
+ css: _styles.codeSm,
52
+ key: "".concat(keyParts, "-").concat(index)
53
+ }, part.toUpperCase());
54
+ }));
55
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ /** @jsx jsx */
2
+ import { jsx } from '@emotion/react';
3
+ import { useModal } from '@atlaskit/modal-dialog';
4
+ import { ModalContent } from './ModalContent';
5
+ const Modal = ({
6
+ formatting
7
+ }) => {
8
+ const {
9
+ onClose
10
+ } = useModal();
11
+ return jsx(ModalContent, {
12
+ formatting: formatting,
13
+ onClose: onClose
14
+ });
15
+ };
16
+ export default Modal;