@atlaskit/editor-core 188.0.12 → 188.2.0

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 (128) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/cjs/labs/next/presets/universal.js +2 -1
  3. package/dist/cjs/plugins/annotation/toolbar.js +5 -23
  4. package/dist/cjs/plugins/code-block/index.js +3 -3
  5. package/dist/cjs/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +2 -2
  6. package/dist/cjs/plugins/index.js +0 -7
  7. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +4 -4
  8. package/dist/cjs/plugins/media/index.js +12 -6
  9. package/dist/cjs/plugins/media/utils/media-common.js +7 -109
  10. package/dist/cjs/plugins/media/utils/media-single.js +7 -68
  11. package/dist/cjs/plugins/panel/index.js +13 -13
  12. package/dist/cjs/plugins/paste/handlers.js +4 -4
  13. package/dist/cjs/plugins/paste/plugins/media.js +181 -0
  14. package/dist/cjs/plugins/paste/pm-plugins/analytics.js +2 -2
  15. package/dist/cjs/plugins/paste/pm-plugins/main.js +6 -7
  16. package/dist/cjs/plugins/undo-redo/ui/ToolbarUndoRedo/index.js +3 -3
  17. package/dist/cjs/ui/Alignment/index.js +1 -1
  18. package/dist/cjs/ui/WithHelpTrigger/index.js +3 -7
  19. package/dist/cjs/version-wrapper.js +1 -1
  20. package/dist/es2019/labs/next/presets/universal.js +2 -1
  21. package/dist/es2019/plugins/annotation/toolbar.js +2 -18
  22. package/dist/es2019/plugins/code-block/index.js +3 -3
  23. package/dist/es2019/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +1 -1
  24. package/dist/es2019/plugins/index.js +0 -1
  25. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +1 -1
  26. package/dist/es2019/plugins/media/index.js +13 -6
  27. package/dist/es2019/plugins/media/utils/media-common.js +2 -107
  28. package/dist/es2019/plugins/media/utils/media-single.js +6 -72
  29. package/dist/es2019/plugins/panel/index.js +13 -13
  30. package/dist/es2019/plugins/paste/handlers.js +4 -4
  31. package/dist/es2019/plugins/paste/plugins/media.js +176 -0
  32. package/dist/es2019/plugins/paste/pm-plugins/analytics.js +2 -2
  33. package/dist/es2019/plugins/paste/pm-plugins/main.js +3 -4
  34. package/dist/es2019/plugins/undo-redo/ui/ToolbarUndoRedo/index.js +3 -3
  35. package/dist/es2019/ui/Alignment/index.js +1 -1
  36. package/dist/es2019/ui/WithHelpTrigger/index.js +2 -7
  37. package/dist/es2019/version-wrapper.js +1 -1
  38. package/dist/esm/labs/next/presets/universal.js +2 -1
  39. package/dist/esm/plugins/annotation/toolbar.js +2 -18
  40. package/dist/esm/plugins/code-block/index.js +3 -3
  41. package/dist/esm/plugins/code-block/pm-plugins/codeBlockCopySelectionPlugin.js +1 -1
  42. package/dist/esm/plugins/index.js +0 -1
  43. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +1 -1
  44. package/dist/esm/plugins/media/index.js +13 -6
  45. package/dist/esm/plugins/media/utils/media-common.js +2 -106
  46. package/dist/esm/plugins/media/utils/media-single.js +6 -66
  47. package/dist/esm/plugins/panel/index.js +13 -13
  48. package/dist/esm/plugins/paste/handlers.js +4 -4
  49. package/dist/esm/plugins/paste/plugins/media.js +172 -0
  50. package/dist/esm/plugins/paste/pm-plugins/analytics.js +2 -2
  51. package/dist/esm/plugins/paste/pm-plugins/main.js +3 -4
  52. package/dist/esm/plugins/undo-redo/ui/ToolbarUndoRedo/index.js +3 -3
  53. package/dist/esm/ui/Alignment/index.js +1 -1
  54. package/dist/esm/ui/WithHelpTrigger/index.js +2 -7
  55. package/dist/esm/version-wrapper.js +1 -1
  56. package/dist/types/labs/next/presets/default.d.ts +6 -0
  57. package/dist/types/plugins/annotation/toolbar.d.ts +0 -17
  58. package/dist/types/plugins/index.d.ts +0 -1
  59. package/dist/types/plugins/media/next-plugin-type.d.ts +4 -0
  60. package/dist/types/plugins/media/utils/media-common.d.ts +2 -10
  61. package/dist/types/plugins/media/utils/media-single.d.ts +2 -4
  62. package/dist/types/plugins/paste/handlers.d.ts +2 -2
  63. package/dist/types/plugins/paste/index.d.ts +5 -2
  64. package/dist/types/plugins/paste/plugins/media.d.ts +12 -0
  65. package/dist/types/plugins/paste/pm-plugins/analytics.d.ts +2 -2
  66. package/dist/types/plugins/paste/pm-plugins/main.d.ts +2 -2
  67. package/dist/types/ui/Alignment/index.d.ts +2 -2
  68. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
  69. package/dist/types/ui/ContentStyles/index.d.ts +2 -2
  70. package/dist/types/ui/WithHelpTrigger/index.d.ts +0 -4
  71. package/dist/types-ts4.5/labs/next/presets/default.d.ts +6 -0
  72. package/dist/types-ts4.5/plugins/annotation/toolbar.d.ts +0 -17
  73. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  74. package/dist/types-ts4.5/plugins/media/next-plugin-type.d.ts +4 -0
  75. package/dist/types-ts4.5/plugins/media/utils/media-common.d.ts +2 -10
  76. package/dist/types-ts4.5/plugins/media/utils/media-single.d.ts +2 -4
  77. package/dist/types-ts4.5/plugins/paste/handlers.d.ts +2 -2
  78. package/dist/types-ts4.5/plugins/paste/index.d.ts +5 -2
  79. package/dist/types-ts4.5/plugins/paste/plugins/media.d.ts +12 -0
  80. package/dist/types-ts4.5/plugins/paste/pm-plugins/analytics.d.ts +2 -2
  81. package/dist/types-ts4.5/plugins/paste/pm-plugins/main.d.ts +2 -2
  82. package/dist/types-ts4.5/ui/Alignment/index.d.ts +2 -2
  83. package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
  84. package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
  85. package/dist/types-ts4.5/ui/WithHelpTrigger/index.d.ts +0 -4
  86. package/package.json +8 -7
  87. package/report.api.md +1 -1
  88. package/tmp/api-report-tmp.d.ts +1 -1
  89. package/dist/cjs/plugins/help-dialog/commands.js +0 -19
  90. package/dist/cjs/plugins/help-dialog/index.js +0 -138
  91. package/dist/cjs/plugins/help-dialog/plugin-key.js +0 -8
  92. package/dist/cjs/plugins/help-dialog/ui/HelpDialogLoader.js +0 -24
  93. package/dist/cjs/plugins/help-dialog/ui/index.js +0 -568
  94. package/dist/cjs/plugins/help-dialog/ui/styles.js +0 -50
  95. package/dist/cjs/plugins/undo-redo/messages.js +0 -19
  96. package/dist/cjs/ui/Alignment/messages.js +0 -24
  97. package/dist/es2019/plugins/help-dialog/commands.js +0 -13
  98. package/dist/es2019/plugins/help-dialog/index.js +0 -125
  99. package/dist/es2019/plugins/help-dialog/plugin-key.js +0 -2
  100. package/dist/es2019/plugins/help-dialog/ui/HelpDialogLoader.js +0 -6
  101. package/dist/es2019/plugins/help-dialog/ui/index.js +0 -446
  102. package/dist/es2019/plugins/help-dialog/ui/styles.js +0 -110
  103. package/dist/es2019/plugins/undo-redo/messages.js +0 -13
  104. package/dist/es2019/ui/Alignment/messages.js +0 -18
  105. package/dist/esm/plugins/help-dialog/commands.js +0 -13
  106. package/dist/esm/plugins/help-dialog/index.js +0 -130
  107. package/dist/esm/plugins/help-dialog/plugin-key.js +0 -2
  108. package/dist/esm/plugins/help-dialog/ui/HelpDialogLoader.js +0 -12
  109. package/dist/esm/plugins/help-dialog/ui/index.js +0 -557
  110. package/dist/esm/plugins/help-dialog/ui/styles.js +0 -40
  111. package/dist/esm/plugins/undo-redo/messages.js +0 -13
  112. package/dist/esm/ui/Alignment/messages.js +0 -18
  113. package/dist/types/plugins/help-dialog/commands.d.ts +0 -3
  114. package/dist/types/plugins/help-dialog/index.d.ts +0 -18
  115. package/dist/types/plugins/help-dialog/plugin-key.d.ts +0 -2
  116. package/dist/types/plugins/help-dialog/ui/HelpDialogLoader.d.ts +0 -4
  117. package/dist/types/plugins/help-dialog/ui/index.d.ts +0 -27
  118. package/dist/types/plugins/help-dialog/ui/styles.d.ts +0 -33
  119. package/dist/types/plugins/undo-redo/messages.d.ts +0 -12
  120. package/dist/types/ui/Alignment/messages.d.ts +0 -17
  121. package/dist/types-ts4.5/plugins/help-dialog/commands.d.ts +0 -3
  122. package/dist/types-ts4.5/plugins/help-dialog/index.d.ts +0 -18
  123. package/dist/types-ts4.5/plugins/help-dialog/plugin-key.d.ts +0 -2
  124. package/dist/types-ts4.5/plugins/help-dialog/ui/HelpDialogLoader.d.ts +0 -4
  125. package/dist/types-ts4.5/plugins/help-dialog/ui/index.d.ts +0 -27
  126. package/dist/types-ts4.5/plugins/help-dialog/ui/styles.d.ts +0 -33
  127. package/dist/types-ts4.5/plugins/undo-redo/messages.d.ts +0 -12
  128. package/dist/types-ts4.5/ui/Alignment/messages.d.ts +0 -17
