@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,201 +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
- const from = init => ({
27
- content: init.content,
28
- tooltipDescription: init.tooltipDescription,
29
- value: {
30
- name: init.name
31
- },
32
- elemBefore: jsx(init.Icon, {
33
- label: init.content
34
- }),
35
- elemAfter: init.shortcut ? jsx("div", {
36
- css: shortcutStyle
37
- }, init.shortcut) : undefined,
38
- 'aria-label': init.shortcut ? init.content + ' ' + init.shortcut : init.content,
39
- 'aria-haspopup': init['aria-haspopup'],
40
- 'aria-keyshortcuts': init['aria-keyshortcuts'],
41
- shortcut: init.shortcut,
42
- isDisabled: init.disabled
43
- });
44
- const mem = fn => memoizeOne(fn, shallowEquals);
45
- export const action = mem(init => {
46
- return from({
47
- content: init.content,
48
- tooltipDescription: init.tooltipDescription,
49
- disabled: init.disabled,
50
- name: 'action',
51
- shortcut: '[]',
52
- Icon: TaskIcon,
53
- 'aria-keyshortcuts': '[ ] Space'
54
- });
55
- });
56
- export const link = mem(init => from({
57
- content: init.content,
58
- tooltipDescription: init.tooltipDescription,
59
- disabled: init.disabled,
60
- name: 'link',
61
- shortcut: tooltip(addLink),
62
- Icon: LinkIcon,
63
- 'aria-haspopup': init['aria-haspopup'],
64
- 'aria-keyshortcuts': getAriaKeyshortcuts(addLink)
65
- }));
66
- export const media = mem(init => from({
67
- content: init.content,
68
- tooltipDescription: init.tooltipDescription,
69
- disabled: init.disabled,
70
- name: 'media',
71
- Icon: EditorImageIcon
72
- }));
73
- export const imageUpload = mem(init => from({
74
- content: init.content,
75
- tooltipDescription: init.tooltipDescription,
76
- disabled: init.disabled,
77
- name: 'image upload',
78
- Icon: EditorImageIcon
79
- }));
80
- export const mention = mem(init => from({
81
- content: init.content,
82
- tooltipDescription: init.tooltipDescription,
83
- disabled: init.disabled,
84
- name: 'mention',
85
- Icon: MentionIcon,
86
- shortcut: '@',
87
- 'aria-haspopup': init['aria-haspopup'],
88
- 'aria-keyshortcuts': 'Shift+2 Space'
89
- }));
90
- export const emoji = mem(init => from({
91
- content: init.content,
92
- tooltipDescription: init.tooltipDescription,
93
- disabled: init.disabled,
94
- name: 'emoji',
95
- Icon: EmojiIcon,
96
- shortcut: ':',
97
- 'aria-haspopup': init['aria-haspopup'],
98
- 'aria-keyshortcuts': 'Shift+;'
99
- }));
100
- export const table = mem(init => from({
101
- content: init.content,
102
- tooltipDescription: init.tooltipDescription,
103
- disabled: init.disabled,
104
- name: 'table',
105
- Icon: TableIcon,
106
- shortcut: tooltip(toggleTable),
107
- 'aria-keyshortcuts': getAriaKeyshortcuts(toggleTable)
108
- }));
109
- export const layout = mem(init => from({
110
- content: init.content,
111
- tooltipDescription: init.tooltipDescription,
112
- disabled: init.disabled,
113
- name: 'layout',
114
- Icon: LayoutTwoEqualIcon
115
- }));
116
- export const codeblock = mem(init => from({
117
- content: init.content,
118
- tooltipDescription: init.tooltipDescription,
119
- disabled: init.disabled,
120
- name: 'codeblock',
121
- Icon: CodeIcon,
122
- shortcut: init.shortcut,
123
- 'aria-keyshortcuts': getAriaKeyshortcuts(init.shortcut)
124
- }));
125
- export const panel = mem(init => from({
126
- content: init.content,
127
- tooltipDescription: init.tooltipDescription,
128
- disabled: init.disabled,
129
- name: 'panel',
130
- Icon: InfoIcon,
131
- shortcut: init.shortcut,
132
- 'aria-keyshortcuts': getAriaKeyshortcuts(init.shortcut)
133
- }));
134
- export const blockquote = mem(init => from({
135
- content: init.content,
136
- tooltipDescription: init.tooltipDescription,
137
- disabled: init.disabled,
138
- name: 'blockquote',
139
- Icon: QuoteIcon,
140
- shortcut: init.shortcut,
141
- 'aria-keyshortcuts': 'Shift+. Space'
142
- }));
143
- export const decision = mem(init => from({
144
- content: init.content,
145
- tooltipDescription: init.tooltipDescription,
146
- disabled: init.disabled,
147
- name: 'decision',
148
- Icon: DecisionIcon,
149
- shortcut: '<>',
150
- 'aria-keyshortcuts': 'Shift+, Shift+. Space'
151
- }));
152
- export const horizontalrule = mem(init => from({
153
- content: init.content,
154
- tooltipDescription: init.tooltipDescription,
155
- disabled: init.disabled,
156
- name: 'horizontalrule',
157
- Icon: HorizontalRuleIcon,
158
- shortcut: '---',
159
- 'aria-keyshortcuts': '- - -'
160
- }));
161
- export const expand = mem(init => from({
162
- content: init.content,
163
- tooltipDescription: init.tooltipDescription,
164
- disabled: init.disabled,
165
- name: 'expand',
166
- Icon: ExpandNodeIcon
167
- }));
168
- export const date = mem(init => from({
169
- content: init.content,
170
- tooltipDescription: init.tooltipDescription,
171
- disabled: init.disabled,
172
- name: 'date',
173
- Icon: DateIcon,
174
- shortcut: '//',
175
- 'aria-keyshortcuts': '/ / Enter'
176
- }));
177
- export const placeholder = mem(init => from({
178
- content: init.content,
179
- tooltipDescription: init.tooltipDescription,
180
- disabled: init.disabled,
181
- name: 'placeholder text',
182
- Icon: () => jsx(PlaceholderTextIcon, {
183
- label: ""
184
- })
185
- }));
186
- export const status = mem(init => from({
187
- content: init.content,
188
- tooltipDescription: init.tooltipDescription,
189
- disabled: init.disabled,
190
- name: 'status',
191
- Icon: StatusIcon
192
- }));
193
- export const more = mem(init => from({
194
- content: init.content,
195
- tooltipDescription: init.tooltipDescription,
196
- disabled: init.disabled,
197
- name: 'macro',
198
- Icon: () => jsx(EditorMoreIcon, {
199
- label: ""
200
- })
201
- }));
@@ -1 +0,0 @@
1
- export { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
@@ -1,8 +0,0 @@
1
- export const shallowEquals = ([aRaw], [bRaw]) => {
2
- const a = aRaw;
3
- const b = bRaw;
4
- return !Object.keys(a).some(key => {
5
- const k = key;
6
- return a[k] !== b[k];
7
- });
8
- };
@@ -1,22 +0,0 @@
1
- const endPositionNames = ['macro-browser', 'slash-onboarding'];
2
- const isMacro = item => typeof item.content === 'string' && item.content.includes('macro');
3
- export const sortItems = items => {
4
- return items.sort((a, b) => {
5
- if (endPositionNames.includes(a.value.name) && endPositionNames.includes(b.value.name)) {
6
- return endPositionNames.indexOf(a.value.name) - endPositionNames.indexOf(b.value.name);
7
- }
8
- if (endPositionNames.includes(b.value.name)) {
9
- return -1;
10
- }
11
- if (endPositionNames.includes(a.value.name)) {
12
- return 1;
13
- }
14
- if (isMacro(a) && !isMacro(b)) {
15
- return 1;
16
- }
17
- if (isMacro(b) && !isMacro(a)) {
18
- return -1;
19
- }
20
- return a.content < b.content ? -1 : 1;
21
- });
22
- };
@@ -1,16 +0,0 @@
1
- import { css } from '@emotion/react';
2
- export const triggerWrapper = css`
3
- width: 42px;
4
-
5
- display: flex;
6
- align-items: center;
7
-
8
- > div,
9
- > span {
10
- display: flex;
11
- }
12
-
13
- > div > div {
14
- display: flex;
15
- }
16
- `;
@@ -1,86 +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
- const toolbarListsIndentationPlugin = ({
7
- config,
8
- api
9
- }) => {
10
- var _api$featureFlags;
11
- const {
12
- showIndentationButtons = false,
13
- allowHeadingAndParagraphIndentation = false
14
- } = config !== null && config !== void 0 ? config : {};
15
- const featureFlags = (api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState()) || {};
16
- return {
17
- name: 'toolbarListsIndentation',
18
- primaryToolbarComponent({
19
- editorView,
20
- popupsMountPoint,
21
- popupsBoundariesElement,
22
- popupsScrollableElement,
23
- toolbarSize,
24
- disabled,
25
- isToolbarReducedSpacing
26
- }) {
27
- const isSmall = toolbarSize < ToolbarSize.L;
28
- return /*#__PURE__*/React.createElement(PrimaryToolbarComponent, {
29
- featureFlags: featureFlags,
30
- popupsMountPoint: popupsMountPoint,
31
- popupsBoundariesElement: popupsBoundariesElement,
32
- popupsScrollableElement: popupsScrollableElement,
33
- isSmall: isSmall,
34
- isToolbarReducedSpacing: isToolbarReducedSpacing,
35
- disabled: disabled,
36
- editorView: editorView,
37
- showIndentationButtons: showIndentationButtons,
38
- pluginInjectionApi: api,
39
- allowHeadingAndParagraphIndentation: allowHeadingAndParagraphIndentation
40
- });
41
- }
42
- };
43
- };
44
- export function PrimaryToolbarComponent({
45
- featureFlags,
46
- popupsMountPoint,
47
- popupsBoundariesElement,
48
- popupsScrollableElement,
49
- isSmall,
50
- isToolbarReducedSpacing,
51
- disabled,
52
- editorView,
53
- showIndentationButtons,
54
- pluginInjectionApi,
55
- allowHeadingAndParagraphIndentation
56
- }) {
57
- const {
58
- listState,
59
- indentationState,
60
- taskDecisionState
61
- } = useSharedPluginState(pluginInjectionApi, ['list', 'indentation', 'taskDecision']);
62
- const toolbarListsIndentationState = getIndentationButtonsState(editorView.state, allowHeadingAndParagraphIndentation, taskDecisionState, indentationState, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.list.actions.isInsideListItem);
63
- if (!listState) {
64
- return null;
65
- }
66
- return /*#__PURE__*/React.createElement(ToolbarListsIndentation, {
67
- featureFlags: featureFlags,
68
- isSmall: isSmall,
69
- isReducedSpacing: isToolbarReducedSpacing,
70
- disabled: disabled,
71
- editorView: editorView,
72
- popupsMountPoint: popupsMountPoint,
73
- popupsBoundariesElement: popupsBoundariesElement,
74
- popupsScrollableElement: popupsScrollableElement,
75
- bulletListActive: listState.bulletListActive,
76
- bulletListDisabled: listState.bulletListDisabled,
77
- orderedListActive: listState.orderedListActive,
78
- orderedListDisabled: listState.orderedListDisabled,
79
- showIndentationButtons: !!showIndentationButtons,
80
- indentDisabled: toolbarListsIndentationState.indentDisabled,
81
- outdentDisabled: toolbarListsIndentationState.outdentDisabled,
82
- indentationStateNode: toolbarListsIndentationState === null || toolbarListsIndentationState === void 0 ? void 0 : toolbarListsIndentationState.node,
83
- pluginInjectionApi: pluginInjectionApi
84
- });
85
- }
86
- export default toolbarListsIndentationPlugin;
@@ -1,53 +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
- const state = {
7
- indentDisabled: true,
8
- outdentDisabled: true,
9
- node: null
10
- };
11
- const {
12
- selection
13
- } = editorState;
14
-
15
- // Handle bullet and numbered lists seperately as they do
16
- // not use the indentation mark.
17
- // Check for lists before paragraphs and headings in case
18
- // the selection is in a list nested in a layout column.
19
- if (isInsideListItem !== null && isInsideListItem !== void 0 && isInsideListItem(editorState.tr)) {
20
- const {
21
- indentLevel,
22
- itemIndex
23
- } = getListItemAttributes(selection.$head);
24
- return {
25
- // List indent levels are zero indexed so we need to subtract 1
26
- indentDisabled: itemIndex === 0 || indentLevel >= MAX_INDENTATION_LEVEL - 1,
27
- outdentDisabled: false,
28
- node: 'list'
29
- };
30
- }
31
-
32
- // Handle tasks seperately as they do not use the indentation mark
33
- // and have different behaviour for outdent compared to lists
34
- if (taskDecisionState !== null && taskDecisionState !== void 0 && taskDecisionState.isInsideTask) {
35
- return {
36
- indentDisabled: taskDecisionState.indentDisabled,
37
- outdentDisabled: taskDecisionState.outdentDisabled,
38
- node: 'taskList'
39
- };
40
- }
41
- const isTopLevelParagraphOrHeading = selection.$from.depth === 1;
42
- const isInLayoutNode = hasParentNodeOfType(editorState.schema.nodes.layoutColumn)(selection) &&
43
- // depth of non-nested paragraphs and headings in layouts will always be 3
44
- selection.$from.depth === 3;
45
- if (allowHeadingAndParagraphIndentation && ((_indentationState$isI = indentationState === null || indentationState === void 0 ? void 0 : indentationState.isIndentationAllowed) !== null && _indentationState$isI !== void 0 ? _indentationState$isI : false) && (isTopLevelParagraphOrHeading || isInLayoutNode) && indentationState) {
46
- return {
47
- indentDisabled: indentationState.indentDisabled,
48
- outdentDisabled: indentationState.outdentDisabled,
49
- node: 'paragraph_heading'
50
- };
51
- }
52
- return state;
53
- }
@@ -1,123 +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
- const {
16
- formatMessage
17
- } = useIntl();
18
- const indentButtonRef = useRef(null);
19
- const outdentButtonRef = useRef(null);
20
- const {
21
- disabled,
22
- isReducedSpacing,
23
- bulletListActive,
24
- bulletListDisabled,
25
- orderedListActive,
26
- orderedListDisabled,
27
- showIndentationButtons,
28
- indentDisabled,
29
- outdentDisabled,
30
- onItemActivated
31
- } = props;
32
- const labelUnorderedList = formatMessage(messages.unorderedList);
33
- const labelOrderedList = formatMessage(messages.orderedList);
34
- const indentMessage = formatMessage(indentationMessages.indent);
35
- const outdentMessage = formatMessage(indentationMessages.outdent);
36
- const isIndentButtonFocused = document.activeElement === indentButtonRef.current;
37
- const isOutdentButtonFocused = document.activeElement === outdentButtonRef.current;
38
- const handleOnItemActivated = buttonName => event => onItemActivated({
39
- editorView: props.editorView,
40
- buttonName
41
- });
42
- useEffect(() => {
43
- if (isIndentButtonFocused && indentDisabled && outdentButtonRef.current) {
44
- outdentButtonRef.current.focus();
45
- }
46
- }, [indentButtonRef, indentDisabled, isIndentButtonFocused]);
47
- useEffect(() => {
48
- if (isOutdentButtonFocused && outdentDisabled && indentButtonRef.current) {
49
- indentButtonRef.current.focus();
50
- }
51
- }, [outdentButtonRef, outdentDisabled, isOutdentButtonFocused]);
52
- return jsx("span", {
53
- css: buttonGroupStyle
54
- }, jsx(ToolbarButton, {
55
- buttonId: TOOLBAR_BUTTON.BULLET_LIST,
56
- testId: labelUnorderedList,
57
- spacing: isReducedSpacing ? 'none' : 'default',
58
- onClick: handleOnItemActivated('bullet_list'),
59
- selected: bulletListActive,
60
- "aria-pressed": bulletListActive,
61
- "aria-label": tooltip(toggleBulletListKeymap, labelUnorderedList),
62
- "aria-keyshortcuts": getAriaKeyshortcuts(toggleBulletListKeymap),
63
- disabled: bulletListDisabled || disabled,
64
- title: jsx(ToolTipContent, {
65
- description: labelUnorderedList,
66
- keymap: toggleBulletListKeymap
67
- }),
68
- iconBefore: jsx(BulletListIcon, {
69
- label: ""
70
- })
71
- }), jsx(ToolbarButton, {
72
- buttonId: TOOLBAR_BUTTON.ORDERED_LIST,
73
- testId: labelOrderedList,
74
- spacing: isReducedSpacing ? 'none' : 'default',
75
- onClick: handleOnItemActivated('ordered_list'),
76
- selected: orderedListActive,
77
- "aria-pressed": orderedListActive,
78
- "aria-label": tooltip(toggleOrderedListKeymap, labelOrderedList),
79
- "aria-keyshortcuts": getAriaKeyshortcuts(toggleOrderedListKeymap),
80
- disabled: orderedListDisabled || disabled,
81
- title: jsx(ToolTipContent, {
82
- description: labelOrderedList,
83
- keymap: toggleOrderedListKeymap
84
- }),
85
- iconBefore: jsx(NumberListIcon, {
86
- label: ""
87
- })
88
- }), showIndentationButtons && jsx(ToolbarButton, {
89
- buttonId: TOOLBAR_BUTTON.OUTDENT,
90
- testId: TOOLBAR_BUTTON.OUTDENT,
91
- ref: outdentButtonRef,
92
- spacing: isReducedSpacing ? 'none' : 'default',
93
- onClick: handleOnItemActivated('outdent'),
94
- iconBefore: jsx(OutdentIcon, {
95
- label: ""
96
- }),
97
- disabled: outdentDisabled || disabled,
98
- "aria-label": tooltip(toggleOutdentKeymap, outdentMessage),
99
- "aria-keyshortcuts": getAriaKeyshortcuts(toggleOutdentKeymap),
100
- title: jsx(ToolTipContent, {
101
- description: outdentMessage,
102
- keymap: toggleOutdentKeymap
103
- })
104
- }), showIndentationButtons && jsx(ToolbarButton, {
105
- buttonId: TOOLBAR_BUTTON.INDENT,
106
- testId: TOOLBAR_BUTTON.INDENT,
107
- ref: indentButtonRef,
108
- spacing: isReducedSpacing ? 'none' : 'default',
109
- onClick: handleOnItemActivated('indent'),
110
- iconBefore: jsx(IndentIcon, {
111
- label: ""
112
- }),
113
- disabled: indentDisabled || disabled,
114
- "aria-label": tooltip(toggleIndentKeymap, indentMessage),
115
- "aria-keyshortcuts": getAriaKeyshortcuts(toggleIndentKeymap),
116
- title: jsx(ToolTipContent, {
117
- description: indentMessage,
118
- keymap: toggleIndentKeymap
119
- })
120
- }), jsx("span", {
121
- css: separatorStyles
122
- }));
123
- }
@@ -1,158 +0,0 @@
1
- /** @jsx jsx */
2
- import { jsx } from '@emotion/react';
3
- import React from 'react';
4
- import { useIntl } from 'react-intl-next';
5
- import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
6
- import BulletListIcon from '@atlaskit/icon/glyph/editor/bullet-list';
7
- import { toggleBulletList as toggleBulletListKeymap, toggleOrderedList as toggleOrderedListKeymap, indent as toggleIndentKeymap, outdent as toggleOutdentKeymap, tooltip } from '../../../keymaps';
8
- import { DropdownMenuWithKeyboardNavigation as DropdownMenu } from '@atlaskit/editor-common/ui-menu';
9
- import ToolbarButton from '../../../ui/ToolbarButton';
10
- import { shortcutStyle } from '../../../ui/styles';
11
- import { expandIconWrapperStyle } from '@atlaskit/editor-common/styles';
12
- import { wrapperStyle, separatorStyles } from '@atlaskit/editor-common/styles';
13
- import { listMessages, indentationMessages } from '@atlaskit/editor-common/messages';
14
- export function ToolbarDropdown(props) {
15
- const {
16
- formatMessage
17
- } = useIntl();
18
- const {
19
- disabled,
20
- isReducedSpacing,
21
- bulletListActive,
22
- orderedListActive,
23
- popupsMountPoint,
24
- popupsBoundariesElement,
25
- popupsScrollableElement,
26
- onItemActivated
27
- } = props;
28
- const [isDropdownOpen, setIsDropdownOpen] = React.useState(false);
29
- const [isOpenedByKeyboard, setOpenedByKeyboard] = React.useState(false);
30
- const labelLists = formatMessage(listMessages.lists);
31
- const onOpenChange = attrs => {
32
- setIsDropdownOpen(attrs.isDropdownOpen);
33
- };
34
- const handleTriggerClick = () => {
35
- onOpenChange({
36
- isDropdownOpen: !isDropdownOpen
37
- });
38
- };
39
- const handleOnKeyDown = event => {
40
- if (event.key === 'Enter' || event.key === ' ') {
41
- event.preventDefault();
42
- setIsDropdownOpen(!isDropdownOpen);
43
- setOpenedByKeyboard(true);
44
- }
45
- };
46
- const items = useItems(props);
47
- const handleOnItemActivated = ({
48
- item,
49
- shouldCloseMenu = true
50
- }) => {
51
- setIsDropdownOpen(!shouldCloseMenu);
52
- return onItemActivated({
53
- editorView: props.editorView,
54
- buttonName: item.value.name
55
- });
56
- };
57
- return jsx("span", {
58
- css: wrapperStyle
59
- }, jsx(DropdownMenu, {
60
- items: items,
61
- onItemActivated: handleOnItemActivated,
62
- mountTo: popupsMountPoint,
63
- boundariesElement: popupsBoundariesElement,
64
- scrollableElement: popupsScrollableElement,
65
- isOpen: isDropdownOpen,
66
- onOpenChange: onOpenChange,
67
- fitHeight: 188,
68
- fitWidth: 175,
69
- shouldUseDefaultRole: true,
70
- shouldFocusFirstItem: () => {
71
- if (isOpenedByKeyboard) {
72
- setOpenedByKeyboard(false);
73
- }
74
- return isOpenedByKeyboard;
75
- }
76
- }, jsx(ToolbarButton, {
77
- spacing: isReducedSpacing ? 'none' : 'default',
78
- selected: bulletListActive || orderedListActive,
79
- "aria-expanded": isDropdownOpen,
80
- "aria-haspopup": true,
81
- "aria-label": labelLists,
82
- disabled: disabled,
83
- onClick: handleTriggerClick,
84
- onKeyDown: handleOnKeyDown,
85
- title: labelLists,
86
- iconBefore: jsx("span", {
87
- css: wrapperStyle
88
- }, jsx(BulletListIcon, {
89
- label: labelLists
90
- }), jsx("span", {
91
- css: expandIconWrapperStyle
92
- }, jsx(ExpandIcon, {
93
- label: ""
94
- })))
95
- })), jsx("span", {
96
- css: separatorStyles
97
- }));
98
- }
99
- function useItems(props) {
100
- const {
101
- formatMessage
102
- } = useIntl();
103
- const labelUnorderedList = formatMessage(listMessages.unorderedList);
104
- const labelOrderedList = formatMessage(listMessages.orderedList);
105
- let items = [{
106
- key: 'unorderedList',
107
- content: labelUnorderedList,
108
- value: {
109
- name: 'bullet_list'
110
- },
111
- isDisabled: props.bulletListDisabled,
112
- isActive: Boolean(props.bulletListActive),
113
- elemAfter: jsx("div", {
114
- css: shortcutStyle
115
- }, tooltip(toggleBulletListKeymap))
116
- }, {
117
- key: 'orderedList',
118
- content: labelOrderedList,
119
- value: {
120
- name: 'ordered_list'
121
- },
122
- isDisabled: props.orderedListDisabled,
123
- isActive: Boolean(props.orderedListActive),
124
- elemAfter: jsx("div", {
125
- css: shortcutStyle
126
- }, tooltip(toggleOrderedListKeymap))
127
- }];
128
- if (props.showIndentationButtons) {
129
- const labelIndent = formatMessage(indentationMessages.indent);
130
- const labelOutdent = formatMessage(indentationMessages.outdent);
131
- items.push({
132
- key: 'outdent',
133
- content: labelOutdent,
134
- value: {
135
- name: 'outdent'
136
- },
137
- isDisabled: props.outdentDisabled,
138
- isActive: false,
139
- elemAfter: jsx("div", {
140
- css: shortcutStyle
141
- }, tooltip(toggleOutdentKeymap))
142
- }, {
143
- key: 'indent',
144
- content: labelIndent,
145
- value: {
146
- name: 'indent'
147
- },
148
- isDisabled: props.indentDisabled,
149
- isActive: false,
150
- elemAfter: jsx("div", {
151
- css: shortcutStyle
152
- }, tooltip(toggleIndentKeymap))
153
- });
154
- }
155
- return [{
156
- items
157
- }];
158
- }