@atlaskit/editor-core 189.4.0 → 189.4.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 (131) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/plugins/index.js +0 -14
  3. package/dist/cjs/presets/universal.js +4 -2
  4. package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +7 -3
  5. package/dist/cjs/version-wrapper.js +1 -1
  6. package/dist/es2019/plugins/index.js +0 -2
  7. package/dist/es2019/presets/universal.js +3 -1
  8. package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +7 -3
  9. package/dist/es2019/version-wrapper.js +1 -1
  10. package/dist/esm/plugins/index.js +0 -2
  11. package/dist/esm/presets/universal.js +3 -1
  12. package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +7 -3
  13. package/dist/esm/version-wrapper.js +1 -1
  14. package/dist/types/plugins/index.d.ts +0 -2
  15. package/dist/types-ts4.5/plugins/index.d.ts +0 -2
  16. package/package.json +11 -5
  17. package/dist/cjs/plugins/insert-block/index.js +0 -165
  18. package/dist/cjs/plugins/insert-block/types.js +0 -5
  19. package/dist/cjs/plugins/insert-block/ui/ElementBrowser/InsertMenu.js +0 -152
  20. package/dist/cjs/plugins/insert-block/ui/ElementBrowser/types.js +0 -5
  21. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +0 -42
  22. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +0 -42
  23. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +0 -66
  24. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +0 -217
  25. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +0 -49
  26. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +0 -565
  27. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/item.js +0 -250
  28. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/messages.js +0 -12
  29. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/shallow-equals.js +0 -20
  30. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/sort-items.js +0 -30
  31. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/styles.js +0 -11
  32. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/types.js +0 -5
  33. package/dist/cjs/plugins/toolbar-lists-indentation/index.js +0 -91
  34. package/dist/cjs/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +0 -56
  35. package/dist/cjs/plugins/toolbar-lists-indentation/types.js +0 -5
  36. package/dist/cjs/plugins/toolbar-lists-indentation/ui/Toolbar.js +0 -135
  37. package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +0 -168
  38. package/dist/cjs/plugins/toolbar-lists-indentation/ui/index.js +0 -63
  39. package/dist/cjs/plugins/toolbar-lists-indentation/ui/onItemActivated.js +0 -53
  40. package/dist/es2019/plugins/insert-block/index.js +0 -159
  41. package/dist/es2019/plugins/insert-block/types.js +0 -1
  42. package/dist/es2019/plugins/insert-block/ui/ElementBrowser/InsertMenu.js +0 -150
  43. package/dist/es2019/plugins/insert-block/ui/ElementBrowser/types.js +0 -1
  44. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +0 -35
  45. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +0 -35
  46. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +0 -59
  47. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +0 -198
  48. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +0 -37
  49. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +0 -558
  50. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/item.js +0 -201
  51. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/messages.js +0 -1
  52. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/shallow-equals.js +0 -8
  53. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/sort-items.js +0 -22
  54. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/styles.js +0 -16
  55. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/types.js +0 -1
  56. package/dist/es2019/plugins/toolbar-lists-indentation/index.js +0 -86
  57. package/dist/es2019/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +0 -53
  58. package/dist/es2019/plugins/toolbar-lists-indentation/types.js +0 -1
  59. package/dist/es2019/plugins/toolbar-lists-indentation/ui/Toolbar.js +0 -123
  60. package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +0 -158
  61. package/dist/es2019/plugins/toolbar-lists-indentation/ui/index.js +0 -58
  62. package/dist/es2019/plugins/toolbar-lists-indentation/ui/onItemActivated.js +0 -46
  63. package/dist/esm/plugins/insert-block/index.js +0 -158
  64. package/dist/esm/plugins/insert-block/types.js +0 -1
  65. package/dist/esm/plugins/insert-block/ui/ElementBrowser/InsertMenu.js +0 -146
  66. package/dist/esm/plugins/insert-block/ui/ElementBrowser/types.js +0 -1
  67. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +0 -35
  68. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +0 -35
  69. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +0 -59
  70. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +0 -210
  71. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +0 -41
  72. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +0 -560
  73. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/item.js +0 -243
  74. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/messages.js +0 -1
  75. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/shallow-equals.js +0 -13
  76. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/sort-items.js +0 -24
  77. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/styles.js +0 -4
  78. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/types.js +0 -1
  79. package/dist/esm/plugins/toolbar-lists-indentation/index.js +0 -83
  80. package/dist/esm/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.js +0 -50
  81. package/dist/esm/plugins/toolbar-lists-indentation/types.js +0 -1
  82. package/dist/esm/plugins/toolbar-lists-indentation/ui/Toolbar.js +0 -124
  83. package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +0 -161
  84. package/dist/esm/plugins/toolbar-lists-indentation/ui/index.js +0 -56
  85. package/dist/esm/plugins/toolbar-lists-indentation/ui/onItemActivated.js +0 -47
  86. package/dist/types/plugins/insert-block/index.d.ts +0 -16
  87. package/dist/types/plugins/insert-block/types.d.ts +0 -45
  88. package/dist/types/plugins/insert-block/ui/ElementBrowser/InsertMenu.d.ts +0 -4
  89. package/dist/types/plugins/insert-block/ui/ElementBrowser/types.d.ts +0 -22
  90. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +0 -28
  91. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +0 -18
  92. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.d.ts +0 -30
  93. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/create-items.d.ts +0 -39
  94. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.d.ts +0 -16
  95. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/index.d.ts +0 -46
  96. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/item.d.ts +0 -34
  97. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/messages.d.ts +0 -1
  98. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/shallow-equals.d.ts +0 -1
  99. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/sort-items.d.ts +0 -2
  100. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/styles.d.ts +0 -1
  101. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +0 -59
  102. package/dist/types/plugins/toolbar-lists-indentation/index.d.ts +0 -33
  103. package/dist/types/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.d.ts +0 -19
  104. package/dist/types/plugins/toolbar-lists-indentation/types.d.ts +0 -20
  105. package/dist/types/plugins/toolbar-lists-indentation/ui/Toolbar.d.ts +0 -4
  106. package/dist/types/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.d.ts +0 -9
  107. package/dist/types/plugins/toolbar-lists-indentation/ui/index.d.ts +0 -26
  108. package/dist/types/plugins/toolbar-lists-indentation/ui/onItemActivated.d.ts +0 -9
  109. package/dist/types-ts4.5/plugins/insert-block/index.d.ts +0 -16
  110. package/dist/types-ts4.5/plugins/insert-block/types.d.ts +0 -45
  111. package/dist/types-ts4.5/plugins/insert-block/ui/ElementBrowser/InsertMenu.d.ts +0 -4
  112. package/dist/types-ts4.5/plugins/insert-block/ui/ElementBrowser/types.d.ts +0 -22
  113. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +0 -28
  114. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +0 -18
  115. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.d.ts +0 -30
  116. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/create-items.d.ts +0 -42
  117. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.d.ts +0 -16
  118. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/index.d.ts +0 -46
  119. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/item.d.ts +0 -34
  120. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/messages.d.ts +0 -1
  121. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/shallow-equals.d.ts +0 -1
  122. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/sort-items.d.ts +0 -2
  123. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/styles.d.ts +0 -1
  124. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +0 -59
  125. package/dist/types-ts4.5/plugins/toolbar-lists-indentation/index.d.ts +0 -33
  126. package/dist/types-ts4.5/plugins/toolbar-lists-indentation/pm-plugins/indentation-buttons.d.ts +0 -19
  127. package/dist/types-ts4.5/plugins/toolbar-lists-indentation/types.d.ts +0 -20
  128. package/dist/types-ts4.5/plugins/toolbar-lists-indentation/ui/Toolbar.d.ts +0 -4
  129. package/dist/types-ts4.5/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.d.ts +0 -9
  130. package/dist/types-ts4.5/plugins/toolbar-lists-indentation/ui/index.d.ts +0 -26
  131. package/dist/types-ts4.5/plugins/toolbar-lists-indentation/ui/onItemActivated.d.ts +0 -9
