@atlaskit/editor-core 189.4.0 → 189.4.1

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 (93) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/cjs/plugins/index.js +0 -7
  3. package/dist/cjs/presets/universal.js +2 -1
  4. package/dist/cjs/version-wrapper.js +1 -1
  5. package/dist/es2019/plugins/index.js +0 -1
  6. package/dist/es2019/presets/universal.js +2 -1
  7. package/dist/es2019/version-wrapper.js +1 -1
  8. package/dist/esm/plugins/index.js +0 -1
  9. package/dist/esm/presets/universal.js +2 -1
  10. package/dist/esm/version-wrapper.js +1 -1
  11. package/dist/types/plugins/index.d.ts +0 -1
  12. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  13. package/package.json +2 -1
  14. package/dist/cjs/plugins/insert-block/index.js +0 -165
  15. package/dist/cjs/plugins/insert-block/types.js +0 -5
  16. package/dist/cjs/plugins/insert-block/ui/ElementBrowser/InsertMenu.js +0 -152
  17. package/dist/cjs/plugins/insert-block/ui/ElementBrowser/types.js +0 -5
  18. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +0 -42
  19. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +0 -42
  20. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +0 -66
  21. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +0 -217
  22. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +0 -49
  23. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/index.js +0 -565
  24. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/item.js +0 -250
  25. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/messages.js +0 -12
  26. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/shallow-equals.js +0 -20
  27. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/sort-items.js +0 -30
  28. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/styles.js +0 -11
  29. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/types.js +0 -5
  30. package/dist/es2019/plugins/insert-block/index.js +0 -159
  31. package/dist/es2019/plugins/insert-block/types.js +0 -1
  32. package/dist/es2019/plugins/insert-block/ui/ElementBrowser/InsertMenu.js +0 -150
  33. package/dist/es2019/plugins/insert-block/ui/ElementBrowser/types.js +0 -1
  34. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +0 -35
  35. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +0 -35
  36. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +0 -59
  37. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +0 -198
  38. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +0 -37
  39. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/index.js +0 -558
  40. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/item.js +0 -201
  41. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/messages.js +0 -1
  42. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/shallow-equals.js +0 -8
  43. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/sort-items.js +0 -22
  44. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/styles.js +0 -16
  45. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/types.js +0 -1
  46. package/dist/esm/plugins/insert-block/index.js +0 -158
  47. package/dist/esm/plugins/insert-block/types.js +0 -1
  48. package/dist/esm/plugins/insert-block/ui/ElementBrowser/InsertMenu.js +0 -146
  49. package/dist/esm/plugins/insert-block/ui/ElementBrowser/types.js +0 -1
  50. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.js +0 -35
  51. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +0 -35
  52. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.js +0 -59
  53. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/create-items.js +0 -210
  54. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +0 -41
  55. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/index.js +0 -560
  56. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/item.js +0 -243
  57. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/messages.js +0 -1
  58. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/shallow-equals.js +0 -13
  59. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/sort-items.js +0 -24
  60. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/styles.js +0 -4
  61. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/types.js +0 -1
  62. package/dist/types/plugins/insert-block/index.d.ts +0 -16
  63. package/dist/types/plugins/insert-block/types.d.ts +0 -45
  64. package/dist/types/plugins/insert-block/ui/ElementBrowser/InsertMenu.d.ts +0 -4
  65. package/dist/types/plugins/insert-block/ui/ElementBrowser/types.d.ts +0 -22
  66. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +0 -28
  67. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +0 -18
  68. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.d.ts +0 -30
  69. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/create-items.d.ts +0 -39
  70. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.d.ts +0 -16
  71. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/index.d.ts +0 -46
  72. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/item.d.ts +0 -34
  73. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/messages.d.ts +0 -1
  74. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/shallow-equals.d.ts +0 -1
  75. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/sort-items.d.ts +0 -2
  76. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/styles.d.ts +0 -1
  77. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +0 -59
  78. package/dist/types-ts4.5/plugins/insert-block/index.d.ts +0 -16
  79. package/dist/types-ts4.5/plugins/insert-block/types.d.ts +0 -45
  80. package/dist/types-ts4.5/plugins/insert-block/ui/ElementBrowser/InsertMenu.d.ts +0 -4
  81. package/dist/types-ts4.5/plugins/insert-block/ui/ElementBrowser/types.d.ts +0 -22
  82. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +0 -28
  83. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +0 -18
  84. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/block-insert-menu.d.ts +0 -30
  85. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/create-items.d.ts +0 -42
  86. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.d.ts +0 -16
  87. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/index.d.ts +0 -46
  88. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/item.d.ts +0 -34
  89. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/messages.d.ts +0 -1
  90. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/shallow-equals.d.ts +0 -1
  91. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/sort-items.d.ts +0 -2
  92. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/styles.d.ts +0 -1
  93. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/types.d.ts +0 -59
