@atlaskit/editor-plugin-help-dialog 1.1.0 → 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 (44) hide show
  1. package/CHANGELOG.md +12 -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/HelpDialogLoader.d.ts +1 -1
  28. package/dist/types/ui/Modal.d.ts +8 -0
  29. package/dist/types/ui/ModalContent.d.ts +9 -0
  30. package/dist/types/ui/ModalFooter.d.ts +4 -0
  31. package/dist/types/ui/ModalHeader.d.ts +10 -0
  32. package/dist/types/ui/formatting.d.ts +5 -0
  33. package/dist/types/ui/index.d.ts +3 -16
  34. package/dist/types/ui/utils.d.ts +5 -0
  35. package/dist/types-ts4.5/ui/Format.d.ts +8 -0
  36. package/dist/types-ts4.5/ui/HelpDialogLoader.d.ts +1 -1
  37. package/dist/types-ts4.5/ui/Modal.d.ts +8 -0
  38. package/dist/types-ts4.5/ui/ModalContent.d.ts +9 -0
  39. package/dist/types-ts4.5/ui/ModalFooter.d.ts +4 -0
  40. package/dist/types-ts4.5/ui/ModalHeader.d.ts +10 -0
  41. package/dist/types-ts4.5/ui/formatting.d.ts +5 -0
  42. package/dist/types-ts4.5/ui/index.d.ts +3 -16
  43. package/dist/types-ts4.5/ui/utils.d.ts +5 -0
  44. package/package.json +11 -13