@@ -1,243 +0,0 @@
1
- /** @jsx jsx */
2
- import React from 'react';
3
- import { jsx } from '@emotion/react';
4
- import memoizeOne from 'memoize-one';
5
- import DecisionIcon from '@atlaskit/icon/glyph/editor/decision';
6
- import TaskIcon from '@atlaskit/icon/glyph/editor/task';
7
- import TableIcon from '@atlaskit/icon/glyph/editor/table';
8
- import EditorImageIcon from '@atlaskit/icon/glyph/editor/image';
9
- import MentionIcon from '@atlaskit/icon/glyph/editor/mention';
10
- import EditorMoreIcon from '@atlaskit/icon/glyph/editor/more';
11
- import LinkIcon from '@atlaskit/icon/glyph/editor/link';
12
- import EmojiIcon from '@atlaskit/icon/glyph/editor/emoji';
13
- import DateIcon from '@atlaskit/icon/glyph/editor/date';
14
- import StatusIcon from '@atlaskit/icon/glyph/status';
15
- import ExpandNodeIcon from '@atlaskit/icon/glyph/chevron-right-circle';
16
- import PlaceholderTextIcon from '@atlaskit/icon/glyph/media-services/text';
17
- import LayoutTwoEqualIcon from '@atlaskit/icon/glyph/editor/layout-two-equal';
18
- import HorizontalRuleIcon from '@atlaskit/icon/glyph/editor/horizontal-rule';
19
- import CodeIcon from '@atlaskit/icon/glyph/editor/code';
20
- import InfoIcon from '@atlaskit/icon/glyph/editor/info';
21
- import QuoteIcon from '@atlaskit/icon/glyph/quote';
22
- import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
23
- import { tooltip, addLink, toggleTable } from '@atlaskit/editor-common/keymaps';
24
- import { shallowEquals } from './shallow-equals';
25
- import { getAriaKeyshortcuts } from '@atlaskit/editor-common/keymaps';
26
- var from = function from(init) {
27
- return {
28
- content: init.content,
29
- tooltipDescription: init.tooltipDescription,
30
- value: {
31
- name: init.name
32
- },
33
- elemBefore: jsx(init.Icon, {
34
- label: init.content
35
- }),
36
- elemAfter: init.shortcut ? jsx("div", {
37
- css: shortcutStyle
38
- }, init.shortcut) : undefined,
39
- 'aria-label': init.shortcut ? init.content + ' ' + init.shortcut : init.content,
40
- 'aria-haspopup': init['aria-haspopup'],
41
- 'aria-keyshortcuts': init['aria-keyshortcuts'],
42
- shortcut: init.shortcut,
43
- isDisabled: init.disabled
44
- };
45
- };
46
- var mem = function mem(fn) {
47
- return memoizeOne(fn, shallowEquals);
48
- };
49
- export var action = mem(function (init) {
50
- return from({
51
- content: init.content,
52
- tooltipDescription: init.tooltipDescription,
53
- disabled: init.disabled,
54
- name: 'action',
55
- shortcut: '[]',
56
- Icon: TaskIcon,
57
- 'aria-keyshortcuts': '[ ] Space'
58
- });
59
- });
60
- export var link = mem(function (init) {
61
- return from({
62
- content: init.content,
63
- tooltipDescription: init.tooltipDescription,
64
- disabled: init.disabled,
65
- name: 'link',
66
- shortcut: tooltip(addLink),
67
- Icon: LinkIcon,
68
- 'aria-haspopup': init['aria-haspopup'],
69
- 'aria-keyshortcuts': getAriaKeyshortcuts(addLink)
70
- });
71
- });
72
- export var media = mem(function (init) {
73
- return from({
74
- content: init.content,
75
- tooltipDescription: init.tooltipDescription,
76
- disabled: init.disabled,
77
- name: 'media',
78
- Icon: EditorImageIcon
79
- });
80
- });
81
- export var imageUpload = mem(function (init) {
82
- return from({
83
- content: init.content,
84
- tooltipDescription: init.tooltipDescription,
85
- disabled: init.disabled,
86
- name: 'image upload',
87
- Icon: EditorImageIcon
88
- });
89
- });
90
- export var mention = mem(function (init) {
91
- return from({
92
- content: init.content,
93
- tooltipDescription: init.tooltipDescription,
94
- disabled: init.disabled,
95
- name: 'mention',
96
- Icon: MentionIcon,
97
- shortcut: '@',
98
- 'aria-haspopup': init['aria-haspopup'],
99
- 'aria-keyshortcuts': 'Shift+2 Space'
100
- });
101
- });
102
- export var emoji = mem(function (init) {
103
- return from({
104
- content: init.content,
105
- tooltipDescription: init.tooltipDescription,
106
- disabled: init.disabled,
107
- name: 'emoji',
108
- Icon: EmojiIcon,
109
- shortcut: ':',
110
- 'aria-haspopup': init['aria-haspopup'],
111
- 'aria-keyshortcuts': 'Shift+;'
112
- });
113
- });
114
- export var table = mem(function (init) {
115
- return from({
116
- content: init.content,
117
- tooltipDescription: init.tooltipDescription,
118
- disabled: init.disabled,
119
- name: 'table',
120
- Icon: TableIcon,
121
- shortcut: tooltip(toggleTable),
122
- 'aria-keyshortcuts': getAriaKeyshortcuts(toggleTable)
123
- });
124
- });
125
- export var layout = mem(function (init) {
126
- return from({
127
- content: init.content,
128
- tooltipDescription: init.tooltipDescription,
129
- disabled: init.disabled,
130
- name: 'layout',
131
- Icon: LayoutTwoEqualIcon
132
- });
133
- });
134
- export var codeblock = mem(function (init) {
135
- return from({
136
- content: init.content,
137
- tooltipDescription: init.tooltipDescription,
138
- disabled: init.disabled,
139
- name: 'codeblock',
140
- Icon: CodeIcon,
141
- shortcut: init.shortcut,
142
- 'aria-keyshortcuts': getAriaKeyshortcuts(init.shortcut)
143
- });
144
- });
145
- export var panel = mem(function (init) {
146
- return from({
147
- content: init.content,
148
- tooltipDescription: init.tooltipDescription,
149
- disabled: init.disabled,
150
- name: 'panel',
151
- Icon: InfoIcon,
152
- shortcut: init.shortcut,
153
- 'aria-keyshortcuts': getAriaKeyshortcuts(init.shortcut)
154
- });
155
- });
156
- export var blockquote = mem(function (init) {
157
- return from({
158
- content: init.content,
159
- tooltipDescription: init.tooltipDescription,
160
- disabled: init.disabled,
161
- name: 'blockquote',
162
- Icon: QuoteIcon,
163
- shortcut: init.shortcut,
164
- 'aria-keyshortcuts': 'Shift+. Space'
165
- });
166
- });
167
- export var decision = mem(function (init) {
168
- return from({
169
- content: init.content,
170
- tooltipDescription: init.tooltipDescription,
171
- disabled: init.disabled,
172
- name: 'decision',
173
- Icon: DecisionIcon,
174
- shortcut: '<>',
175
- 'aria-keyshortcuts': 'Shift+, Shift+. Space'
176
- });
177
- });
178
- export var horizontalrule = mem(function (init) {
179
- return from({
180
- content: init.content,
181
- tooltipDescription: init.tooltipDescription,
182
- disabled: init.disabled,
183
- name: 'horizontalrule',
184
- Icon: HorizontalRuleIcon,
185
- shortcut: '---',
186
- 'aria-keyshortcuts': '- - -'
187
- });
188
- });
189
- export var expand = mem(function (init) {
190
- return from({
191
- content: init.content,
192
- tooltipDescription: init.tooltipDescription,
193
- disabled: init.disabled,
194
- name: 'expand',
195
- Icon: ExpandNodeIcon
196
- });
197
- });
198
- export var date = mem(function (init) {
199
- return from({
200
- content: init.content,
201
- tooltipDescription: init.tooltipDescription,
202
- disabled: init.disabled,
203
- name: 'date',
204
- Icon: DateIcon,
205
- shortcut: '//',
206
- 'aria-keyshortcuts': '/ / Enter'
207
- });
208
- });
209
- export var placeholder = mem(function (init) {
210
- return from({
211
- content: init.content,
212
- tooltipDescription: init.tooltipDescription,
213
- disabled: init.disabled,
214
- name: 'placeholder text',
215
- Icon: function Icon() {
216
- return jsx(PlaceholderTextIcon, {
217
- label: ""
218
- });
219
- }
220
- });
221
- });
222
- export var status = mem(function (init) {
223
- return from({
224
- content: init.content,
225
- tooltipDescription: init.tooltipDescription,
226
- disabled: init.disabled,
227
- name: 'status',
228
- Icon: StatusIcon
229
- });
230
- });
231
- export var more = mem(function (init) {
232
- return from({
233
- content: init.content,
234
- tooltipDescription: init.tooltipDescription,
235
- disabled: init.disabled,
236
- name: 'macro',
237
- Icon: function Icon() {
238
- return jsx(EditorMoreIcon, {
239
- label: ""
240
- });
241
- }
242
- });
243
- });
@@ -1 +0,0 @@
1
- export { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
@@ -1,13 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- export var shallowEquals = function shallowEquals(_ref, _ref2) {
3
- var _ref3 = _slicedToArray(_ref, 1),
4
- aRaw = _ref3[0];
5
- var _ref4 = _slicedToArray(_ref2, 1),
6
- bRaw = _ref4[0];
7
- var a = aRaw;
8
- var b = bRaw;
9
- return !Object.keys(a).some(function (key) {
10
- var k = key;
11
- return a[k] !== b[k];
12
- });
13
- };
@@ -1,24 +0,0 @@
1
- var endPositionNames = ['macro-browser', 'slash-onboarding'];
2
- var isMacro = function isMacro(item) {
3
- return typeof item.content === 'string' && item.content.includes('macro');
4
- };
5
- export var sortItems = function sortItems(items) {
6
- return items.sort(function (a, b) {
7
- if (endPositionNames.includes(a.value.name) && endPositionNames.includes(b.value.name)) {
8
- return endPositionNames.indexOf(a.value.name) - endPositionNames.indexOf(b.value.name);
9
- }
10
- if (endPositionNames.includes(b.value.name)) {
11
- return -1;
12
- }
13
- if (endPositionNames.includes(a.value.name)) {
14
- return 1;
15
- }
16
- if (isMacro(a) && !isMacro(b)) {
17
- return 1;
18
- }
19
- if (isMacro(b) && !isMacro(a)) {
20
- return -1;
21
- }
22
- return a.content < b.content ? -1 : 1;
23
- });
24
- };
@@ -1,4 +0,0 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject;
3
- import { css } from '@emotion/react';
4
- export var triggerWrapper = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n width: 42px;\n\n display: flex;\n align-items: center;\n\n > div,\n > span {\n display: flex;\n }\n\n > div > div {\n display: flex;\n }\n"])));
@@ -1,83 +0,0 @@
1
- import React from 'react';
2
- import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
3
- import ToolbarListsIndentation from './ui';
4
- import { ToolbarSize } from '../../ui/Toolbar/types';
5
- import { getIndentationButtonsState } from './pm-plugins/indentation-buttons';
6
- var toolbarListsIndentationPlugin = function toolbarListsIndentationPlugin(_ref) {
7
- var _api$featureFlags;
8
- var config = _ref.config,
9
- api = _ref.api;
10
- var _ref2 = config !== null && config !== void 0 ? config : {},
11
- _ref2$showIndentation = _ref2.showIndentationButtons,
12
- showIndentationButtons = _ref2$showIndentation === void 0 ? false : _ref2$showIndentation,
13
- _ref2$allowHeadingAnd = _ref2.allowHeadingAndParagraphIndentation,
14
- allowHeadingAndParagraphIndentation = _ref2$allowHeadingAnd === void 0 ? false : _ref2$allowHeadingAnd;
15
- var featureFlags = (api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
16
- return {
17
- name: 'toolbarListsIndentation',
18
- primaryToolbarComponent: function primaryToolbarComponent(_ref3) {
19
- var editorView = _ref3.editorView,
20
- popupsMountPoint = _ref3.popupsMountPoint,
21
- popupsBoundariesElement = _ref3.popupsBoundariesElement,
22
- popupsScrollableElement = _ref3.popupsScrollableElement,
23
- toolbarSize = _ref3.toolbarSize,
24
- disabled = _ref3.disabled,
25
- isToolbarReducedSpacing = _ref3.isToolbarReducedSpacing;
26
- var isSmall = toolbarSize < ToolbarSize.L;
27
- return /*#__PURE__*/React.createElement(PrimaryToolbarComponent, {
28
- featureFlags: featureFlags,
29
- popupsMountPoint: popupsMountPoint,
30
- popupsBoundariesElement: popupsBoundariesElement,
31
- popupsScrollableElement: popupsScrollableElement,
32
- isSmall: isSmall,
33
- isToolbarReducedSpacing: isToolbarReducedSpacing,
34
- disabled: disabled,
35
- editorView: editorView,
36
- showIndentationButtons: showIndentationButtons,
37
- pluginInjectionApi: api,
38
- allowHeadingAndParagraphIndentation: allowHeadingAndParagraphIndentation
39
- });
40
- }
41
- };
42
- };
43
- export function PrimaryToolbarComponent(_ref4) {
44
- var featureFlags = _ref4.featureFlags,
45
- popupsMountPoint = _ref4.popupsMountPoint,
46
- popupsBoundariesElement = _ref4.popupsBoundariesElement,
47
- popupsScrollableElement = _ref4.popupsScrollableElement,
48
- isSmall = _ref4.isSmall,
49
- isToolbarReducedSpacing = _ref4.isToolbarReducedSpacing,
50
- disabled = _ref4.disabled,
51
- editorView = _ref4.editorView,
52
- showIndentationButtons = _ref4.showIndentationButtons,
53
- pluginInjectionApi = _ref4.pluginInjectionApi,
54
- allowHeadingAndParagraphIndentation = _ref4.allowHeadingAndParagraphIndentation;
55
- var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['list', 'indentation', 'taskDecision']),
56
- listState = _useSharedPluginState.listState,
57
- indentationState = _useSharedPluginState.indentationState,
58
- taskDecisionState = _useSharedPluginState.taskDecisionState;
59
- var toolbarListsIndentationState = getIndentationButtonsState(editorView.state, allowHeadingAndParagraphIndentation, taskDecisionState, indentationState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.actions.isInsideListItem);
60
- if (!listState) {
61
- return null;
62
- }
63
- return /*#__PURE__*/React.createElement(ToolbarListsIndentation, {
64
- featureFlags: featureFlags,
65
- isSmall: isSmall,
66
- isReducedSpacing: isToolbarReducedSpacing,
67
- disabled: disabled,
68
- editorView: editorView,
69
- popupsMountPoint: popupsMountPoint,
70
- popupsBoundariesElement: popupsBoundariesElement,
71
- popupsScrollableElement: popupsScrollableElement,
72
- bulletListActive: listState.bulletListActive,
73
- bulletListDisabled: listState.bulletListDisabled,
74
- orderedListActive: listState.orderedListActive,
75
- orderedListDisabled: listState.orderedListDisabled,
76
- showIndentationButtons: !!showIndentationButtons,
77
- indentDisabled: toolbarListsIndentationState.indentDisabled,
78
- outdentDisabled: toolbarListsIndentationState.outdentDisabled,
79
- indentationStateNode: toolbarListsIndentationState === null || toolbarListsIndentationState === void 0 ? void 0 : toolbarListsIndentationState.node,
80
- pluginInjectionApi: pluginInjectionApi
81
- });
82
- }
83
- export default toolbarListsIndentationPlugin;
@@ -1,50 +0,0 @@
1
- import { hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
2
- import { getListItemAttributes } from '@atlaskit/editor-common/lists';
3
- import { MAX_INDENTATION_LEVEL } from '@atlaskit/editor-common/indentation';
4
- export function getIndentationButtonsState(editorState, allowHeadingAndParagraphIndentation, taskDecisionState, indentationState, isInsideListItem) {
5
- var _indentationState$isI;
6
- var state = {
7
- indentDisabled: true,
8
- outdentDisabled: true,
9
- node: null
10
- };
11
- var selection = editorState.selection;
12
-
13
- // Handle bullet and numbered lists seperately as they do
14
- // not use the indentation mark.
15
- // Check for lists before paragraphs and headings in case
16
- // the selection is in a list nested in a layout column.
17
- if (isInsideListItem !== null && isInsideListItem !== void 0 && isInsideListItem(editorState.tr)) {
18
- var _getListItemAttribute = getListItemAttributes(selection.$head),
19
- indentLevel = _getListItemAttribute.indentLevel,
20
- itemIndex = _getListItemAttribute.itemIndex;
21
- return {
22
- // List indent levels are zero indexed so we need to subtract 1
23
- indentDisabled: itemIndex === 0 || indentLevel >= MAX_INDENTATION_LEVEL - 1,
24
- outdentDisabled: false,
25
- node: 'list'
26
- };
27
- }
28
-
29
- // Handle tasks seperately as they do not use the indentation mark
30
- // and have different behaviour for outdent compared to lists
31
- if (taskDecisionState !== null && taskDecisionState !== void 0 && taskDecisionState.isInsideTask) {
32
- return {
33
- indentDisabled: taskDecisionState.indentDisabled,
34
- outdentDisabled: taskDecisionState.outdentDisabled,
35
- node: 'taskList'
36
- };
37
- }
38
- var isTopLevelParagraphOrHeading = selection.$from.depth === 1;
39
- var isInLayoutNode = hasParentNodeOfType(editorState.schema.nodes.layoutColumn)(selection) &&
40
- // depth of non-nested paragraphs and headings in layouts will always be 3
41
- selection.$from.depth === 3;
42
- if (allowHeadingAndParagraphIndentation && ((_indentationState$isI = indentationState === null || indentationState === void 0 ? void 0 : indentationState.isIndentationAllowed) !== null && _indentationState$isI !== void 0 ? _indentationState$isI : false) && (isTopLevelParagraphOrHeading || isInLayoutNode) && indentationState) {
43
- return {
44
- indentDisabled: indentationState.indentDisabled,
45
- outdentDisabled: indentationState.outdentDisabled,
46
- node: 'paragraph_heading'
47
- };
48
- }
49
- return state;
50
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,124 +0,0 @@
1
- /** @jsx jsx */
2
- import { jsx } from '@emotion/react';
3
- import { useIntl } from 'react-intl-next';
4
- import BulletListIcon from '@atlaskit/icon/glyph/editor/bullet-list';
5
- import NumberListIcon from '@atlaskit/icon/glyph/editor/number-list';
6
- import IndentIcon from '@atlaskit/icon/glyph/editor/indent';
7
- import OutdentIcon from '@atlaskit/icon/glyph/editor/outdent';
8
- import { toggleBulletList as toggleBulletListKeymap, toggleOrderedList as toggleOrderedListKeymap, indent as toggleIndentKeymap, outdent as toggleOutdentKeymap, ToolTipContent, tooltip } from '../../../keymaps';
9
- import ToolbarButton, { TOOLBAR_BUTTON } from '../../../ui/ToolbarButton';
10
- import { listMessages as messages, indentationMessages } from '@atlaskit/editor-common/messages';
11
- import { separatorStyles, buttonGroupStyle } from '@atlaskit/editor-common/styles';
12
- import { getAriaKeyshortcuts } from '@atlaskit/editor-common/keymaps';
13
- import { useEffect, useRef } from 'react';
14
- export function Toolbar(props) {
15
- var _useIntl = useIntl(),
16
- formatMessage = _useIntl.formatMessage;
17
- var indentButtonRef = useRef(null);
18
- var outdentButtonRef = useRef(null);
19
- var disabled = props.disabled,
20
- isReducedSpacing = props.isReducedSpacing,
21
- bulletListActive = props.bulletListActive,
22
- bulletListDisabled = props.bulletListDisabled,
23
- orderedListActive = props.orderedListActive,
24
- orderedListDisabled = props.orderedListDisabled,
25
- showIndentationButtons = props.showIndentationButtons,
26
- indentDisabled = props.indentDisabled,
27
- outdentDisabled = props.outdentDisabled,
28
- onItemActivated = props.onItemActivated;
29
- var labelUnorderedList = formatMessage(messages.unorderedList);
30
- var labelOrderedList = formatMessage(messages.orderedList);
31
- var indentMessage = formatMessage(indentationMessages.indent);
32
- var outdentMessage = formatMessage(indentationMessages.outdent);
33
- var isIndentButtonFocused = document.activeElement === indentButtonRef.current;
34
- var isOutdentButtonFocused = document.activeElement === outdentButtonRef.current;
35
- var handleOnItemActivated = function handleOnItemActivated(buttonName) {
36
- return function (event) {
37
- return onItemActivated({
38
- editorView: props.editorView,
39
- buttonName: buttonName
40
- });
41
- };
42
- };
43
- useEffect(function () {
44
- if (isIndentButtonFocused && indentDisabled && outdentButtonRef.current) {
45
- outdentButtonRef.current.focus();
46
- }
47
- }, [indentButtonRef, indentDisabled, isIndentButtonFocused]);
48
- useEffect(function () {
49
- if (isOutdentButtonFocused && outdentDisabled && indentButtonRef.current) {
50
- indentButtonRef.current.focus();
51
- }
52
- }, [outdentButtonRef, outdentDisabled, isOutdentButtonFocused]);
53
- return jsx("span", {
54
- css: buttonGroupStyle
55
- }, jsx(ToolbarButton, {
56
- buttonId: TOOLBAR_BUTTON.BULLET_LIST,
57
- testId: labelUnorderedList,
58
- spacing: isReducedSpacing ? 'none' : 'default',
59
- onClick: handleOnItemActivated('bullet_list'),
60
- selected: bulletListActive,
61
- "aria-pressed": bulletListActive,
62
- "aria-label": tooltip(toggleBulletListKeymap, labelUnorderedList),
63
- "aria-keyshortcuts": getAriaKeyshortcuts(toggleBulletListKeymap),
64
- disabled: bulletListDisabled || disabled,
65
- title: jsx(ToolTipContent, {
66
- description: labelUnorderedList,
67
- keymap: toggleBulletListKeymap
68
- }),
69
- iconBefore: jsx(BulletListIcon, {
70
- label: ""
71
- })
72
- }), jsx(ToolbarButton, {
73
- buttonId: TOOLBAR_BUTTON.ORDERED_LIST,
74
- testId: labelOrderedList,
75
- spacing: isReducedSpacing ? 'none' : 'default',
76
- onClick: handleOnItemActivated('ordered_list'),
77
- selected: orderedListActive,
78
- "aria-pressed": orderedListActive,
79
- "aria-label": tooltip(toggleOrderedListKeymap, labelOrderedList),
80
- "aria-keyshortcuts": getAriaKeyshortcuts(toggleOrderedListKeymap),
81
- disabled: orderedListDisabled || disabled,
82
- title: jsx(ToolTipContent, {
83
- description: labelOrderedList,
84
- keymap: toggleOrderedListKeymap
85
- }),
86
- iconBefore: jsx(NumberListIcon, {
87
- label: ""
88
- })
89
- }), showIndentationButtons && jsx(ToolbarButton, {
90
- buttonId: TOOLBAR_BUTTON.OUTDENT,
91
- testId: TOOLBAR_BUTTON.OUTDENT,
92
- ref: outdentButtonRef,
93
- spacing: isReducedSpacing ? 'none' : 'default',
94
- onClick: handleOnItemActivated('outdent'),
95
- iconBefore: jsx(OutdentIcon, {
96
- label: ""
97
- }),
98
- disabled: outdentDisabled || disabled,
99
- "aria-label": tooltip(toggleOutdentKeymap, outdentMessage),
100
- "aria-keyshortcuts": getAriaKeyshortcuts(toggleOutdentKeymap),
101
- title: jsx(ToolTipContent, {
102
- description: outdentMessage,
103
- keymap: toggleOutdentKeymap
104
- })
105
- }), showIndentationButtons && jsx(ToolbarButton, {
106
- buttonId: TOOLBAR_BUTTON.INDENT,
107
- testId: TOOLBAR_BUTTON.INDENT,
108
- ref: indentButtonRef,
109
- spacing: isReducedSpacing ? 'none' : 'default',
110
- onClick: handleOnItemActivated('indent'),
111
- iconBefore: jsx(IndentIcon, {
112
- label: ""
113
- }),
114
- disabled: indentDisabled || disabled,
115
- "aria-label": tooltip(toggleIndentKeymap, indentMessage),
116
- "aria-keyshortcuts": getAriaKeyshortcuts(toggleIndentKeymap),
117
- title: jsx(ToolTipContent, {
118
- description: indentMessage,
119
- keymap: toggleIndentKeymap
120
- })
121
- }), jsx("span", {
122
- css: separatorStyles
123
- }));
124
- }