@atlaskit/editor-core 187.48.7 → 188.0.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 (149) hide show
  1. package/CHANGELOG.md +92 -0
  2. package/dist/cjs/index.js +3 -305
  3. package/dist/cjs/labs/next/presets/default.js +2 -2
  4. package/dist/cjs/plugins/index.js +0 -7
  5. package/dist/cjs/version-wrapper.js +1 -1
  6. package/dist/es2019/index.js +16 -45
  7. package/dist/es2019/labs/next/presets/default.js +1 -1
  8. package/dist/es2019/plugins/index.js +0 -1
  9. package/dist/es2019/version-wrapper.js +1 -1
  10. package/dist/esm/index.js +16 -45
  11. package/dist/esm/labs/next/presets/default.js +1 -1
  12. package/dist/esm/plugins/index.js +0 -1
  13. package/dist/esm/version-wrapper.js +1 -1
  14. package/dist/types/index.d.ts +19 -63
  15. package/dist/types/plugins/index.d.ts +0 -1
  16. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
  17. package/dist/types/ui/ContentStyles/index.d.ts +2 -2
  18. package/dist/types-ts4.5/index.d.ts +19 -63
  19. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  20. package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +1 -1
  21. package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
  22. package/package.json +4 -4
  23. package/report.api.md +8 -1116
  24. package/tmp/api-report-tmp.d.ts +8 -971
  25. package/dist/cjs/plugins/floating-toolbar/index.js +0 -386
  26. package/dist/cjs/plugins/floating-toolbar/pm-plugins/force-focus/index.js +0 -73
  27. package/dist/cjs/plugins/floating-toolbar/pm-plugins/toolbar-data/commands.js +0 -26
  28. package/dist/cjs/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-factory.js +0 -16
  29. package/dist/cjs/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-key.js +0 -9
  30. package/dist/cjs/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin.js +0 -16
  31. package/dist/cjs/plugins/floating-toolbar/pm-plugins/toolbar-data/reducer.js +0 -25
  32. package/dist/cjs/plugins/floating-toolbar/pm-plugins/toolbar-data/types.js +0 -5
  33. package/dist/cjs/plugins/floating-toolbar/ui/CheckboxModal.js +0 -83
  34. package/dist/cjs/plugins/floating-toolbar/ui/ConfirmationModal.js +0 -22
  35. package/dist/cjs/plugins/floating-toolbar/ui/Dropdown.js +0 -208
  36. package/dist/cjs/plugins/floating-toolbar/ui/DropdownMenu.js +0 -205
  37. package/dist/cjs/plugins/floating-toolbar/ui/EditorEmojiAddIcon.js +0 -32
  38. package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.js +0 -120
  39. package/dist/cjs/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +0 -179
  40. package/dist/cjs/plugins/floating-toolbar/ui/Input.js +0 -78
  41. package/dist/cjs/plugins/floating-toolbar/ui/ScrollButtons.js +0 -152
  42. package/dist/cjs/plugins/floating-toolbar/ui/Select.js +0 -74
  43. package/dist/cjs/plugins/floating-toolbar/ui/Separator.js +0 -9
  44. package/dist/cjs/plugins/floating-toolbar/ui/SimpleModal.js +0 -42
  45. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +0 -427
  46. package/dist/cjs/plugins/floating-toolbar/ui/ToolbarLoader.js +0 -25
  47. package/dist/cjs/plugins/floating-toolbar/ui/messages.js +0 -55
  48. package/dist/cjs/plugins/floating-toolbar/ui/styles.js +0 -79
  49. package/dist/cjs/plugins/floating-toolbar/utils.js +0 -22
  50. package/dist/es2019/plugins/floating-toolbar/index.js +0 -368
  51. package/dist/es2019/plugins/floating-toolbar/pm-plugins/force-focus/index.js +0 -63
  52. package/dist/es2019/plugins/floating-toolbar/pm-plugins/toolbar-data/commands.js +0 -10
  53. package/dist/es2019/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-factory.js +0 -8
  54. package/dist/es2019/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-key.js +0 -2
  55. package/dist/es2019/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin.js +0 -9
  56. package/dist/es2019/plugins/floating-toolbar/pm-plugins/toolbar-data/reducer.js +0 -16
  57. package/dist/es2019/plugins/floating-toolbar/pm-plugins/toolbar-data/types.js +0 -1
  58. package/dist/es2019/plugins/floating-toolbar/ui/CheckboxModal.js +0 -71
  59. package/dist/es2019/plugins/floating-toolbar/ui/ConfirmationModal.js +0 -13
  60. package/dist/es2019/plugins/floating-toolbar/ui/Dropdown.js +0 -180
  61. package/dist/es2019/plugins/floating-toolbar/ui/DropdownMenu.js +0 -191
  62. package/dist/es2019/plugins/floating-toolbar/ui/EditorEmojiAddIcon.js +0 -25
  63. package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.js +0 -107
  64. package/dist/es2019/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +0 -100
  65. package/dist/es2019/plugins/floating-toolbar/ui/Input.js +0 -52
  66. package/dist/es2019/plugins/floating-toolbar/ui/ScrollButtons.js +0 -137
  67. package/dist/es2019/plugins/floating-toolbar/ui/Select.js +0 -62
  68. package/dist/es2019/plugins/floating-toolbar/ui/Separator.js +0 -2
  69. package/dist/es2019/plugins/floating-toolbar/ui/SimpleModal.js +0 -35
  70. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +0 -419
  71. package/dist/es2019/plugins/floating-toolbar/ui/ToolbarLoader.js +0 -6
  72. package/dist/es2019/plugins/floating-toolbar/ui/messages.js +0 -48
  73. package/dist/es2019/plugins/floating-toolbar/ui/styles.js +0 -64
  74. package/dist/es2019/plugins/floating-toolbar/utils.js +0 -16
  75. package/dist/esm/plugins/floating-toolbar/index.js +0 -375
  76. package/dist/esm/plugins/floating-toolbar/pm-plugins/force-focus/index.js +0 -64
  77. package/dist/esm/plugins/floating-toolbar/pm-plugins/toolbar-data/commands.js +0 -18
  78. package/dist/esm/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-factory.js +0 -8
  79. package/dist/esm/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-key.js +0 -2
  80. package/dist/esm/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin.js +0 -9
  81. package/dist/esm/plugins/floating-toolbar/pm-plugins/toolbar-data/reducer.js +0 -17
  82. package/dist/esm/plugins/floating-toolbar/pm-plugins/toolbar-data/types.js +0 -1
  83. package/dist/esm/plugins/floating-toolbar/ui/CheckboxModal.js +0 -72
  84. package/dist/esm/plugins/floating-toolbar/ui/ConfirmationModal.js +0 -14
  85. package/dist/esm/plugins/floating-toolbar/ui/Dropdown.js +0 -199
  86. package/dist/esm/plugins/floating-toolbar/ui/DropdownMenu.js +0 -197
  87. package/dist/esm/plugins/floating-toolbar/ui/EditorEmojiAddIcon.js +0 -25
  88. package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.js +0 -113
  89. package/dist/esm/plugins/floating-toolbar/ui/ExtensionsPlaceholder.js +0 -168
  90. package/dist/esm/plugins/floating-toolbar/ui/Input.js +0 -70
  91. package/dist/esm/plugins/floating-toolbar/ui/ScrollButtons.js +0 -141
  92. package/dist/esm/plugins/floating-toolbar/ui/Select.js +0 -64
  93. package/dist/esm/plugins/floating-toolbar/ui/Separator.js +0 -2
  94. package/dist/esm/plugins/floating-toolbar/ui/SimpleModal.js +0 -31
  95. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +0 -417
  96. package/dist/esm/plugins/floating-toolbar/ui/ToolbarLoader.js +0 -12
  97. package/dist/esm/plugins/floating-toolbar/ui/messages.js +0 -48
  98. package/dist/esm/plugins/floating-toolbar/ui/styles.js +0 -68
  99. package/dist/esm/plugins/floating-toolbar/utils.js +0 -16
  100. package/dist/types/plugins/floating-toolbar/index.d.ts +0 -13
  101. package/dist/types/plugins/floating-toolbar/pm-plugins/force-focus/index.d.ts +0 -21
  102. package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/commands.d.ts +0 -3
  103. package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-factory.d.ts +0 -1
  104. package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-key.d.ts +0 -3
  105. package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin.d.ts +0 -3
  106. package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/reducer.d.ts +0 -3
  107. package/dist/types/plugins/floating-toolbar/pm-plugins/toolbar-data/types.d.ts +0 -8
  108. package/dist/types/plugins/floating-toolbar/ui/CheckboxModal.d.ts +0 -4
  109. package/dist/types/plugins/floating-toolbar/ui/ConfirmationModal.d.ts +0 -6
  110. package/dist/types/plugins/floating-toolbar/ui/Dropdown.d.ts +0 -41
  111. package/dist/types/plugins/floating-toolbar/ui/DropdownMenu.d.ts +0 -29
  112. package/dist/types/plugins/floating-toolbar/ui/EditorEmojiAddIcon.d.ts +0 -2
  113. package/dist/types/plugins/floating-toolbar/ui/EmojiPickerButton.d.ts +0 -15
  114. package/dist/types/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +0 -16
  115. package/dist/types/plugins/floating-toolbar/ui/Input.d.ts +0 -23
  116. package/dist/types/plugins/floating-toolbar/ui/ScrollButtons.d.ts +0 -13
  117. package/dist/types/plugins/floating-toolbar/ui/Select.d.ts +0 -21
  118. package/dist/types/plugins/floating-toolbar/ui/Separator.d.ts +0 -2
  119. package/dist/types/plugins/floating-toolbar/ui/SimpleModal.d.ts +0 -4
  120. package/dist/types/plugins/floating-toolbar/ui/Toolbar.d.ts +0 -44
  121. package/dist/types/plugins/floating-toolbar/ui/ToolbarLoader.d.ts +0 -4
  122. package/dist/types/plugins/floating-toolbar/ui/messages.d.ts +0 -48
  123. package/dist/types/plugins/floating-toolbar/ui/styles.d.ts +0 -20
  124. package/dist/types/plugins/floating-toolbar/utils.d.ts +0 -2
  125. package/dist/types-ts4.5/plugins/floating-toolbar/index.d.ts +0 -13
  126. package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/force-focus/index.d.ts +0 -21
  127. package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/commands.d.ts +0 -3
  128. package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-factory.d.ts +0 -1
  129. package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin-key.d.ts +0 -3
  130. package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/plugin.d.ts +0 -3
  131. package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/reducer.d.ts +0 -3
  132. package/dist/types-ts4.5/plugins/floating-toolbar/pm-plugins/toolbar-data/types.d.ts +0 -8
  133. package/dist/types-ts4.5/plugins/floating-toolbar/ui/CheckboxModal.d.ts +0 -4
  134. package/dist/types-ts4.5/plugins/floating-toolbar/ui/ConfirmationModal.d.ts +0 -6
  135. package/dist/types-ts4.5/plugins/floating-toolbar/ui/Dropdown.d.ts +0 -41
  136. package/dist/types-ts4.5/plugins/floating-toolbar/ui/DropdownMenu.d.ts +0 -29
  137. package/dist/types-ts4.5/plugins/floating-toolbar/ui/EditorEmojiAddIcon.d.ts +0 -2
  138. package/dist/types-ts4.5/plugins/floating-toolbar/ui/EmojiPickerButton.d.ts +0 -15
  139. package/dist/types-ts4.5/plugins/floating-toolbar/ui/ExtensionsPlaceholder.d.ts +0 -16
  140. package/dist/types-ts4.5/plugins/floating-toolbar/ui/Input.d.ts +0 -23
  141. package/dist/types-ts4.5/plugins/floating-toolbar/ui/ScrollButtons.d.ts +0 -13
  142. package/dist/types-ts4.5/plugins/floating-toolbar/ui/Select.d.ts +0 -21
  143. package/dist/types-ts4.5/plugins/floating-toolbar/ui/Separator.d.ts +0 -2
  144. package/dist/types-ts4.5/plugins/floating-toolbar/ui/SimpleModal.d.ts +0 -4
  145. package/dist/types-ts4.5/plugins/floating-toolbar/ui/Toolbar.d.ts +0 -44
  146. package/dist/types-ts4.5/plugins/floating-toolbar/ui/ToolbarLoader.d.ts +0 -4
  147. package/dist/types-ts4.5/plugins/floating-toolbar/ui/messages.d.ts +0 -48
  148. package/dist/types-ts4.5/plugins/floating-toolbar/ui/styles.d.ts +0 -20
  149. package/dist/types-ts4.5/plugins/floating-toolbar/utils.d.ts +0 -2