@@ -1,35 +0,0 @@
1
- import React from 'react';
2
- import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
3
- import { DropdownMenuWithKeyboardNavigation as DropdownMenu } from '@atlaskit/editor-common/ui-menu';
4
- import { DropDownButton } from './dropdown-button';
5
- export const BlockInsertMenuLegacy = props => {
6
- const {
7
- items
8
- } = props;
9
- const dropdownItems = React.useMemo(() => [{
10
- items
11
- }], [items]);
12
- return /*#__PURE__*/React.createElement(DropdownMenu, {
13
- items: dropdownItems,
14
- onItemActivated: props.onItemActivated,
15
- onOpenChange: props.onOpenChange,
16
- mountTo: props.popupsMountPoint,
17
- boundariesElement: props.popupsBoundariesElement,
18
- scrollableElement: props.popupsScrollableElement,
19
- isOpen: props.open,
20
- fitHeight: 188,
21
- fitWidth: 175,
22
- zIndex: akEditorMenuZIndex
23
- }, /*#__PURE__*/React.createElement(DropDownButton, {
24
- "aria-expanded": props.open,
25
- "aria-haspopup": true,
26
- handleRef: props.onRef,
27
- selected: props.open,
28
- disabled: props.disabled,
29
- onClick: props.onClick,
30
- onKeyDown: props.onKeyDown,
31
- spacing: props.spacing,
32
- label: props.label,
33
- "aria-keyshortcuts": "/"
34
- }));
35
- };
@@ -1,59 +0,0 @@
1
- import React from 'react';
2
- import { BlockInsertElementBrowser } from './block-insert-element-browser';
3
- import { BlockInsertMenuLegacy } from './block-insert-menu-legacy';
4
- import { DropDownButton } from './dropdown-button';
5
- export const BlockInsertMenu = props => {
6
- if (props.items.length === 0) {
7
- return null;
8
- }
9
- if (props.disabled) {
10
- return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(DropDownButton, {
11
- "aria-expanded": props.open,
12
- "aria-haspopup": true,
13
- handleRef: props.onRef,
14
- selected: props.open,
15
- disabled: props.disabled,
16
- onClick: props.onClick,
17
- onKeyDown: props.onKeyDown,
18
- spacing: props.spacing,
19
- label: props.label,
20
- "aria-keyshortcuts": "/"
21
- }));
22
- }
23
- if (props.replacePlusMenuWithElementBrowser) {
24
- return /*#__PURE__*/React.createElement(BlockInsertElementBrowser, {
25
- disabled: props.disabled,
26
- editorView: props.editorView,
27
- items: props.items,
28
- label: props.label,
29
- onClick: props.onClick,
30
- onKeyDown: props.onKeyDown,
31
- onInsert: props.onInsert,
32
- onRef: props.onPlusButtonRef,
33
- open: props.open,
34
- plusButtonRef: props.plusButtonRef,
35
- popupsBoundariesElement: props.popupsBoundariesElement,
36
- popupsMountPoint: props.popupsMountPoint,
37
- popupsScrollableElement: props.popupsScrollableElement,
38
- spacing: props.spacing,
39
- togglePlusMenuVisibility: props.togglePlusMenuVisibility,
40
- showElementBrowserLink: props.showElementBrowserLink,
41
- pluginInjectionApi: props.pluginInjectionApi
42
- });
43
- }
44
- return /*#__PURE__*/React.createElement(BlockInsertMenuLegacy, {
45
- disabled: props.disabled,
46
- items: props.items,
47
- label: props.label,
48
- onClick: props.onClick,
49
- onKeyDown: props.onKeyDown,
50
- onItemActivated: props.onItemActivated,
51
- onOpenChange: props.onOpenChange,
52
- onRef: props.onRef,
53
- open: props.open,
54
- popupsBoundariesElement: props.popupsBoundariesElement,
55
- popupsMountPoint: props.popupsMountPoint,
56
- popupsScrollableElement: props.popupsScrollableElement,
57
- spacing: props.spacing
58
- });
59
- };
@@ -1,198 +0,0 @@
1
- import React from 'react';
2
- import memoize from 'lodash/memoize';
3
- import memoizeOne from 'memoize-one';
4
- import { messages } from './messages';
5
- import { blockTypeMessages } from '@atlaskit/editor-common/messages';
6
- import { ToolTipContent } from '@atlaskit/editor-common/keymaps';
7
- import { sortItems } from './sort-items';
8
- import { action, link, media, mention, emoji, table, layout, codeblock, panel, blockquote, decision, horizontalrule, expand, date, placeholder, status, more, imageUpload } from './item';
9
- import { shallowEquals } from './shallow-equals';
10
- const buttonToItem = memoize(button => ({
11
- ...button,
12
- title: /*#__PURE__*/React.createElement(ToolTipContent, {
13
- description: button.content,
14
- shortcutOverride: button.shortcut
15
- })
16
- }));
17
- const buttonToDropdownItem = memoizeOne(title => memoize(button => ({
18
- ...button,
19
- title: /*#__PURE__*/React.createElement(ToolTipContent, {
20
- description: title,
21
- shortcutOverride: "/"
22
- })
23
- })));
24
- const createInsertBlockItems = config => {
25
- const {
26
- isTypeAheadAllowed,
27
- tableSupported,
28
- mediaUploadsEnabled,
29
- mediaSupported,
30
- imageUploadSupported,
31
- imageUploadEnabled,
32
- mentionsSupported,
33
- mentionsDisabled,
34
- availableWrapperBlockTypes,
35
- actionSupported,
36
- decisionSupported,
37
- showElementBrowserLink,
38
- linkSupported,
39
- linkDisabled,
40
- emojiDisabled,
41
- emojiProvider,
42
- nativeStatusSupported,
43
- insertMenuItems,
44
- dateEnabled,
45
- placeholderTextEnabled,
46
- horizontalRuleEnabled,
47
- layoutSectionEnabled,
48
- expandEnabled,
49
- numberOfButtons,
50
- schema,
51
- formatMessage,
52
- isNewMenuEnabled
53
- } = config;
54
- const items = [];
55
- if (actionSupported) {
56
- items.push(action({
57
- content: formatMessage(messages.action),
58
- tooltipDescription: formatMessage(messages.actionDescription),
59
- disabled: false
60
- }));
61
- }
62
- if (linkSupported) {
63
- items.push(link({
64
- content: formatMessage(messages.link),
65
- tooltipDescription: formatMessage(messages.linkDescription),
66
- disabled: !!linkDisabled,
67
- 'aria-haspopup': 'dialog'
68
- }));
69
- }
70
- if (mediaSupported && mediaUploadsEnabled) {
71
- items.push(media({
72
- content: formatMessage(messages.addMediaFiles),
73
- tooltipDescription: formatMessage(messages.mediaFilesDescription),
74
- disabled: false
75
- }));
76
- }
77
- if (imageUploadSupported) {
78
- items.push(imageUpload({
79
- content: formatMessage(messages.image),
80
- disabled: !imageUploadEnabled
81
- }));
82
- }
83
- if (mentionsSupported) {
84
- items.push(mention({
85
- content: formatMessage(messages.mention),
86
- tooltipDescription: formatMessage(messages.mentionDescription),
87
- disabled: !isTypeAheadAllowed || !!mentionsDisabled,
88
- 'aria-haspopup': 'listbox'
89
- }));
90
- }
91
- if (emojiProvider) {
92
- items.push(emoji({
93
- content: formatMessage(messages.emoji),
94
- tooltipDescription: formatMessage(messages.emojiDescription),
95
- disabled: emojiDisabled || !isTypeAheadAllowed,
96
- 'aria-haspopup': 'dialog'
97
- }));
98
- }
99
- if (tableSupported) {
100
- items.push(table({
101
- content: formatMessage(messages.table),
102
- tooltipDescription: formatMessage(messages.tableDescription),
103
- disabled: false
104
- }));
105
- }
106
- if (layoutSectionEnabled) {
107
- const labelColumns = formatMessage(messages.columns);
108
- items.push(layout({
109
- content: labelColumns,
110
- tooltipDescription: formatMessage(messages.columnsDescription),
111
- disabled: false
112
- }));
113
- }
114
- const blockTypes = availableWrapperBlockTypes || [];
115
- const codeblockData = blockTypes.find(type => type.name === 'codeblock');
116
- const panelData = blockTypes.find(type => type.name === 'panel');
117
- const blockquoteData = blockTypes.find(type => type.name === 'blockquote');
118
- if (codeblockData) {
119
- items.push(codeblock({
120
- content: formatMessage(codeblockData.title),
121
- tooltipDescription: formatMessage(blockTypeMessages.codeblockDescription),
122
- disabled: false,
123
- shortcut: '```'
124
- }));
125
- }
126
- if (panelData) {
127
- items.push(panel({
128
- content: formatMessage(panelData.title),
129
- tooltipDescription: formatMessage(blockTypeMessages.infoPanelDescription),
130
- disabled: false
131
- }));
132
- }
133
- if (blockquoteData) {
134
- items.push(blockquote({
135
- content: formatMessage(blockquoteData.title),
136
- tooltipDescription: formatMessage(blockTypeMessages.blockquoteDescription),
137
- disabled: false,
138
- shortcut: '>'
139
- }));
140
- }
141
- if (decisionSupported) {
142
- items.push(decision({
143
- content: formatMessage(messages.decision),
144
- tooltipDescription: formatMessage(messages.decisionDescription),
145
- disabled: false
146
- }));
147
- }
148
- if (horizontalRuleEnabled && schema.nodes.rule) {
149
- items.push(horizontalrule({
150
- content: formatMessage(messages.horizontalRule),
151
- tooltipDescription: formatMessage(messages.horizontalRuleDescription),
152
- disabled: false
153
- }));
154
- }
155
- if (expandEnabled && schema.nodes.expand) {
156
- items.push(expand({
157
- content: formatMessage(messages.expand),
158
- tooltipDescription: formatMessage(messages.expandDescription),
159
- disabled: false
160
- }));
161
- }
162
- if (dateEnabled) {
163
- const labelDate = formatMessage(messages.date);
164
- items.push(date({
165
- content: labelDate,
166
- tooltipDescription: formatMessage(messages.dateDescription),
167
- disabled: false
168
- }));
169
- }
170
- if (placeholderTextEnabled) {
171
- items.push(placeholder({
172
- content: formatMessage(messages.placeholderText),
173
- disabled: false
174
- }));
175
- }
176
- if (nativeStatusSupported) {
177
- const labelStatus = formatMessage(messages.status);
178
- items.push(status({
179
- content: labelStatus,
180
- tooltipDescription: formatMessage(messages.statusDescription),
181
- disabled: false
182
- }));
183
- }
184
- if (insertMenuItems) {
185
- items.push(...insertMenuItems);
186
- }
187
- if (showElementBrowserLink) {
188
- items.push(more({
189
- content: formatMessage(messages.viewMore),
190
- disabled: false
191
- }));
192
- }
193
- const buttonItems = items.slice(0, numberOfButtons).map(buttonToItem);
194
- const remainingItems = items.slice(numberOfButtons);
195
- const dropdownItems = (!isNewMenuEnabled ? sortItems(remainingItems) : remainingItems).map(buttonToDropdownItem(formatMessage(messages.insertMenu)));
196
- return [buttonItems, dropdownItems];
197
- };
198
- export const createItems = memoizeOne(createInsertBlockItems, shallowEquals);
@@ -1,37 +0,0 @@
1
- /** @jsx jsx */
2
- import React from 'react';
3
- import { jsx } from '@emotion/react';
4
- import AddIcon from '@atlaskit/icon/glyph/editor/add';
5
- import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
6
- import { ToolTipContent } from '@atlaskit/editor-common/keymaps';
7
- import { ToolbarButton } from '@atlaskit/editor-common/ui-menu';
8
- import { expandIconWrapperStyle } from '@atlaskit/editor-common/styles';
9
- import { triggerWrapper } from './styles';
10
- const DropDownButtonIcon = /*#__PURE__*/React.memo(props => jsx("span", {
11
- css: triggerWrapper
12
- }, jsx(AddIcon, {
13
- label: props.label
14
- }), jsx("span", {
15
- css: expandIconWrapperStyle
16
- }, jsx(ExpandIcon, {
17
- label: ""
18
- }))));
19
- export const DropDownButton = /*#__PURE__*/React.memo(props => jsx(ToolbarButton, {
20
- ref: props.handleRef,
21
- selected: props.selected,
22
- disabled: props.disabled,
23
- onClick: props.onClick,
24
- onKeyDown: props.onKeyDown,
25
- spacing: props.spacing,
26
- "aria-expanded": props['aria-expanded'],
27
- "aria-haspopup": props['aria-haspopup'],
28
- "aria-keyshortcuts": props['aria-keyshortcuts'],
29
- "aria-label": `${props.label} /`,
30
- iconBefore: jsx(DropDownButtonIcon, {
31
- label: ""
32
- }),
33
- title: jsx(ToolTipContent, {
34
- description: props.label,
35
- shortcutOverride: "/"
36
- })
37
- }));