@@ -1,557 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
- /** @jsx jsx */
4
- import { useCallback, useEffect } from 'react';
5
- import { jsx } from '@emotion/react';
6
- import { injectIntl, defineMessages, FormattedMessage } from 'react-intl-next';
7
- import { browser } from '@atlaskit/editor-common/utils';
8
- import CrossIcon from '@atlaskit/icon/glyph/cross';
9
- import AkModalDialog, { ModalTransition, useModal } from '@atlaskit/modal-dialog';
10
- import { header, footer, contentWrapper, line, content, row, codeSm, codeMd, codeLg, title, column, dialogHeader } from './styles';
11
- import { navToFloatingToolbar, navToEditorToolbar, toggleBold, toggleItalic, toggleUnderline, toggleStrikethrough, toggleSubscript, toggleSuperscript, toggleHeading1, toggleHeading2, toggleHeading3, toggleHeading4, toggleHeading5, toggleHeading6, toggleOrderedList, insertRule, addLink, setNormalText, alignLeft, clearFormatting, undo, redo, pastePlainText, addInlineComment, toggleTaskItemCheckbox, toggleCode, openHelp, toggleBulletList, toggleBlockQuote } from '@atlaskit/editor-common/keymaps';
12
- import ToolbarButton from '../../../ui/ToolbarButton';
13
- import { toolbarMessages, listMessages } from '@atlaskit/editor-common/messages';
14
- import { messages as insertBlockMessages } from '../../insert-block/ui/ToolbarInsertBlock/messages';
15
- import { messages as blockTypeMessages } from '@atlaskit/editor-plugin-block-type/messages';
16
- import { messages as undoRedoMessages } from '../../undo-redo/messages';
17
- import { alignmentMessages } from '../../../ui/Alignment/messages';
18
- import { closeHelpCommand } from '../commands';
19
- import { annotationMessages } from '../../annotation/toolbar';
20
- import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
21
- var messages = defineMessages({
22
- editorHelp: {
23
- id: 'fabric.editor.editorHelp',
24
- defaultMessage: 'Editor help',
25
- description: 'Title of editor help dialog.'
26
- },
27
- helpDialogTips: {
28
- id: 'fabric.editor.helpDialogTips',
29
- defaultMessage: 'Press {keyMap} to quickly open this dialog at any time',
30
- description: 'Hint about how to open a dialog quickly using a shortcut.'
31
- },
32
- keyboardShortcuts: {
33
- id: 'fabric.editor.keyboardShortcuts',
34
- defaultMessage: 'Keyboard shortcuts',
35
- description: ''
36
- },
37
- markdown: {
38
- id: 'fabric.editor.markdown',
39
- defaultMessage: 'Markdown',
40
- description: 'It is a name of popular markup language.'
41
- },
42
- pastePlainText: {
43
- id: 'fabric.editor.pastePlainText',
44
- defaultMessage: 'Paste plain text',
45
- description: ''
46
- },
47
- CheckUncheckActionItem: {
48
- id: 'fabric.editor.checkUncheckActionItem',
49
- defaultMessage: 'Toggle action item',
50
- description: 'For Check/Uncheck Action item use shortcut'
51
- },
52
- altText: {
53
- id: 'fabric.editor.altText',
54
- defaultMessage: 'Alt text',
55
- description: 'Alternative text for image.'
56
- },
57
- closeHelpDialog: {
58
- id: 'fabric.editor.closeHelpDialog',
59
- defaultMessage: 'Close help dialog',
60
- description: ''
61
- },
62
- // TODO: Move it inside quick insert plugin
63
- quickInsert: {
64
- id: 'fabric.editor.quickInsert',
65
- defaultMessage: 'Quick insert',
66
- description: 'Name of a feature, which let you insert items quickly.'
67
- }
68
- });
69
- var navigationKeymaps = function navigationKeymaps(_ref) {
70
- var formatMessage = _ref.formatMessage;
71
- return [{
72
- name: formatMessage(toolbarMessages.navigateToEditorToolbar),
73
- type: 'navigation',
74
- keymap: function keymap() {
75
- return navToEditorToolbar;
76
- }
77
- }, {
78
- name: formatMessage(toolbarMessages.navigateToFloatingToolbar),
79
- type: 'navigation',
80
- keymap: function keymap() {
81
- return navToFloatingToolbar;
82
- }
83
- }];
84
- };
85
- export var formatting = function formatting(_ref2) {
86
- var formatMessage = _ref2.formatMessage;
87
- return [{
88
- name: formatMessage(toolbarMessages.bold),
89
- type: 'strong',
90
- keymap: function keymap() {
91
- return toggleBold;
92
- },
93
- autoFormatting: function autoFormatting() {
94
- return jsx("span", null, jsx("span", {
95
- css: codeLg
96
- }, "**", jsx(FormattedMessage, toolbarMessages.bold), "**"));
97
- }
98
- }, {
99
- name: formatMessage(toolbarMessages.italic),
100
- type: 'em',
101
- keymap: function keymap() {
102
- return toggleItalic;
103
- },
104
- autoFormatting: function autoFormatting() {
105
- return jsx("span", null, jsx("span", {
106
- css: codeLg
107
- }, "*", jsx(FormattedMessage, toolbarMessages.italic), "*"));
108
- }
109
- }, {
110
- name: formatMessage(toolbarMessages.underline),
111
- type: 'underline',
112
- keymap: function keymap() {
113
- return toggleUnderline;
114
- }
115
- }, {
116
- name: formatMessage(toolbarMessages.strike),
117
- type: 'strike',
118
- keymap: function keymap() {
119
- return toggleStrikethrough;
120
- },
121
- autoFormatting: function autoFormatting() {
122
- return jsx("span", null, jsx("span", {
123
- css: codeLg
124
- }, "~~", jsx(FormattedMessage, toolbarMessages.strike), "~~"));
125
- }
126
- }, {
127
- name: formatMessage(toolbarMessages.subscript),
128
- type: 'subsup',
129
- keymap: function keymap() {
130
- return toggleSubscript;
131
- }
132
- }, {
133
- name: formatMessage(toolbarMessages.superscript),
134
- type: 'subsup',
135
- keymap: function keymap() {
136
- return toggleSuperscript;
137
- }
138
- }, {
139
- name: formatMessage(blockTypeMessages.heading1),
140
- type: 'heading',
141
- keymap: function keymap() {
142
- return toggleHeading1;
143
- },
144
- autoFormatting: function autoFormatting() {
145
- return jsx("span", null, jsx("span", {
146
- css: codeSm
147
- }, "#"), " ", jsx("span", {
148
- css: codeLg
149
- }, "Space"));
150
- }
151
- }, {
152
- name: formatMessage(blockTypeMessages.heading2),
153
- type: 'heading',
154
- keymap: function keymap() {
155
- return toggleHeading2;
156
- },
157
- autoFormatting: function autoFormatting() {
158
- return jsx("span", null, jsx("span", {
159
- css: codeLg
160
- }, "##"), " ", jsx("span", {
161
- css: codeLg
162
- }, "Space"));
163
- }
164
- }, {
165
- name: formatMessage(blockTypeMessages.heading3),
166
- type: 'heading',
167
- keymap: function keymap() {
168
- return toggleHeading3;
169
- },
170
- autoFormatting: function autoFormatting() {
171
- return jsx("span", null, jsx("span", {
172
- css: codeLg
173
- }, "###"), " ", jsx("span", {
174
- css: codeLg
175
- }, "Space"));
176
- }
177
- }, {
178
- name: formatMessage(blockTypeMessages.heading4),
179
- type: 'heading',
180
- keymap: function keymap() {
181
- return toggleHeading4;
182
- },
183
- autoFormatting: function autoFormatting() {
184
- return jsx("span", null, jsx("span", {
185
- css: codeLg
186
- }, "####"), " ", jsx("span", {
187
- css: codeLg
188
- }, "Space"));
189
- }
190
- }, {
191
- name: formatMessage(blockTypeMessages.heading5),
192
- type: 'heading',
193
- keymap: function keymap() {
194
- return toggleHeading5;
195
- },
196
- autoFormatting: function autoFormatting() {
197
- return jsx("span", null, jsx("span", {
198
- css: codeLg
199
- }, "#####"), " ", jsx("span", {
200
- css: codeLg
201
- }, "Space"));
202
- }
203
- }, {
204
- name: formatMessage(blockTypeMessages.heading6),
205
- type: 'heading',
206
- keymap: function keymap() {
207
- return toggleHeading6;
208
- },
209
- autoFormatting: function autoFormatting() {
210
- return jsx("span", null, jsx("span", {
211
- css: codeLg
212
- }, "######"), " ", jsx("span", {
213
- css: codeLg
214
- }, "Space"));
215
- }
216
- }, {
217
- name: formatMessage(blockTypeMessages.normal),
218
- type: 'paragraph',
219
- keymap: function keymap() {
220
- return setNormalText;
221
- }
222
- }, {
223
- name: formatMessage(listMessages.orderedList),
224
- type: 'orderedList',
225
- keymap: function keymap() {
226
- return toggleOrderedList;
227
- },
228
- autoFormatting: function autoFormatting() {
229
- return jsx("span", null, jsx("span", {
230
- css: codeSm
231
- }, "1."), " ", jsx("span", {
232
- css: codeLg
233
- }, "Space"));
234
- }
235
- }, {
236
- name: formatMessage(listMessages.unorderedList),
237
- type: 'bulletList',
238
- keymap: function keymap() {
239
- return toggleBulletList;
240
- },
241
- autoFormatting: function autoFormatting() {
242
- return jsx("span", null, jsx("span", {
243
- css: codeSm
244
- }, "*"), " ", jsx("span", {
245
- css: codeLg
246
- }, "Space"));
247
- }
248
- }, {
249
- name: formatMessage(blockTypeMessages.blockquote),
250
- type: 'blockquote',
251
- keymap: function keymap() {
252
- return toggleBlockQuote;
253
- },
254
- autoFormatting: function autoFormatting() {
255
- return jsx("span", null, jsx("span", {
256
- css: codeLg
257
- }, '>'), " ", jsx("span", {
258
- css: codeLg
259
- }, "Space"));
260
- }
261
- }, {
262
- name: formatMessage(blockTypeMessages.codeblock),
263
- type: 'codeBlock',
264
- autoFormatting: function autoFormatting() {
265
- return jsx("span", null, jsx("span", {
266
- css: codeLg
267
- }, "```"));
268
- }
269
- }, {
270
- name: formatMessage(insertBlockMessages.horizontalRule),
271
- type: 'rule',
272
- keymap: function keymap() {
273
- return insertRule;
274
- },
275
- autoFormatting: function autoFormatting() {
276
- return jsx("span", null, jsx("span", {
277
- css: codeLg
278
- }, "---"));
279
- }
280
- }, {
281
- name: formatMessage(insertBlockMessages.link),
282
- type: 'link',
283
- keymap: function keymap() {
284
- return addLink;
285
- },
286
- autoFormatting: function autoFormatting() {
287
- return jsx("span", null, jsx("span", {
288
- css: codeLg
289
- }, "[", jsx(FormattedMessage, insertBlockMessages.link), "](http://a.com)"));
290
- }
291
- }, {
292
- name: formatMessage(toolbarMessages.code),
293
- type: 'code',
294
- keymap: function keymap() {
295
- return toggleCode;
296
- },
297
- autoFormatting: function autoFormatting() {
298
- return jsx("span", null, jsx("span", {
299
- css: codeLg
300
- }, "`", jsx(FormattedMessage, toolbarMessages.code), "`"));
301
- }
302
- }, {
303
- name: formatMessage(insertBlockMessages.action),
304
- type: 'taskItem',
305
- autoFormatting: function autoFormatting() {
306
- return jsx("span", null, jsx("span", {
307
- css: codeSm
308
- }, "[]"), " ", jsx("span", {
309
- css: codeLg
310
- }, "Space"));
311
- }
312
- }, {
313
- name: formatMessage(insertBlockMessages.decision),
314
- type: 'decisionItem',
315
- autoFormatting: function autoFormatting() {
316
- return jsx("span", null, jsx("span", {
317
- css: codeSm
318
- }, "<>"), " ", jsx("span", {
319
- css: codeLg
320
- }, "Space"));
321
- }
322
- }, {
323
- name: formatMessage(insertBlockMessages.emoji),
324
- type: 'emoji',
325
- autoFormatting: function autoFormatting() {
326
- return jsx("span", null, jsx("span", {
327
- css: codeLg
328
- }, ":"));
329
- }
330
- }, {
331
- name: formatMessage(insertBlockMessages.mention),
332
- type: 'mention',
333
- autoFormatting: function autoFormatting() {
334
- return jsx("span", null, jsx("span", {
335
- css: codeLg
336
- }, "@"));
337
- }
338
- }, {
339
- name: formatMessage(alignmentMessages.alignLeft),
340
- type: 'alignment',
341
- keymap: function keymap() {
342
- return alignLeft;
343
- }
344
- }, {
345
- name: formatMessage(alignmentMessages.alignRight),
346
- type: 'alignment'
347
- }];
348
- };
349
- var shortcutNamesWithoutKeymap = ['emoji', 'mention', 'quickInsert'];
350
- var otherFormatting = function otherFormatting(_ref3) {
351
- var formatMessage = _ref3.formatMessage;
352
- return [{
353
- name: formatMessage(toolbarMessages.clearFormatting),
354
- type: 'clearFormatting',
355
- keymap: function keymap() {
356
- return clearFormatting;
357
- }
358
- }, {
359
- name: formatMessage(undoRedoMessages.undo),
360
- type: 'undo',
361
- keymap: function keymap() {
362
- return undo;
363
- }
364
- }, {
365
- name: formatMessage(undoRedoMessages.redo),
366
- type: 'redo',
367
- keymap: function keymap() {
368
- return redo;
369
- }
370
- }, {
371
- name: formatMessage(messages.pastePlainText),
372
- type: 'paste',
373
- keymap: function keymap() {
374
- return pastePlainText;
375
- }
376
- }, {
377
- name: formatMessage(annotationMessages.createComment),
378
- type: 'annotation',
379
- keymap: function keymap() {
380
- return addInlineComment;
381
- }
382
- }, {
383
- name: formatMessage(messages.CheckUncheckActionItem),
384
- type: 'checkbox',
385
- keymap: function keymap() {
386
- return toggleTaskItemCheckbox;
387
- }
388
- }];
389
- };
390
- var imageAutoFormat = {
391
- name: 'Image',
392
- type: 'image',
393
- autoFormatting: function autoFormatting() {
394
- return jsx("span", null, jsx("span", {
395
- css: codeLg
396
- }, "![", jsx(FormattedMessage, messages.altText), "](http://www.image.com)"));
397
- }
398
- };
399
- var quickInsertAutoFormat = function quickInsertAutoFormat(_ref4) {
400
- var formatMessage = _ref4.formatMessage;
401
- return {
402
- name: formatMessage(messages.quickInsert),
403
- type: 'quickInsert',
404
- autoFormatting: function autoFormatting() {
405
- return jsx("span", null, jsx("span", {
406
- css: codeLg
407
- }, "/"));
408
- }
409
- };
410
- };
411
- var getKeyParts = function getKeyParts(keymap) {
412
- var shortcut = keymap[browser.mac ? 'mac' : 'windows'];
413
- if (browser.mac) {
414
- shortcut = shortcut.replace('Alt', 'Opt');
415
- }
416
- return shortcut.replace(/\-(?=.)/g, ' + ').split(' ');
417
- };
418
- export var getSupportedFormatting = function getSupportedFormatting(schema, intl, imageEnabled, quickInsertEnabled) {
419
- var supportedBySchema = formatting(intl).filter(function (format) {
420
- return schema.nodes[format.type] || schema.marks[format.type];
421
- });
422
- return [].concat(_toConsumableArray(navigationKeymaps(intl)), _toConsumableArray(supportedBySchema), _toConsumableArray(imageEnabled ? [imageAutoFormat] : []), _toConsumableArray(quickInsertEnabled ? [quickInsertAutoFormat(intl)] : []), _toConsumableArray(otherFormatting(intl)));
423
- };
424
- export var getComponentFromKeymap = function getComponentFromKeymap(keymap) {
425
- var keyParts = getKeyParts(keymap);
426
- return jsx("span", null, keyParts.map(function (part, index) {
427
- if (part === '+') {
428
- return jsx("span", {
429
- key: "".concat(keyParts, "-").concat(index)
430
- }, ' + ');
431
- } else if (part === 'Cmd') {
432
- return jsx("span", {
433
- css: codeSm,
434
- key: "".concat(keyParts, "-").concat(index)
435
- }, "\u2318");
436
- } else if (['ctrl', 'alt', 'opt', 'shift'].indexOf(part.toLowerCase()) >= 0) {
437
- return jsx("span", {
438
- css: codeMd,
439
- key: "".concat(keyParts, "-").concat(index)
440
- }, part);
441
- } else if (['f9', 'f10'].indexOf(part.toLowerCase()) >= 0) {
442
- return jsx("span", {
443
- css: codeLg,
444
- key: "".concat(keyParts, "-").concat(index)
445
- }, part);
446
- } else if (part.toLowerCase() === 'enter') {
447
- return jsx("span", {
448
- css: codeSm,
449
- key: "".concat(keyParts, "-").concat(index)
450
- }, '⏎');
451
- }
452
- return jsx("span", {
453
- css: codeSm,
454
- key: "".concat(keyParts, "-").concat(index)
455
- }, part.toUpperCase());
456
- }));
457
- };
458
- var ModalHeader = injectIntl(function (_ref5) {
459
- var formatMessage = _ref5.intl.formatMessage;
460
- var _useModal = useModal(),
461
- onClose = _useModal.onClose;
462
- return jsx("div", {
463
- css: header
464
- }, jsx("h1", {
465
- css: dialogHeader
466
- }, jsx(FormattedMessage, messages.editorHelp)), jsx("div", null, jsx(ToolbarButton
467
- // @ts-ignore
468
- , {
469
- onClick: onClose,
470
- title: formatMessage(messages.closeHelpDialog),
471
- spacing: "compact",
472
- iconBefore: jsx(CrossIcon, {
473
- label: formatMessage(messages.closeHelpDialog),
474
- size: "medium"
475
- })
476
- })));
477
- });
478
- var ModalFooter = function ModalFooter() {
479
- return jsx("div", {
480
- css: footer
481
- }, jsx(FormattedMessage, _extends({}, messages.helpDialogTips, {
482
- values: {
483
- keyMap: getComponentFromKeymap(openHelp)
484
- }
485
- })));
486
- };
487
- var HelpDialog = function HelpDialog(_ref6) {
488
- var pluginInjectionApi = _ref6.pluginInjectionApi,
489
- editorView = _ref6.editorView,
490
- quickInsertEnabled = _ref6.quickInsertEnabled,
491
- intl = _ref6.intl;
492
- var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['helpDialog']),
493
- helpDialogState = _useSharedPluginState.helpDialogState;
494
- var closeDialog = useCallback(function () {
495
- var tr = editorView.state.tr,
496
- dispatch = editorView.dispatch;
497
- closeHelpCommand(tr, dispatch);
498
- }, [editorView]);
499
- var handleEsc = useCallback(function (e) {
500
- if (e.key === 'Escape' && helpDialogState !== null && helpDialogState !== void 0 && helpDialogState.isVisible) {
501
- closeDialog();
502
- }
503
- }, [closeDialog, helpDialogState === null || helpDialogState === void 0 ? void 0 : helpDialogState.isVisible]);
504
- useEffect(function () {
505
- document.addEventListener('keydown', handleEsc);
506
- return function () {
507
- document.removeEventListener('keydown', handleEsc);
508
- };
509
- }, [handleEsc]);
510
- var formatting = getSupportedFormatting(editorView.state.schema, intl, helpDialogState === null || helpDialogState === void 0 ? void 0 : helpDialogState.imageEnabled, quickInsertEnabled);
511
- return jsx(ModalTransition, null, helpDialogState !== null && helpDialogState !== void 0 && helpDialogState.isVisible ? jsx(AkModalDialog, {
512
- width: "large",
513
- onClose: closeDialog,
514
- testId: "help-modal-dialog"
515
- }, jsx(ModalHeader, null), jsx("div", {
516
- css: contentWrapper
517
- }, jsx("div", {
518
- css: line
519
- }), jsx("div", {
520
- css: content
521
- }, jsx("div", {
522
- css: column
523
- }, jsx("h2", {
524
- css: title
525
- }, jsx(FormattedMessage, messages.keyboardShortcuts)), jsx("ul", null, formatting.filter(function (form) {
526
- var keymap = form.keymap && form.keymap();
527
- return keymap && keymap[browser.mac ? 'mac' : 'windows'];
528
- }).map(function (form) {
529
- return jsx("li", {
530
- css: row,
531
- key: "textFormatting-".concat(form.name)
532
- }, jsx("span", null, form.name), getComponentFromKeymap(form.keymap()));
533
- }), formatting.filter(function (form) {
534
- return shortcutNamesWithoutKeymap.indexOf(form.type) !== -1;
535
- }).filter(function (form) {
536
- return form.autoFormatting;
537
- }).map(function (form) {
538
- return jsx("li", {
539
- css: row,
540
- key: "autoFormatting-".concat(form.name)
541
- }, jsx("span", null, form.name), form.autoFormatting());
542
- }))), jsx("div", {
543
- css: line
544
- }), jsx("div", {
545
- css: column
546
- }, jsx("h2", {
547
- css: title
548
- }, jsx(FormattedMessage, messages.markdown)), jsx("ul", null, formatting.filter(function (form) {
549
- return shortcutNamesWithoutKeymap.indexOf(form.type) === -1;
550
- }).map(function (form) {
551
- return form.autoFormatting && jsx("li", {
552
- key: "autoFormatting-".concat(form.name),
553
- css: row
554
- }, jsx("span", null, form.name), form.autoFormatting());
555
- }))))), jsx(ModalFooter, null)) : null);
556
- };
557
- export default injectIntl(HelpDialog);
@@ -1,40 +0,0 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9;
3
- import { css } from '@emotion/react';
4
- import { borderRadius } from '@atlaskit/theme/constants';
5
- import * as colors from '@atlaskit/theme/colors';
6
- import { akEditorUnitZIndex, relativeFontSizeToBase16 } from '@atlaskit/editor-shared-styles';
7
- import { N400 } from '@atlaskit/theme/colors';
8
- export var header = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n z-index: ", ";\n min-height: 24px;\n padding: 20px 40px;\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"])), akEditorUnitZIndex, relativeFontSizeToBase16(24), "var(--ds-text, ".concat(colors.N400, ")"), "var(--ds-background-neutral-subtle, ".concat(colors.N0, ")"), borderRadius());
9
- export var footer = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n z-index: ", ";\n font-size: ", ";\n line-height: 20px;\n color: ", ";\n padding: 24px;\n text-align: right;\n box-shadow: 'none';\n"])), akEditorUnitZIndex, relativeFontSizeToBase16(14), "var(--ds-text-subtlest, ".concat(colors.N300, ")"));
10
- export var contentWrapper = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n padding: 20px 44px;\n border-bottom-right-radius: ", "px;\n overflow: auto;\n position: relative;\n color: ", ";\n background-color: ", ";\n"])), borderRadius(), "var(--ds-text-subtle, ".concat(colors.N400, ")"), "var(--ds-background-neutral-subtle, ".concat(colors.N0, ")"));
11
- export var line = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n background: ", ";\n content: '';\n display: block;\n height: 2px;\n left: 0;\n position: absolute;\n top: 0;\n right: 0;\n width: 100%;\n min-width: 604px;\n"])), "var(--ds-background-neutral-subtle, #fff)");
12
- export var content = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n min-width: 524px;\n width: 100%;\n position: relative;\n display: flex;\n justify-content: space-between;\n"])));
13
- export var column = {
14
- width: '44%',
15
- '& > ul': {
16
- padding: 0
17
- }
18
- };
19
- export var row = css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n margin: 20px 0;\n display: flex;\n justify-content: space-between;\n"])));
20
- export var dialogHeader = {
21
- '&': {
22
- fontSize: relativeFontSizeToBase16(24),
23
- fontWeight: 400,
24
- color: "var(--ds-text-subtle, ".concat(N400, ")"),
25
- letterSpacing: 'normal',
26
- lineHeight: 1.42857142857143
27
- }
28
- };
29
- export var title = {
30
- '&': {
31
- fontSize: relativeFontSizeToBase16(18),
32
- fontWeight: 400,
33
- color: "var(--ds-text-subtle, ".concat(N400, ")"),
34
- letterSpacing: 'normal',
35
- lineHeight: 1.42857142857143
36
- }
37
- };
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
- 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
- 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());
@@ -1,13 +0,0 @@
1
- import { defineMessages } from 'react-intl-next';
2
- export var messages = defineMessages({
3
- undo: {
4
- id: 'fabric.editor.undo',
5
- defaultMessage: 'Undo',
6
- description: 'Undo the previously performed action.'
7
- },
8
- redo: {
9
- id: 'fabric.editor.redo',
10
- defaultMessage: 'Redo',
11
- description: 'Redo the previously undone action.'
12
- }
13
- });
@@ -1,18 +0,0 @@
1
- import { defineMessages } from 'react-intl-next';
2
- export var alignmentMessages = defineMessages({
3
- alignLeft: {
4
- id: 'fabric.editor.alignLeft',
5
- defaultMessage: 'Align left',
6
- description: 'Action to align/justify text to the left'
7
- },
8
- alignCenter: {
9
- id: 'fabric.editor.alignCenter',
10
- defaultMessage: 'Align center',
11
- description: 'Action to align/justify text to the center/middle'
12
- },
13
- alignRight: {
14
- id: 'fabric.editor.alignRight',
15
- defaultMessage: 'Align right',
16
- description: 'Action to align/justify text to the right'
17
- }
18
- });
@@ -1,3 +0,0 @@
1
- import type { Transaction } from '@atlaskit/editor-prosemirror/state';
2
- export declare const openHelpCommand: (tr: Transaction, dispatch?: Function) => boolean;
3
- export declare const closeHelpCommand: (tr: Transaction, dispatch: Function) => void;
@@ -1,18 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
3
- import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
- import type { QuickInsertPlugin } from '@atlaskit/editor-plugin-quick-insert';
5
- export declare function createPlugin(dispatch: Function, imageEnabled: boolean): SafePlugin<any>;
6
- interface HelpDialogSharedState {
7
- isVisible: boolean;
8
- imageEnabled: boolean;
9
- }
10
- declare const helpDialog: NextEditorPlugin<'helpDialog', {
11
- dependencies: [
12
- OptionalPlugin<AnalyticsPlugin>,
13
- OptionalPlugin<QuickInsertPlugin>
14
- ];
15
- pluginConfiguration: boolean;
16
- sharedState: HelpDialogSharedState | null;
17
- }>;
18
- export default helpDialog;
@@ -1,2 +0,0 @@
1
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
- export declare const pluginKey: PluginKey<any>;
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- import Loadable from 'react-loadable';
3
- import type { HelpDialogProps } from './index';
4
- export declare const HelpDialogLoader: import("react").ComponentType<HelpDialogProps> & Loadable.LoadableComponent;