@@ -0,0 +1,484 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ /** @jsx jsx */
3
+ import { jsx } from '@emotion/react';
4
+ import { FormattedMessage } from 'react-intl-next';
5
+ import { addInlineComment, addLink, alignCenter, alignLeft, alignRight, clearFormatting, decreaseMediaSize, focusTableResizer, increaseMediaSize, insertRule, navToEditorToolbar, navToFloatingToolbar, 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';
6
+ import { alignmentMessages, annotationMessages, blockTypeMessages, listMessages, helpDialogMessages as messages, toolbarInsertBlockMessages, toolbarMessages, undoRedoMessages } from '@atlaskit/editor-common/messages';
7
+ import { browser } from '@atlaskit/editor-common/utils';
8
+ import { getBooleanFF } from '@atlaskit/platform-feature-flags';
9
+ import { codeLg, codeMd, codeSm, shortcutsArray } from './styles';
10
+ var navigationKeymaps = function navigationKeymaps(_ref) {
11
+ var formatMessage = _ref.formatMessage;
12
+ return [{
13
+ name: formatMessage(toolbarMessages.navigateToEditorToolbar),
14
+ type: 'navigation',
15
+ keymap: function keymap() {
16
+ return navToEditorToolbar;
17
+ }
18
+ }, {
19
+ name: formatMessage(toolbarMessages.navigateToFloatingToolbar),
20
+ type: 'navigation',
21
+ keymap: function keymap() {
22
+ return navToFloatingToolbar;
23
+ }
24
+ }];
25
+ };
26
+ export var formatting = function formatting(_ref2) {
27
+ var formatMessage = _ref2.formatMessage;
28
+ return [{
29
+ name: formatMessage(toolbarMessages.bold),
30
+ type: 'strong',
31
+ keymap: function keymap() {
32
+ return toggleBold;
33
+ },
34
+ autoFormatting: function autoFormatting() {
35
+ return jsx("span", null, jsx("span", {
36
+ css: codeLg
37
+ }, "**", jsx(FormattedMessage, toolbarMessages.bold), "**"));
38
+ }
39
+ }, {
40
+ name: formatMessage(toolbarMessages.italic),
41
+ type: 'em',
42
+ keymap: function keymap() {
43
+ return toggleItalic;
44
+ },
45
+ autoFormatting: function autoFormatting() {
46
+ return jsx("span", null, jsx("span", {
47
+ css: codeLg
48
+ }, "*", jsx(FormattedMessage, toolbarMessages.italic), "*"));
49
+ }
50
+ }, {
51
+ name: formatMessage(toolbarMessages.underline),
52
+ type: 'underline',
53
+ keymap: function keymap() {
54
+ return toggleUnderline;
55
+ }
56
+ }, {
57
+ name: formatMessage(toolbarMessages.strike),
58
+ type: 'strike',
59
+ keymap: function keymap() {
60
+ return toggleStrikethrough;
61
+ },
62
+ autoFormatting: function autoFormatting() {
63
+ return jsx("span", null, jsx("span", {
64
+ css: codeLg
65
+ }, "~~", jsx(FormattedMessage, toolbarMessages.strike), "~~"));
66
+ }
67
+ }, {
68
+ name: formatMessage(toolbarMessages.subscript),
69
+ type: 'subsup',
70
+ keymap: function keymap() {
71
+ return toggleSubscript;
72
+ }
73
+ }, {
74
+ name: formatMessage(toolbarMessages.superscript),
75
+ type: 'subsup',
76
+ keymap: function keymap() {
77
+ return toggleSuperscript;
78
+ }
79
+ }, {
80
+ name: formatMessage(blockTypeMessages.heading1),
81
+ type: 'heading',
82
+ keymap: function keymap() {
83
+ return toggleHeading1;
84
+ },
85
+ autoFormatting: function autoFormatting() {
86
+ return jsx("span", null, jsx("span", {
87
+ css: codeSm
88
+ }, "#"), " ", jsx("span", {
89
+ css: codeLg
90
+ }, "Space"));
91
+ }
92
+ }, {
93
+ name: formatMessage(blockTypeMessages.heading2),
94
+ type: 'heading',
95
+ keymap: function keymap() {
96
+ return toggleHeading2;
97
+ },
98
+ autoFormatting: function autoFormatting() {
99
+ return jsx("span", null, jsx("span", {
100
+ css: codeLg
101
+ }, "##"), " ", jsx("span", {
102
+ css: codeLg
103
+ }, "Space"));
104
+ }
105
+ }, {
106
+ name: formatMessage(blockTypeMessages.heading3),
107
+ type: 'heading',
108
+ keymap: function keymap() {
109
+ return toggleHeading3;
110
+ },
111
+ autoFormatting: function autoFormatting() {
112
+ return jsx("span", null, jsx("span", {
113
+ css: codeLg
114
+ }, "###"), " ", jsx("span", {
115
+ css: codeLg
116
+ }, "Space"));
117
+ }
118
+ }, {
119
+ name: formatMessage(blockTypeMessages.heading4),
120
+ type: 'heading',
121
+ keymap: function keymap() {
122
+ return toggleHeading4;
123
+ },
124
+ autoFormatting: function autoFormatting() {
125
+ return jsx("span", null, jsx("span", {
126
+ css: codeLg
127
+ }, "####"), " ", jsx("span", {
128
+ css: codeLg
129
+ }, "Space"));
130
+ }
131
+ }, {
132
+ name: formatMessage(blockTypeMessages.heading5),
133
+ type: 'heading',
134
+ keymap: function keymap() {
135
+ return toggleHeading5;
136
+ },
137
+ autoFormatting: function autoFormatting() {
138
+ return jsx("span", null, jsx("span", {
139
+ css: codeLg
140
+ }, "#####"), " ", jsx("span", {
141
+ css: codeLg
142
+ }, "Space"));
143
+ }
144
+ }, {
145
+ name: formatMessage(blockTypeMessages.heading6),
146
+ type: 'heading',
147
+ keymap: function keymap() {
148
+ return toggleHeading6;
149
+ },
150
+ autoFormatting: function autoFormatting() {
151
+ return jsx("span", null, jsx("span", {
152
+ css: codeLg
153
+ }, "######"), " ", jsx("span", {
154
+ css: codeLg
155
+ }, "Space"));
156
+ }
157
+ }, {
158
+ name: formatMessage(blockTypeMessages.normal),
159
+ type: 'paragraph',
160
+ keymap: function keymap() {
161
+ return setNormalText;
162
+ }
163
+ }, {
164
+ name: formatMessage(listMessages.orderedList),
165
+ type: 'orderedList',
166
+ keymap: function keymap() {
167
+ return toggleOrderedList;
168
+ },
169
+ autoFormatting: function autoFormatting() {
170
+ return jsx("span", null, jsx("span", {
171
+ css: codeSm
172
+ }, "1."), " ", jsx("span", {
173
+ css: codeLg
174
+ }, "Space"));
175
+ }
176
+ }, {
177
+ name: formatMessage(listMessages.unorderedList),
178
+ type: 'bulletList',
179
+ keymap: function keymap() {
180
+ return toggleBulletList;
181
+ },
182
+ autoFormatting: function autoFormatting() {
183
+ return jsx("span", null, jsx("span", {
184
+ css: codeSm
185
+ }, "*"), " ", jsx("span", {
186
+ css: codeLg
187
+ }, "Space"));
188
+ }
189
+ }, {
190
+ name: formatMessage(blockTypeMessages.blockquote),
191
+ type: 'blockquote',
192
+ keymap: function keymap() {
193
+ return toggleBlockQuote;
194
+ },
195
+ autoFormatting: function autoFormatting() {
196
+ return jsx("span", null, jsx("span", {
197
+ css: codeLg
198
+ }, '>'), " ", jsx("span", {
199
+ css: codeLg
200
+ }, "Space"));
201
+ }
202
+ }, {
203
+ name: formatMessage(blockTypeMessages.codeblock),
204
+ type: 'codeBlock',
205
+ autoFormatting: function autoFormatting() {
206
+ return jsx("span", null, jsx("span", {
207
+ css: codeLg
208
+ }, "```"));
209
+ }
210
+ }, {
211
+ name: formatMessage(toolbarInsertBlockMessages.horizontalRule),
212
+ type: 'rule',
213
+ keymap: function keymap() {
214
+ return insertRule;
215
+ },
216
+ autoFormatting: function autoFormatting() {
217
+ return jsx("span", null, jsx("span", {
218
+ css: codeLg
219
+ }, "---"));
220
+ }
221
+ }, {
222
+ name: formatMessage(toolbarInsertBlockMessages.link),
223
+ type: 'link',
224
+ keymap: function keymap() {
225
+ return addLink;
226
+ },
227
+ autoFormatting: function autoFormatting() {
228
+ return jsx("span", null, jsx("span", {
229
+ css: codeLg
230
+ }, "[", jsx(FormattedMessage, toolbarInsertBlockMessages.link), "](http://a.com)"));
231
+ }
232
+ }, {
233
+ name: formatMessage(toolbarMessages.code),
234
+ type: 'code',
235
+ keymap: function keymap() {
236
+ return toggleCode;
237
+ },
238
+ autoFormatting: function autoFormatting() {
239
+ return jsx("span", null, jsx("span", {
240
+ css: codeLg
241
+ }, "`", jsx(FormattedMessage, toolbarMessages.code), "`"));
242
+ }
243
+ }, {
244
+ name: formatMessage(toolbarInsertBlockMessages.action),
245
+ type: 'taskItem',
246
+ autoFormatting: function autoFormatting() {
247
+ return jsx("span", null, jsx("span", {
248
+ css: codeSm
249
+ }, "[]"), " ", jsx("span", {
250
+ css: codeLg
251
+ }, "Space"));
252
+ }
253
+ }, {
254
+ name: formatMessage(toolbarInsertBlockMessages.decision),
255
+ type: 'decisionItem',
256
+ autoFormatting: function autoFormatting() {
257
+ return jsx("span", null, jsx("span", {
258
+ css: codeSm
259
+ }, "<>"), " ", jsx("span", {
260
+ css: codeLg
261
+ }, "Space"));
262
+ }
263
+ }, {
264
+ name: formatMessage(toolbarInsertBlockMessages.emoji),
265
+ type: 'emoji',
266
+ autoFormatting: function autoFormatting() {
267
+ return jsx("span", null, jsx("span", {
268
+ css: codeLg
269
+ }, ":"));
270
+ }
271
+ }, {
272
+ name: formatMessage(toolbarInsertBlockMessages.mention),
273
+ type: 'mention',
274
+ autoFormatting: function autoFormatting() {
275
+ return jsx("span", null, jsx("span", {
276
+ css: codeLg
277
+ }, "@"));
278
+ }
279
+ }, {
280
+ name: formatMessage(alignmentMessages.alignLeft),
281
+ type: 'alignment',
282
+ keymap: function keymap() {
283
+ return alignLeft;
284
+ }
285
+ }].concat(_toConsumableArray(getBooleanFF('platform.editor.text-alignment-keyboard-shortcuts') ? [{
286
+ name: formatMessage(alignmentMessages.alignCenter),
287
+ type: 'alignment',
288
+ keymap: function keymap() {
289
+ return alignCenter;
290
+ }
291
+ }, {
292
+ name: formatMessage(alignmentMessages.alignRight),
293
+ type: 'alignment',
294
+ keymap: function keymap() {
295
+ return alignRight;
296
+ }
297
+ }] : []));
298
+ };
299
+ var otherFormatting = function otherFormatting(_ref3) {
300
+ var formatMessage = _ref3.formatMessage;
301
+ return [{
302
+ name: formatMessage(toolbarMessages.clearFormatting),
303
+ type: 'clearFormatting',
304
+ keymap: function keymap() {
305
+ return clearFormatting;
306
+ }
307
+ }, {
308
+ name: formatMessage(undoRedoMessages.undo),
309
+ type: 'undo',
310
+ keymap: function keymap() {
311
+ return undo;
312
+ }
313
+ }, {
314
+ name: formatMessage(undoRedoMessages.redo),
315
+ type: 'redo',
316
+ keymap: function keymap() {
317
+ return redo;
318
+ }
319
+ }, {
320
+ name: formatMessage(messages.pastePlainText),
321
+ type: 'paste',
322
+ keymap: function keymap() {
323
+ return pastePlainText;
324
+ }
325
+ }, {
326
+ name: formatMessage(annotationMessages.createComment),
327
+ type: 'annotation',
328
+ keymap: function keymap() {
329
+ return addInlineComment;
330
+ }
331
+ }, {
332
+ name: formatMessage(messages.CheckUncheckActionItem),
333
+ type: 'checkbox',
334
+ keymap: function keymap() {
335
+ return toggleTaskItemCheckbox;
336
+ }
337
+ }, {
338
+ name: formatMessage(messages.selectTableRow),
339
+ type: 'table',
340
+ autoFormatting: function autoFormatting() {
341
+ return jsx("span", {
342
+ css: shortcutsArray
343
+ }, jsx("span", null, jsx("span", {
344
+ css: browser.mac ? codeSm : codeMd
345
+ }, browser.mac ? '⌘' : 'Ctrl'), ' + ', jsx("span", {
346
+ css: codeMd
347
+ }, browser.mac ? 'Opt' : 'Alt'), ' + ', jsx("span", {
348
+ css: codeMd
349
+ }, "Shift"), ' + ', jsx("span", {
350
+ css: codeSm
351
+ }, "\u2190")), jsx("span", null, jsx("span", {
352
+ css: browser.mac ? codeSm : codeMd
353
+ }, browser.mac ? '⌘' : 'Ctrl'), ' + ', jsx("span", {
354
+ css: codeMd
355
+ }, browser.mac ? 'Opt' : 'Alt'), ' + ', jsx("span", {
356
+ css: codeMd
357
+ }, "Shift"), ' + ', jsx("span", {
358
+ css: codeSm
359
+ }, "\u2192")));
360
+ }
361
+ }, {
362
+ name: formatMessage(messages.selectTableColumn),
363
+ type: 'table',
364
+ autoFormatting: function autoFormatting() {
365
+ return jsx("span", {
366
+ css: shortcutsArray
367
+ }, jsx("span", null, jsx("span", {
368
+ css: browser.mac ? codeSm : codeMd
369
+ }, browser.mac ? '⌘' : 'Ctrl'), ' + ', jsx("span", {
370
+ css: codeMd
371
+ }, browser.mac ? 'Opt' : 'Alt'), ' + ', jsx("span", {
372
+ css: codeMd
373
+ }, "Shift"), ' + ', jsx("span", {
374
+ css: codeSm
375
+ }, "\u2191")), jsx("span", null, jsx("span", {
376
+ css: browser.mac ? codeSm : codeMd
377
+ }, browser.mac ? '⌘' : 'Ctrl'), ' + ', jsx("span", {
378
+ css: codeMd
379
+ }, browser.mac ? 'Opt' : 'Alt'), ' + ', jsx("span", {
380
+ css: codeMd
381
+ }, "Shift"), ' + ', jsx("span", {
382
+ css: codeSm
383
+ }, "\u2193")));
384
+ }
385
+ }].concat(_toConsumableArray(getBooleanFF('platform.editor.a11y-column-resizing_emcvz') ? [{
386
+ name: formatMessage(messages.selectColumnResize),
387
+ type: 'table',
388
+ autoFormatting: function autoFormatting() {
389
+ return jsx("span", {
390
+ css: shortcutsArray
391
+ }, jsx("span", null, jsx("span", {
392
+ css: browser.mac ? codeSm : codeMd
393
+ }, browser.mac ? '⌘' : 'Ctrl'), ' + ', jsx("span", {
394
+ css: codeMd
395
+ }, browser.mac ? 'Opt' : 'Alt'), ' + ', jsx("span", {
396
+ css: codeMd
397
+ }, "Shift"), ' + ', jsx("span", {
398
+ css: codeSm
399
+ }, "C")));
400
+ }
401
+ }, {
402
+ name: formatMessage(messages.increaseColumnSize),
403
+ type: 'table',
404
+ autoFormatting: function autoFormatting() {
405
+ return jsx("span", {
406
+ css: shortcutsArray
407
+ }, jsx("span", null, jsx("span", {
408
+ css: browser.mac ? codeSm : codeMd
409
+ }, browser.mac ? '⌘' : 'Ctrl'), ' + ', jsx("span", {
410
+ css: codeMd
411
+ }, browser.mac ? 'Opt' : 'Alt'), ' + ', jsx("span", {
412
+ css: codeMd
413
+ }, "[")));
414
+ }
415
+ }, {
416
+ name: formatMessage(messages.decreaseColumnSize),
417
+ type: 'table',
418
+ autoFormatting: function autoFormatting() {
419
+ return jsx("span", {
420
+ css: shortcutsArray
421
+ }, jsx("span", null, jsx("span", {
422
+ css: browser.mac ? codeSm : codeMd
423
+ }, browser.mac ? '⌘' : 'Ctrl'), ' + ', jsx("span", {
424
+ css: codeMd
425
+ }, browser.mac ? 'Opt' : 'Alt'), ' + ', jsx("span", {
426
+ css: codeMd
427
+ }, "]")));
428
+ }
429
+ }] : []));
430
+ };
431
+ var resizeInformationFormatting = function resizeInformationFormatting(_ref4) {
432
+ var formatMessage = _ref4.formatMessage;
433
+ return [{
434
+ name: formatMessage(messages.increaseSize),
435
+ type: 'media',
436
+ keymap: function keymap() {
437
+ return increaseMediaSize;
438
+ }
439
+ }, {
440
+ name: formatMessage(messages.decreaseSize),
441
+ type: 'media',
442
+ keymap: function keymap() {
443
+ return decreaseMediaSize;
444
+ }
445
+ }];
446
+ };
447
+ var focusTableResizeHandleFormatting = function focusTableResizeHandleFormatting(_ref5) {
448
+ var formatMessage = _ref5.formatMessage;
449
+ return [{
450
+ name: formatMessage(messages.focusTableResizeHandle),
451
+ type: 'navigation',
452
+ keymap: function keymap() {
453
+ return focusTableResizer;
454
+ }
455
+ }];
456
+ };
457
+ var imageAutoFormat = {
458
+ name: 'Image',
459
+ type: 'image',
460
+ autoFormatting: function autoFormatting() {
461
+ return jsx("span", null, jsx("span", {
462
+ css: codeLg
463
+ }, "![", jsx(FormattedMessage, messages.altText), "](http://www.image.com)"));
464
+ }
465
+ };
466
+ var quickInsertAutoFormat = function quickInsertAutoFormat(_ref6) {
467
+ var formatMessage = _ref6.formatMessage;
468
+ return {
469
+ name: formatMessage(messages.quickInsert),
470
+ type: 'quickInsert',
471
+ autoFormatting: function autoFormatting() {
472
+ return jsx("span", null, jsx("span", {
473
+ css: codeLg
474
+ }, "/"));
475
+ }
476
+ };
477
+ };
478
+ var isAnyA11yResizeFeatureFlagEnabled = getBooleanFF('platform.editor.a11y-media-resizing_b5v0o') || getBooleanFF('platform.editor.a11y-table-resizing_uapcv');
479
+ export var getSupportedFormatting = function getSupportedFormatting(schema, intl, imageEnabled, quickInsertEnabled) {
480
+ var supportedBySchema = formatting(intl).filter(function (format) {
481
+ return schema.nodes[format.type] || schema.marks[format.type];
482
+ });
483
+ 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) : []));
484
+ };