@@ -1,417 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/createClass";
4
- import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
5
- import _inherits from "@babel/runtime/helpers/inherits";
6
- import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
- import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
8
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
9
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
10
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13;
11
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
- /** @jsx jsx */
14
- import React, { Component } from 'react';
15
- import { css, jsx } from '@emotion/react';
16
- import ButtonGroup from '@atlaskit/button/button-group';
17
- import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
18
- import { themed } from '@atlaskit/theme/components';
19
- import { borderRadius } from '@atlaskit/theme/constants';
20
- import { DN70 } from '@atlaskit/theme/colors';
21
- import { showConfirmDialog } from '../pm-plugins/toolbar-data/commands';
22
- import { FloatingToolbarButton as Button, Announcer } from '@atlaskit/editor-common/ui';
23
- import Dropdown from './Dropdown';
24
- import Select from './Select';
25
- import Separator from './Separator';
26
- import Input from './Input';
27
- import { ExtensionsPlaceholder } from './ExtensionsPlaceholder';
28
- import { areSameItems } from '@atlaskit/editor-common/floating-toolbar';
29
- import { ColorPickerButton } from '@atlaskit/editor-common/ui-menu';
30
- import { backgroundPaletteTooltipMessages } from '@atlaskit/editor-common/ui-color';
31
- import { EmojiPickerButton } from './EmojiPickerButton';
32
- import { injectIntl } from 'react-intl-next';
33
- import messages from './messages';
34
- import { clearHoverSelection } from '@atlaskit/editor-plugin-table/commands';
35
- import { ScrollButtons } from './ScrollButtons';
36
- import { ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
37
- import { checkShouldForceFocusAndApply, forceFocusSelector } from '../pm-plugins/force-focus';
38
- var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
39
- var items = _ref.items,
40
- dispatchCommand = _ref.dispatchCommand,
41
- popupsMountPoint = _ref.popupsMountPoint,
42
- popupsBoundariesElement = _ref.popupsBoundariesElement,
43
- editorView = _ref.editorView,
44
- dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
45
- popupsScrollableElement = _ref.popupsScrollableElement,
46
- scrollable = _ref.scrollable,
47
- providerFactory = _ref.providerFactory,
48
- extensionsProvider = _ref.extensionsProvider,
49
- node = _ref.node,
50
- setDisableScroll = _ref.setDisableScroll,
51
- mountRef = _ref.mountRef,
52
- featureFlags = _ref.featureFlags,
53
- api = _ref.api;
54
- var emojiAndColourPickerMountPoint = scrollable ? popupsMountPoint || (editorView === null || editorView === void 0 ? void 0 : editorView.dom.closest('.fabric-editor-popup-scroll-parent')) || (editorView === null || editorView === void 0 ? void 0 : editorView.dom.closest('.ak-editor-content-area')) || undefined : popupsMountPoint;
55
- return jsx(ButtonGroup, null, items.filter(function (item) {
56
- return !item.hidden;
57
- }).map(function (item, idx) {
58
- var _api$contextPanel, _api$extension;
59
- switch (item.type) {
60
- case 'button':
61
- var ButtonIcon = item.icon;
62
- var onClickHandler = function onClickHandler() {
63
- if (item.confirmDialog) {
64
- dispatchCommand(showConfirmDialog(idx));
65
- } else {
66
- dispatchCommand(item.onClick);
67
- if (item.focusEditoronEnter && !(editorView !== null && editorView !== void 0 && editorView.hasFocus())) {
68
- editorView === null || editorView === void 0 ? void 0 : editorView.focus();
69
- }
70
- }
71
- };
72
- return jsx(Button, {
73
- className: item.className,
74
- key: idx,
75
- title: item.title,
76
- href: item.href,
77
- icon: item.icon ? jsx(ButtonIcon, {
78
- label: item.title
79
- }) : undefined,
80
- appearance: item.appearance,
81
- target: item.target,
82
- onClick: onClickHandler,
83
- onMouseEnter: function onMouseEnter() {
84
- return dispatchCommand(item.onMouseEnter);
85
- },
86
- onMouseLeave: function onMouseLeave() {
87
- return dispatchCommand(item.onMouseLeave);
88
- },
89
- onFocus: function onFocus() {
90
- return dispatchCommand(item.onFocus);
91
- },
92
- onBlur: function onBlur() {
93
- return dispatchCommand(item.onBlur);
94
- },
95
- selected: item.selected,
96
- disabled: item.disabled,
97
- tooltipContent: item.tooltipContent,
98
- testId: item.testId,
99
- hideTooltipOnClick: item.hideTooltipOnClick,
100
- ariaHasPopup: item.ariaHasPopup,
101
- tabIndex: item.tabIndex
102
- }, item.showTitle && item.title);
103
- case 'input':
104
- return jsx(Input, {
105
- key: idx,
106
- mountPoint: popupsMountPoint,
107
- boundariesElement: popupsBoundariesElement,
108
- defaultValue: item.defaultValue,
109
- placeholder: item.placeholder,
110
- onSubmit: function onSubmit(value) {
111
- return dispatchCommand(item.onSubmit(value));
112
- },
113
- onBlur: function onBlur(value) {
114
- return dispatchCommand(item.onBlur(value));
115
- }
116
- });
117
- case 'custom':
118
- {
119
- return item.render(editorView, idx, dispatchAnalyticsEvent);
120
- }
121
- case 'dropdown':
122
- var DropdownIcon = item.icon;
123
- return jsx(Dropdown, {
124
- key: idx,
125
- title: item.title,
126
- icon: DropdownIcon && jsx(DropdownIcon, {
127
- label: item.title
128
- }),
129
- dispatchCommand: dispatchCommand,
130
- options: item.options,
131
- disabled: item.disabled,
132
- tooltip: item.tooltip,
133
- hideExpandIcon: item.hideExpandIcon,
134
- mountPoint: popupsMountPoint,
135
- boundariesElement: popupsBoundariesElement,
136
- scrollableElement: popupsScrollableElement,
137
- dropdownWidth: item.dropdownWidth,
138
- showSelected: item.showSelected,
139
- buttonTestId: item.testId,
140
- editorView: editorView,
141
- setDisableParentScroll: scrollable ? setDisableScroll : undefined,
142
- dropdownListId: (item === null || item === void 0 ? void 0 : item.id) && "".concat(item.id, "-dropdownList"),
143
- alignDropdownWithToolbar: items.length === 1
144
- });
145
- case 'select':
146
- if (item.selectType === 'list') {
147
- var ariaLabel = item.title || item.placeholder;
148
- return jsx(Select, {
149
- key: idx,
150
- dispatchCommand: dispatchCommand,
151
- options: item.options,
152
- hideExpandIcon: item.hideExpandIcon,
153
- mountPoint: scrollable ? mountRef.current : undefined,
154
- boundariesElement: popupsBoundariesElement,
155
- scrollableElement: popupsScrollableElement,
156
- defaultValue: item.defaultValue,
157
- placeholder: item.placeholder,
158
- onChange: function onChange(selected) {
159
- return dispatchCommand(item.onChange(selected));
160
- },
161
- ariaLabel: ariaLabel,
162
- filterOption: item.filterOption,
163
- setDisableParentScroll: scrollable ? setDisableScroll : undefined,
164
- classNamePrefix: 'floating-toolbar-select'
165
- });
166
- }
167
- if (item.selectType === 'color') {
168
- return jsx(ColorPickerButton, {
169
- skipFocusButtonAfterPick: true,
170
- key: idx,
171
- title: item.title,
172
- onChange: function onChange(selected) {
173
- dispatchCommand(item.onChange(selected));
174
- },
175
- colorPalette: item.options,
176
- currentColor: item.defaultValue ? item.defaultValue.value : undefined,
177
- placement: "Panels",
178
- mountPoint: emojiAndColourPickerMountPoint,
179
- setDisableParentScroll: scrollable ? setDisableScroll : undefined
180
- // Currently in floating toolbar, color picker is only
181
- // used in panel and table cell background color.
182
- // Both uses same color palette.
183
- // That's why hard-coding hexToEditorBackgroundPaletteColor
184
- // and paletteColorTooltipMessages.
185
- // When we need to support different color palette
186
- // in floating toolbar, we need to set hexToPaletteColor
187
- // and paletteColorTooltipMessages in item options.
188
- ,
189
- hexToPaletteColor: hexToEditorBackgroundPaletteColor,
190
- paletteColorTooltipMessages: backgroundPaletteTooltipMessages
191
- });
192
- }
193
- if (item.selectType === 'emoji') {
194
- return jsx(EmojiPickerButton, {
195
- key: idx,
196
- editorView: editorView,
197
- title: item.title,
198
- providerFactory: providerFactory,
199
- isSelected: item.selected,
200
- onChange: function onChange(selected) {
201
- return dispatchCommand(item.onChange(selected));
202
- },
203
- mountPoint: emojiAndColourPickerMountPoint,
204
- setDisableParentScroll: scrollable ? setDisableScroll : undefined
205
- });
206
- }
207
- return null;
208
- case 'extensions-placeholder':
209
- if (!editorView || !extensionsProvider) {
210
- return null;
211
- }
212
- var _ref2 = featureFlags || {},
213
- extendFloatingToolbar = _ref2.extendFloatingToolbar;
214
- if (!extendFloatingToolbar) {
215
- return null;
216
- }
217
- return jsx(ExtensionsPlaceholder, {
218
- key: idx,
219
- node: node,
220
- editorView: editorView,
221
- extensionProvider: extensionsProvider,
222
- separator: item.separator,
223
- applyChangeToContextPanel: api === null || api === void 0 ? void 0 : (_api$contextPanel = api.contextPanel) === null || _api$contextPanel === void 0 ? void 0 : _api$contextPanel.actions.applyChange,
224
- extensionApi: api === null || api === void 0 ? void 0 : (_api$extension = api.extension) === null || _api$extension === void 0 ? void 0 : _api$extension.actions.api()
225
- });
226
- case 'separator':
227
- return jsx(Separator, {
228
- key: idx
229
- });
230
- }
231
- }));
232
- }, function (prevProps, nextProps) {
233
- if (!nextProps.node) {
234
- return false;
235
- }
236
- // only rerender toolbar items if the node is different
237
- // otherwise it causes an issue where multiple popups stays open
238
- return !(prevProps.node.type !== nextProps.node.type || prevProps.node.attrs.localId !== nextProps.node.attrs.localId || !areSameItems(prevProps.items, nextProps.items) || !prevProps.mounted !== !nextProps.mounted);
239
- });
240
- var toolbarContainer = function toolbarContainer(theme, scrollable, hasSelect, firstElementIsSelect) {
241
- return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background-color: ", ";\n border-radius: ", "px;\n box-shadow: ", ";\n display: flex;\n line-height: 1;\n box-sizing: border-box;\n\n & > div > div {\n align-items: center;\n }\n ", "\n"])), themed({
242
- light: "var(--ds-surface-overlay, white)",
243
- dark: "var(--ds-surface-overlay, ".concat(DN70, ")")
244
- })(theme), borderRadius(), "var(--ds-shadow-overlay, ".concat("0 0 1px rgba(9, 30, 66, 0.31), 0 4px 8px -2px rgba(9, 30, 66, 0.25)", ")"), scrollable ? css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", "\n overflow: hidden;\n "])), hasSelect ? css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n height: 40px;\n "]))) : css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n height: 32px;\n "])))) : css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n padding: ", " ", ";\n ", "\n "])), "var(--ds-space-050, 4px)", "var(--ds-space-100, 8px)", firstElementIsSelect && css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n padding-left: ", ";\n "])), "var(--ds-space-050, 4px)")));
245
- };
246
- var toolbarOverflow = function toolbarOverflow(scrollable, scrollDisabled, firstElementIsSelect) {
247
- return css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n ", "\n"])), scrollable ? css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n ", "\n -webkit-overflow-scrolling: touch;\n padding: ", " 0 50px;\n > div {\n > div:first-child {\n ", "\n }\n > div:last-child {\n margin-right: ", ";\n }\n }\n "])), scrollDisabled ? css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n overflow: hidden;\n "]))) : css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n overflow-x: auto;\n overflow-y: hidden;\n "]))), "var(--ds-space-050, 4px)", firstElementIsSelect ? css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n margin-left: ", ";\n "])), "var(--ds-space-050, 4px)") : css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n margin-left: ", ";\n "])), "var(--ds-space-100, 8px)"), "var(--ds-space-100, 8px)") : css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n display: flex;\n "]))));
248
- };
249
- var Toolbar = /*#__PURE__*/function (_Component) {
250
- _inherits(Toolbar, _Component);
251
- var _super = _createSuper(Toolbar);
252
- function Toolbar(props) {
253
- var _this;
254
- _classCallCheck(this, Toolbar);
255
- _this = _super.call(this, props);
256
- _defineProperty(_assertThisInitialized(_this), "shouldHandleArrowKeys", function () {
257
- var _this$props$items;
258
- //To prevent the keydown handling of arrow keys for custom toolbar items with 'disableArrowNavigation' prop enabled,
259
- //Usually the button which has menus or popups
260
- return !((_this$props$items = _this.props.items) !== null && _this$props$items !== void 0 && _this$props$items.find(function (item) {
261
- return item.type === 'custom' && item.disableArrowNavigation;
262
- }));
263
- });
264
- _defineProperty(_assertThisInitialized(_this), "handleEscape", function (event) {
265
- var _this$props$editorVie;
266
- // If any menu is open inside the floating toolbar 'Esc' key should not
267
- // focus the editorview.
268
- // Event can't be stopped as they are not childnodes of floating toolbar
269
-
270
- var isDropdownOpen = !!document.querySelector('[data-role="droplistContent"]');
271
- var isSelectMenuOpen = !!document.querySelector('.floating-toolbar-select__menu');
272
- if (isDropdownOpen || isSelectMenuOpen) {
273
- return;
274
- }
275
- (_this$props$editorVie = _this.props.editorView) === null || _this$props$editorVie === void 0 ? void 0 : _this$props$editorVie.focus();
276
- event.preventDefault();
277
- event.stopPropagation();
278
- });
279
- _this.scrollContainerRef = /*#__PURE__*/React.createRef();
280
- _this.mountRef = /*#__PURE__*/React.createRef();
281
- _this.toolbarContainerRef = /*#__PURE__*/React.createRef();
282
- _this.state = {
283
- scrollDisabled: false,
284
- mounted: false
285
- };
286
- return _this;
287
- }
288
- // remove any decorations added by toolbar buttons i.e danger and selected styling
289
- // this prevents https://product-fabric.atlassian.net/browse/ED-10207
290
- _createClass(Toolbar, [{
291
- key: "resetStyling",
292
- value: function resetStyling(_ref3) {
293
- var table = _ref3.table;
294
- if (this.props.editorView) {
295
- var _this$props$api;
296
- var _this$props$editorVie2 = this.props.editorView,
297
- state = _this$props$editorVie2.state,
298
- dispatch = _this$props$editorVie2.dispatch;
299
- if (table) {
300
- return clearHoverSelection()(state, dispatch);
301
- }
302
- (_this$props$api = this.props.api) === null || _this$props$api === void 0 ? void 0 : _this$props$api.decorations.actions.removeDecoration(state, dispatch);
303
- }
304
- }
305
- }, {
306
- key: "setDisableScroll",
307
- value: function setDisableScroll(disabled) {
308
- var _this2 = this;
309
- // wait before setting disabled state incase users jumping from one popup to another
310
- if (disabled) {
311
- requestAnimationFrame(function () {
312
- _this2.setState({
313
- scrollDisabled: disabled
314
- });
315
- });
316
- } else {
317
- this.setState({
318
- scrollDisabled: disabled
319
- });
320
- }
321
- }
322
- }, {
323
- key: "componentDidMount",
324
- value: function componentDidMount() {
325
- this.setState({
326
- mounted: true
327
- });
328
- }
329
- }, {
330
- key: "componentDidUpdate",
331
- value: function componentDidUpdate(prevProps) {
332
- var _this$props;
333
- checkShouldForceFocusAndApply((_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.editorView);
334
- if (this.props.node !== prevProps.node) {
335
- this.resetStyling({
336
- table: (prevProps === null || prevProps === void 0 ? void 0 : prevProps.node.type.name) === 'table'
337
- });
338
- }
339
- }
340
- }, {
341
- key: "componentWillUnmount",
342
- value: function componentWillUnmount() {
343
- var editorView = this.props.editorView;
344
- if (editorView) {
345
- var tr = editorView.state.tr,
346
- dispatch = editorView.dispatch;
347
- dispatch(forceFocusSelector(null)(tr));
348
- }
349
- this.resetStyling({
350
- table: this.props.node.type.name === 'table'
351
- });
352
- }
353
- }, {
354
- key: "render",
355
- value: function render() {
356
- var _this$props2 = this.props,
357
- items = _this$props2.items,
358
- className = _this$props2.className,
359
- node = _this$props2.node,
360
- intl = _this$props2.intl,
361
- scrollable = _this$props2.scrollable;
362
- if (!items || !items.length) {
363
- return null;
364
- }
365
-
366
- // Select has left padding of 4px to the border, everything else 8px
367
- var firstElementIsSelect = items[0].type === 'select';
368
- var hasSelect = items.find(function (item) {
369
- return item.type === 'select' && item.selectType === 'list';
370
- });
371
- var isShortcutToFocusToolbar = function isShortcutToFocusToolbar(event) {
372
- //Alt + F10 to reach first element in this floating toolbar
373
- return event.altKey && (event.key === 'F10' || event.keyCode === 121);
374
- };
375
- return jsx(React.Fragment, null, jsx(ToolbarArrowKeyNavigationProvider, {
376
- editorView: this.props.editorView,
377
- handleEscape: this.handleEscape,
378
- disableArrowKeyNavigation: !this.shouldHandleArrowKeys(),
379
- childComponentSelector: "[data-testid='editor-floating-toolbar']",
380
- isShortcutToFocusToolbar: isShortcutToFocusToolbar,
381
- intl: intl
382
- }, jsx("div", {
383
- ref: this.toolbarContainerRef,
384
- css: function css(theme) {
385
- return [toolbarContainer({
386
- theme: theme
387
- }, scrollable, hasSelect !== undefined, firstElementIsSelect)];
388
- },
389
- "aria-label": intl.formatMessage(messages.floatingToolbarAriaLabel),
390
- role: "toolbar",
391
- "data-testid": "editor-floating-toolbar",
392
- className: className
393
- }, jsx(Announcer, {
394
- text: intl.formatMessage(messages.floatingToolbarAnnouncer),
395
- delay: 250
396
- }), jsx("div", {
397
- "data-testid": "floating-toolbar-items",
398
- ref: this.scrollContainerRef,
399
- css: toolbarOverflow(scrollable, this.state.scrollDisabled, firstElementIsSelect)
400
- }, jsx(ToolbarItems, _extends({}, this.props, {
401
- setDisableScroll: this.setDisableScroll.bind(this),
402
- mountRef: this.mountRef,
403
- mounted: this.state.mounted,
404
- featureFlags: this.props.featureFlags
405
- }))), scrollable && jsx(ScrollButtons, {
406
- intl: intl,
407
- scrollContainerRef: this.scrollContainerRef,
408
- node: node,
409
- disabled: this.state.scrollDisabled
410
- })), jsx("div", {
411
- ref: this.mountRef
412
- })));
413
- }
414
- }]);
415
- return Toolbar;
416
- }(Component);
417
- export default injectIntl(Toolbar);
@@ -1,12 +0,0 @@
1
- import Loadable from 'react-loadable';
2
- export var ToolbarLoader = Loadable({
3
- loader: function loader() {
4
- return import( /* webpackChunkName: "@atlaskit-internal_editor-core-floating-toolbar" */
5
- './Toolbar').then(function (mod) {
6
- return mod.default;
7
- });
8
- },
9
- loading: function loading() {
10
- return null;
11
- }
12
- });
@@ -1,48 +0,0 @@
1
- import { defineMessages } from 'react-intl-next';
2
- export default defineMessages({
3
- confirmModalDefaultHeading: {
4
- id: 'fabric.editor.floatingToolbar.confirmModalHeading',
5
- defaultMessage: 'Are you sure?',
6
- description: 'Default heading of floating toolbar confirmation modal.'
7
- },
8
- confirmModalOK: {
9
- id: 'fabric.editor.floatingToolbar.confirmModalOK',
10
- defaultMessage: 'OK',
11
- description: 'OK button for floating toolbar confirmation modal.'
12
- },
13
- confirmModalCancel: {
14
- id: 'fabric.editor.floatingToolbar.confirmModalCancel',
15
- defaultMessage: 'Cancel',
16
- description: 'Cancel button for floating toolbar confirmation modal.'
17
- },
18
- confirmModalListUnit: {
19
- id: 'fabric.editor.floatingToolbar.confirmModalConnectedUnit',
20
- defaultMessage: '{name}{amount, plural, =0 {} one { (+1 connected element)} other { (+# connected elements)}}',
21
- description: 'Text displayed in confirmation modal which highlights the nodes and the amount of connected nodes that will be deleted'
22
- },
23
- confirmDeleteLinkedModalMessage: {
24
- id: 'fabric.editor.extension.confirmDeleteLinkedModalMessage',
25
- defaultMessage: 'Deleting {nodeName} will break anything connected to it.',
26
- description: 'Message for confirm modal when deleting a extension linked to an data consumer.'
27
- },
28
- floatingToolbarAriaLabel: {
29
- id: 'fabric.editor.floatingToolbar.floatingToolbarAriaLabel',
30
- defaultMessage: 'Floating Toolbar',
31
- description: "a floating toolbar's aria label"
32
- },
33
- floatingToolbarAnnouncer: {
34
- id: 'fabric.editor.floatingToolbar.floatingToolbarAnnouncer',
35
- defaultMessage: 'Floating toolbar controls have been opened',
36
- description: 'message that will be announced to screenreaders that the floating toolbar is opened'
37
- },
38
- floatingToolbarScrollLeft: {
39
- id: 'fabric.editor.floatingToolbar.scrollLeft',
40
- defaultMessage: 'Scroll left',
41
- description: 'Button to scroll left when the toolbar is in the overflow state'
42
- },
43
- floatingToolbarScrollRight: {
44
- id: 'fabric.editor.floatingToolbar.scrollRight',
45
- defaultMessage: 'Scroll right',
46
- description: 'Button to scroll right when the toolbar is in the overflow state'
47
- }
48
- });
@@ -1,68 +0,0 @@
1
- import * as colors from '@atlaskit/theme/colors';
2
- import { hexToRgba } from '@atlaskit/adf-schema';
3
- var background = {
4
- danger: {
5
- default: {
6
- light: 'inherit',
7
- dark: 'inherit'
8
- },
9
- hover: {
10
- light: "var(--ds-background-neutral-subtle-hovered, ".concat(colors.N30A, ")"),
11
- dark: "var(--ds-background-neutral-subtle-hovered, ".concat(colors.N30A, ")")
12
- },
13
- active: {
14
- light: "var(--ds-background-neutral-pressed, ".concat("".concat(hexToRgba(colors.B75, 0.6)), ")"),
15
- dark: "var(--ds-background-neutral-pressed, ".concat("".concat(hexToRgba(colors.B75, 0.6)), ")")
16
- }
17
- }
18
- };
19
- var color = {
20
- danger: {
21
- default: {
22
- light: "var(--ds-icon, ".concat(colors.N400, ")"),
23
- dark: "var(--ds-icon, ".concat(colors.DN400, ")")
24
- },
25
- hover: {
26
- light: "var(--ds-icon-danger, ".concat(colors.R400, ")"),
27
- dark: "var(--ds-icon-danger, ".concat(colors.R400, ")")
28
- },
29
- active: {
30
- light: "var(--ds-icon-danger, ".concat(colors.R400, ")"),
31
- dark: "var(--ds-icon-danger, ".concat(colors.R400, ")")
32
- }
33
- }
34
- };
35
- var getStyles = function getStyles(property, _ref) {
36
- var _ref$appearance = _ref.appearance,
37
- appearance = _ref$appearance === void 0 ? 'default' : _ref$appearance,
38
- _ref$state = _ref.state,
39
- state = _ref$state === void 0 ? 'default' : _ref$state,
40
- _ref$mode = _ref.mode,
41
- mode = _ref$mode === void 0 ? 'light' : _ref$mode;
42
- if (!property[appearance] || !property[appearance][state]) {
43
- return 'initial';
44
- }
45
- return property[appearance][state][mode];
46
- };
47
- export var iconOnlySpacing = {
48
- '&&': {
49
- padding: '0px',
50
- /**
51
- Increased specificity here because css for .hyperlink-open-link defined in
52
- packages/editor/editor-core/src/ui/ContentStyles/index.tsx file
53
- overrides padding left-right 2px with 4px.
54
- */
55
- '&&[href]': {
56
- padding: '0 2px'
57
- }
58
- },
59
- '& > span': {
60
- margin: '0px'
61
- }
62
- };
63
- export var getButtonStyles = function getButtonStyles(props) {
64
- return {
65
- background: getStyles(background, props),
66
- color: getStyles(color, props)
67
- };
68
- };
@@ -1,16 +0,0 @@
1
- // find node in descendants by condition
2
- export function findNode(parent, predicate) {
3
- var matchedNode;
4
- parent.descendants(function (node) {
5
- // dont run predicate if node already found
6
- if (matchedNode) {
7
- return false;
8
- }
9
- if (predicate(node)) {
10
- matchedNode = node;
11
- return false;
12
- }
13
- return true;
14
- });
15
- return matchedNode;
16
- }
@@ -1,13 +0,0 @@
1
- import type { Selection } from '@atlaskit/editor-prosemirror/state';
2
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- import type { FloatingToolbarConfig } from '@atlaskit/editor-common/types';
4
- import type { FloatingToolbarPlugin, ConfigWithNodeInfo, FloatingToolbarPluginState } from '@atlaskit/editor-plugin-floating-toolbar';
5
- export declare const getRelevantConfig: (selection: Selection, configs: Array<FloatingToolbarConfig>) => ConfigWithNodeInfo | undefined;
6
- declare const floatingToolbarPlugin: FloatingToolbarPlugin;
7
- export default floatingToolbarPlugin;
8
- /**
9
- *
10
- * ProseMirror Plugin
11
- *
12
- */
13
- export declare const pluginKey: PluginKey<FloatingToolbarPluginState>;
@@ -1,21 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { Transaction } from '@atlaskit/editor-prosemirror/state';
3
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
4
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
- export declare const forceFocusStateKey: PluginKey<any>;
6
- /**
7
- * Used in cases where a floating toolbar button opens a submenu which destroys
8
- * the button, but the user has pressed ESC to close the submenu and focus needs
9
- * to move back to the button. */
10
- declare const _default: () => SafePlugin<{
11
- selector: null;
12
- }>;
13
- export default _default;
14
- /**
15
- * The provided selector should be the floating toolbar button that needs focus.
16
- */
17
- export declare const forceFocusSelector: (selector: string | null) => (tr: Transaction) => Transaction;
18
- /**
19
- * If a selector is set and the element exists, focus it.
20
- */
21
- export declare function checkShouldForceFocusAndApply(view?: EditorView): void;
@@ -1,3 +0,0 @@
1
- import type { Command } from '@atlaskit/editor-common/types';
2
- export declare const showConfirmDialog: (buttonIndex: number) => Command;
3
- export declare const hideConfirmDialog: () => Command;
@@ -1 +0,0 @@
1
- export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch<any>, initialState: import("@atlaskit/editor-plugin-floating-toolbar").FloatingToolbarPluginData | ((state: import("prosemirror-state").EditorState) => import("@atlaskit/editor-plugin-floating-toolbar").FloatingToolbarPluginData)) => import("prosemirror-state").SafeStateField<import("@atlaskit/editor-plugin-floating-toolbar").FloatingToolbarPluginData>, createCommand: <A = import("./types").FloatingToolbarPluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => import("@atlaskit/editor-plugin-floating-toolbar").FloatingToolbarPluginData;
@@ -1,3 +0,0 @@
1
- import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
- import type { FloatingToolbarPluginData } from '@atlaskit/editor-plugin-floating-toolbar';
3
- export declare const pluginKey: PluginKey<FloatingToolbarPluginData>;
@@ -1,3 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
3
- export declare const createPlugin: (dispatch: Dispatch) => SafePlugin<import("@atlaskit/editor-plugin-floating-toolbar").FloatingToolbarPluginData>;
@@ -1,3 +0,0 @@
1
- import type { FloatingToolbarPluginAction } from './types';
2
- import type { FloatingToolbarPluginData } from '@atlaskit/editor-plugin-floating-toolbar';
3
- export declare const reducer: (pluginState: FloatingToolbarPluginData, action: FloatingToolbarPluginAction) => FloatingToolbarPluginData;
@@ -1,8 +0,0 @@
1
- export type FloatingToolbarPluginAction = {
2
- type: 'SHOW_CONFIRM_DIALOG';
3
- data: {
4
- buttonIndex: number;
5
- };
6
- } | {
7
- type: 'HIDE_CONFIRM_DIALOG';
8
- };
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- import type { WrappedComponentProps } from 'react-intl-next';
3
- import type { ConfirmationDialogProps } from '@atlaskit/editor-common/types';
4
- export declare const CheckboxModal: (props: ConfirmationDialogProps & WrappedComponentProps) => JSX.Element;
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- import type { WrappedComponentProps } from 'react-intl-next';
3
- import type { ConfirmationDialogProps } from '@atlaskit/editor-common/types';
4
- export declare const ConfirmationModal: React.FC<import("react-intl-next").WithIntlProps<ConfirmationDialogProps & WrappedComponentProps<"intl">>> & {
5
- WrappedComponent: React.ComponentType<ConfirmationDialogProps & WrappedComponentProps<"intl">>;
6
- };