@atlaskit/editor-plugin-floating-toolbar 0.5.0 → 0.6.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.
- package/CHANGELOG.md +22 -10
- package/README.md +1 -1
- package/dist/cjs/index.js +8 -1
- package/dist/cjs/plugin.js +385 -0
- package/dist/cjs/pm-plugins/force-focus/index.js +73 -0
- package/dist/cjs/pm-plugins/toolbar-data/commands.js +26 -0
- package/dist/cjs/pm-plugins/toolbar-data/plugin-factory.js +16 -0
- package/dist/cjs/pm-plugins/toolbar-data/plugin-key.js +9 -0
- package/dist/cjs/pm-plugins/toolbar-data/plugin.js +16 -0
- package/dist/cjs/pm-plugins/toolbar-data/reducer.js +25 -0
- package/dist/cjs/pm-plugins/toolbar-data/types.js +5 -0
- package/dist/cjs/ui/CheckboxModal.js +83 -0
- package/dist/cjs/ui/ConfirmationModal.js +22 -0
- package/dist/cjs/ui/Dropdown.js +212 -0
- package/dist/cjs/ui/DropdownMenu.js +218 -0
- package/dist/cjs/ui/EditorEmojiAddIcon.js +32 -0
- package/dist/cjs/ui/EmojiPickerButton.js +121 -0
- package/dist/cjs/ui/ExtensionsPlaceholder.js +179 -0
- package/dist/cjs/ui/Input.js +80 -0
- package/dist/cjs/ui/ScrollButtons.js +155 -0
- package/dist/cjs/ui/Select.js +74 -0
- package/dist/cjs/ui/Separator.js +9 -0
- package/dist/cjs/ui/SimpleModal.js +42 -0
- package/dist/cjs/ui/Toolbar.js +436 -0
- package/dist/cjs/ui/ToolbarLoader.js +25 -0
- package/dist/cjs/ui/messages.js +55 -0
- package/dist/cjs/ui/styles.js +79 -0
- package/dist/cjs/utils.js +22 -0
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/plugin.js +366 -0
- package/dist/es2019/pm-plugins/force-focus/index.js +63 -0
- package/dist/es2019/pm-plugins/toolbar-data/commands.js +10 -0
- package/dist/es2019/pm-plugins/toolbar-data/plugin-factory.js +8 -0
- package/dist/es2019/pm-plugins/toolbar-data/plugin-key.js +2 -0
- package/dist/es2019/pm-plugins/toolbar-data/plugin.js +9 -0
- package/dist/es2019/pm-plugins/toolbar-data/reducer.js +16 -0
- package/dist/es2019/pm-plugins/toolbar-data/types.js +1 -0
- package/dist/es2019/ui/CheckboxModal.js +71 -0
- package/dist/es2019/ui/ConfirmationModal.js +13 -0
- package/dist/es2019/ui/Dropdown.js +185 -0
- package/dist/es2019/ui/DropdownMenu.js +205 -0
- package/dist/es2019/ui/EditorEmojiAddIcon.js +25 -0
- package/dist/es2019/ui/EmojiPickerButton.js +108 -0
- package/dist/es2019/ui/ExtensionsPlaceholder.js +100 -0
- package/dist/es2019/ui/Input.js +54 -0
- package/dist/es2019/ui/ScrollButtons.js +141 -0
- package/dist/es2019/ui/Select.js +62 -0
- package/dist/es2019/ui/Separator.js +2 -0
- package/dist/es2019/ui/SimpleModal.js +35 -0
- package/dist/es2019/ui/Toolbar.js +428 -0
- package/dist/es2019/ui/ToolbarLoader.js +6 -0
- package/dist/es2019/ui/messages.js +48 -0
- package/dist/es2019/ui/styles.js +64 -0
- package/dist/es2019/utils.js +16 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/plugin.js +373 -0
- package/dist/esm/pm-plugins/force-focus/index.js +64 -0
- package/dist/esm/pm-plugins/toolbar-data/commands.js +18 -0
- package/dist/esm/pm-plugins/toolbar-data/plugin-factory.js +8 -0
- package/dist/esm/pm-plugins/toolbar-data/plugin-key.js +2 -0
- package/dist/esm/pm-plugins/toolbar-data/plugin.js +9 -0
- package/dist/esm/pm-plugins/toolbar-data/reducer.js +17 -0
- package/dist/esm/pm-plugins/toolbar-data/types.js +1 -0
- package/dist/esm/ui/CheckboxModal.js +72 -0
- package/dist/esm/ui/ConfirmationModal.js +14 -0
- package/dist/esm/ui/Dropdown.js +204 -0
- package/dist/esm/ui/DropdownMenu.js +211 -0
- package/dist/esm/ui/EditorEmojiAddIcon.js +25 -0
- package/dist/esm/ui/EmojiPickerButton.js +114 -0
- package/dist/esm/ui/ExtensionsPlaceholder.js +168 -0
- package/dist/esm/ui/Input.js +72 -0
- package/dist/esm/ui/ScrollButtons.js +145 -0
- package/dist/esm/ui/Select.js +64 -0
- package/dist/esm/ui/Separator.js +2 -0
- package/dist/esm/ui/SimpleModal.js +31 -0
- package/dist/esm/ui/Toolbar.js +426 -0
- package/dist/esm/ui/ToolbarLoader.js +12 -0
- package/dist/esm/ui/messages.js +48 -0
- package/dist/esm/ui/styles.js +68 -0
- package/dist/esm/utils.js +16 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/plugin.d.ts +12 -0
- package/dist/types/pm-plugins/force-focus/index.d.ts +21 -0
- package/dist/types/pm-plugins/toolbar-data/commands.d.ts +3 -0
- package/dist/types/pm-plugins/toolbar-data/plugin-factory.d.ts +1 -0
- package/dist/types/pm-plugins/toolbar-data/plugin-key.d.ts +3 -0
- package/dist/types/pm-plugins/toolbar-data/plugin.d.ts +3 -0
- package/dist/types/pm-plugins/toolbar-data/reducer.d.ts +3 -0
- package/dist/types/pm-plugins/toolbar-data/types.d.ts +8 -0
- package/dist/types/ui/CheckboxModal.d.ts +4 -0
- package/dist/types/ui/ConfirmationModal.d.ts +6 -0
- package/dist/types/ui/Dropdown.d.ts +41 -0
- package/dist/types/ui/DropdownMenu.d.ts +29 -0
- package/dist/types/ui/EditorEmojiAddIcon.d.ts +2 -0
- package/dist/types/ui/EmojiPickerButton.d.ts +16 -0
- package/dist/types/ui/ExtensionsPlaceholder.d.ts +16 -0
- package/dist/types/ui/Input.d.ts +23 -0
- package/dist/types/ui/ScrollButtons.d.ts +13 -0
- package/dist/types/ui/Select.d.ts +21 -0
- package/dist/types/ui/Separator.d.ts +2 -0
- package/dist/types/ui/SimpleModal.d.ts +4 -0
- package/dist/types/ui/Toolbar.d.ts +44 -0
- package/dist/types/ui/ToolbarLoader.d.ts +4 -0
- package/dist/types/ui/messages.d.ts +48 -0
- package/dist/types/ui/styles.d.ts +20 -0
- package/dist/types/utils.d.ts +2 -0
- package/dist/types-ts4.5/index.d.ts +1 -0
- package/dist/types-ts4.5/plugin.d.ts +12 -0
- package/dist/types-ts4.5/pm-plugins/force-focus/index.d.ts +21 -0
- package/dist/types-ts4.5/pm-plugins/toolbar-data/commands.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/toolbar-data/plugin-factory.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/toolbar-data/plugin-key.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/toolbar-data/plugin.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/toolbar-data/reducer.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/toolbar-data/types.d.ts +8 -0
- package/dist/types-ts4.5/ui/CheckboxModal.d.ts +4 -0
- package/dist/types-ts4.5/ui/ConfirmationModal.d.ts +6 -0
- package/dist/types-ts4.5/ui/Dropdown.d.ts +41 -0
- package/dist/types-ts4.5/ui/DropdownMenu.d.ts +29 -0
- package/dist/types-ts4.5/ui/EditorEmojiAddIcon.d.ts +2 -0
- package/dist/types-ts4.5/ui/EmojiPickerButton.d.ts +16 -0
- package/dist/types-ts4.5/ui/ExtensionsPlaceholder.d.ts +16 -0
- package/dist/types-ts4.5/ui/Input.d.ts +23 -0
- package/dist/types-ts4.5/ui/ScrollButtons.d.ts +13 -0
- package/dist/types-ts4.5/ui/Select.d.ts +21 -0
- package/dist/types-ts4.5/ui/Separator.d.ts +2 -0
- package/dist/types-ts4.5/ui/SimpleModal.d.ts +4 -0
- package/dist/types-ts4.5/ui/Toolbar.d.ts +44 -0
- package/dist/types-ts4.5/ui/ToolbarLoader.d.ts +4 -0
- package/dist/types-ts4.5/ui/messages.d.ts +48 -0
- package/dist/types-ts4.5/ui/styles.d.ts +20 -0
- package/dist/types-ts4.5/utils.d.ts +2 -0
- package/package.json +32 -3
- package/report.api.md +3 -0
- package/tmp/api-report-tmp.d.ts +3 -0
|
@@ -0,0 +1,426 @@
|
|
|
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 { injectIntl } from 'react-intl-next';
|
|
17
|
+
import ButtonGroup from '@atlaskit/button/button-group';
|
|
18
|
+
import { areSameItems } from '@atlaskit/editor-common/floating-toolbar';
|
|
19
|
+
import { Announcer, FloatingToolbarButton as Button } from '@atlaskit/editor-common/ui';
|
|
20
|
+
import { backgroundPaletteTooltipMessages } from '@atlaskit/editor-common/ui-color';
|
|
21
|
+
import { ToolbarArrowKeyNavigationProvider } from '@atlaskit/editor-common/ui-menu';
|
|
22
|
+
import { ColorPickerButton } from '@atlaskit/editor-common/ui-menu';
|
|
23
|
+
import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette';
|
|
24
|
+
import { clearHoverSelection } from '@atlaskit/editor-plugin-table/commands';
|
|
25
|
+
import { DN70 } from '@atlaskit/theme/colors';
|
|
26
|
+
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
27
|
+
import { themed } from '@atlaskit/theme/components';
|
|
28
|
+
// eslint-disable-next-line @atlaskit/design-system/no-deprecated-imports
|
|
29
|
+
import { borderRadius } from '@atlaskit/theme/constants';
|
|
30
|
+
import { checkShouldForceFocusAndApply, forceFocusSelector } from '../pm-plugins/force-focus';
|
|
31
|
+
import { showConfirmDialog } from '../pm-plugins/toolbar-data/commands';
|
|
32
|
+
import Dropdown from './Dropdown';
|
|
33
|
+
import { EmojiPickerButton } from './EmojiPickerButton';
|
|
34
|
+
import { ExtensionsPlaceholder } from './ExtensionsPlaceholder';
|
|
35
|
+
import Input from './Input';
|
|
36
|
+
import messages from './messages';
|
|
37
|
+
import { ScrollButtons } from './ScrollButtons';
|
|
38
|
+
import Select from './Select';
|
|
39
|
+
import Separator from './Separator';
|
|
40
|
+
var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
|
|
41
|
+
var items = _ref.items,
|
|
42
|
+
dispatchCommand = _ref.dispatchCommand,
|
|
43
|
+
popupsMountPoint = _ref.popupsMountPoint,
|
|
44
|
+
popupsBoundariesElement = _ref.popupsBoundariesElement,
|
|
45
|
+
editorView = _ref.editorView,
|
|
46
|
+
dispatchAnalyticsEvent = _ref.dispatchAnalyticsEvent,
|
|
47
|
+
popupsScrollableElement = _ref.popupsScrollableElement,
|
|
48
|
+
scrollable = _ref.scrollable,
|
|
49
|
+
providerFactory = _ref.providerFactory,
|
|
50
|
+
extensionsProvider = _ref.extensionsProvider,
|
|
51
|
+
node = _ref.node,
|
|
52
|
+
setDisableScroll = _ref.setDisableScroll,
|
|
53
|
+
mountRef = _ref.mountRef,
|
|
54
|
+
featureFlags = _ref.featureFlags,
|
|
55
|
+
api = _ref.api;
|
|
56
|
+
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;
|
|
57
|
+
return jsx(ButtonGroup, null, items.filter(function (item) {
|
|
58
|
+
return !item.hidden;
|
|
59
|
+
}).map(function (item, idx) {
|
|
60
|
+
var _api$contextPanel, _api$extension;
|
|
61
|
+
switch (item.type) {
|
|
62
|
+
case 'button':
|
|
63
|
+
var ButtonIcon = item.icon;
|
|
64
|
+
var onClickHandler = function onClickHandler() {
|
|
65
|
+
if (item.confirmDialog) {
|
|
66
|
+
dispatchCommand(showConfirmDialog(idx));
|
|
67
|
+
} else {
|
|
68
|
+
dispatchCommand(item.onClick);
|
|
69
|
+
if (item.focusEditoronEnter && !(editorView !== null && editorView !== void 0 && editorView.hasFocus())) {
|
|
70
|
+
editorView === null || editorView === void 0 ? void 0 : editorView.focus();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
return jsx(Button, {
|
|
75
|
+
className: item.className,
|
|
76
|
+
key: idx,
|
|
77
|
+
title: item.title,
|
|
78
|
+
href: item.href,
|
|
79
|
+
icon: item.icon ? jsx(ButtonIcon, {
|
|
80
|
+
label: item.title
|
|
81
|
+
}) : undefined,
|
|
82
|
+
appearance: item.appearance,
|
|
83
|
+
target: item.target,
|
|
84
|
+
onClick: onClickHandler,
|
|
85
|
+
onMouseEnter: function onMouseEnter() {
|
|
86
|
+
return dispatchCommand(item.onMouseEnter);
|
|
87
|
+
},
|
|
88
|
+
onMouseLeave: function onMouseLeave() {
|
|
89
|
+
return dispatchCommand(item.onMouseLeave);
|
|
90
|
+
},
|
|
91
|
+
onFocus: function onFocus() {
|
|
92
|
+
return dispatchCommand(item.onFocus);
|
|
93
|
+
},
|
|
94
|
+
onBlur: function onBlur() {
|
|
95
|
+
return dispatchCommand(item.onBlur);
|
|
96
|
+
},
|
|
97
|
+
selected: item.selected,
|
|
98
|
+
disabled: item.disabled,
|
|
99
|
+
tooltipContent: item.tooltipContent,
|
|
100
|
+
testId: item.testId,
|
|
101
|
+
hideTooltipOnClick: item.hideTooltipOnClick,
|
|
102
|
+
ariaHasPopup: item.ariaHasPopup,
|
|
103
|
+
tabIndex: item.tabIndex
|
|
104
|
+
}, item.showTitle && item.title);
|
|
105
|
+
case 'input':
|
|
106
|
+
return jsx(Input, {
|
|
107
|
+
key: idx,
|
|
108
|
+
mountPoint: popupsMountPoint,
|
|
109
|
+
boundariesElement: popupsBoundariesElement,
|
|
110
|
+
defaultValue: item.defaultValue,
|
|
111
|
+
placeholder: item.placeholder,
|
|
112
|
+
onSubmit: function onSubmit(value) {
|
|
113
|
+
return dispatchCommand(item.onSubmit(value));
|
|
114
|
+
},
|
|
115
|
+
onBlur: function onBlur(value) {
|
|
116
|
+
return dispatchCommand(item.onBlur(value));
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
case 'custom':
|
|
120
|
+
{
|
|
121
|
+
return item.render(editorView, idx, dispatchAnalyticsEvent);
|
|
122
|
+
}
|
|
123
|
+
case 'dropdown':
|
|
124
|
+
var DropdownIcon = item.icon;
|
|
125
|
+
return jsx(Dropdown, {
|
|
126
|
+
key: idx,
|
|
127
|
+
title: item.title,
|
|
128
|
+
icon: DropdownIcon && jsx(DropdownIcon, {
|
|
129
|
+
label: item.title
|
|
130
|
+
}),
|
|
131
|
+
dispatchCommand: dispatchCommand,
|
|
132
|
+
options: item.options,
|
|
133
|
+
disabled: item.disabled,
|
|
134
|
+
tooltip: item.tooltip,
|
|
135
|
+
hideExpandIcon: item.hideExpandIcon,
|
|
136
|
+
mountPoint: popupsMountPoint,
|
|
137
|
+
boundariesElement: popupsBoundariesElement,
|
|
138
|
+
scrollableElement: popupsScrollableElement,
|
|
139
|
+
dropdownWidth: item.dropdownWidth,
|
|
140
|
+
showSelected: item.showSelected,
|
|
141
|
+
buttonTestId: item.testId,
|
|
142
|
+
editorView: editorView,
|
|
143
|
+
setDisableParentScroll: scrollable ? setDisableScroll : undefined,
|
|
144
|
+
dropdownListId: (item === null || item === void 0 ? void 0 : item.id) && "".concat(item.id, "-dropdownList"),
|
|
145
|
+
alignDropdownWithToolbar: items.length === 1
|
|
146
|
+
});
|
|
147
|
+
case 'select':
|
|
148
|
+
if (item.selectType === 'list') {
|
|
149
|
+
var ariaLabel = item.title || item.placeholder;
|
|
150
|
+
return jsx(Select, {
|
|
151
|
+
key: idx,
|
|
152
|
+
dispatchCommand: dispatchCommand,
|
|
153
|
+
options: item.options,
|
|
154
|
+
hideExpandIcon: item.hideExpandIcon,
|
|
155
|
+
mountPoint: scrollable ? mountRef.current : undefined,
|
|
156
|
+
boundariesElement: popupsBoundariesElement,
|
|
157
|
+
scrollableElement: popupsScrollableElement,
|
|
158
|
+
defaultValue: item.defaultValue,
|
|
159
|
+
placeholder: item.placeholder,
|
|
160
|
+
onChange: function onChange(selected) {
|
|
161
|
+
return dispatchCommand(item.onChange(selected));
|
|
162
|
+
},
|
|
163
|
+
ariaLabel: ariaLabel,
|
|
164
|
+
filterOption: item.filterOption,
|
|
165
|
+
setDisableParentScroll: scrollable ? setDisableScroll : undefined,
|
|
166
|
+
classNamePrefix: 'floating-toolbar-select'
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
if (item.selectType === 'color') {
|
|
170
|
+
return jsx(ColorPickerButton, {
|
|
171
|
+
skipFocusButtonAfterPick: true,
|
|
172
|
+
key: idx,
|
|
173
|
+
title: item.title,
|
|
174
|
+
onChange: function onChange(selected) {
|
|
175
|
+
dispatchCommand(item.onChange(selected));
|
|
176
|
+
},
|
|
177
|
+
colorPalette: item.options,
|
|
178
|
+
currentColor: item.defaultValue ? item.defaultValue.value : undefined,
|
|
179
|
+
placement: "Panels",
|
|
180
|
+
mountPoint: emojiAndColourPickerMountPoint,
|
|
181
|
+
setDisableParentScroll: scrollable ? setDisableScroll : undefined
|
|
182
|
+
// Currently in floating toolbar, color picker is only
|
|
183
|
+
// used in panel and table cell background color.
|
|
184
|
+
// Both uses same color palette.
|
|
185
|
+
// That's why hard-coding hexToEditorBackgroundPaletteColor
|
|
186
|
+
// and paletteColorTooltipMessages.
|
|
187
|
+
// When we need to support different color palette
|
|
188
|
+
// in floating toolbar, we need to set hexToPaletteColor
|
|
189
|
+
// and paletteColorTooltipMessages in item options.
|
|
190
|
+
,
|
|
191
|
+
hexToPaletteColor: hexToEditorBackgroundPaletteColor,
|
|
192
|
+
paletteColorTooltipMessages: backgroundPaletteTooltipMessages
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
if (item.selectType === 'emoji') {
|
|
196
|
+
return jsx(EmojiPickerButton, {
|
|
197
|
+
key: idx,
|
|
198
|
+
editorView: editorView,
|
|
199
|
+
title: item.title,
|
|
200
|
+
providerFactory: providerFactory,
|
|
201
|
+
isSelected: item.selected,
|
|
202
|
+
onChange: function onChange(selected) {
|
|
203
|
+
return dispatchCommand(item.onChange(selected));
|
|
204
|
+
},
|
|
205
|
+
mountPoint: emojiAndColourPickerMountPoint,
|
|
206
|
+
setDisableParentScroll: scrollable ? setDisableScroll : undefined
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
return null;
|
|
210
|
+
case 'extensions-placeholder':
|
|
211
|
+
if (!editorView || !extensionsProvider) {
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
var _ref2 = featureFlags || {},
|
|
215
|
+
extendFloatingToolbar = _ref2.extendFloatingToolbar;
|
|
216
|
+
if (!extendFloatingToolbar) {
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
return jsx(ExtensionsPlaceholder, {
|
|
220
|
+
key: idx,
|
|
221
|
+
node: node,
|
|
222
|
+
editorView: editorView,
|
|
223
|
+
extensionProvider: extensionsProvider,
|
|
224
|
+
separator: item.separator,
|
|
225
|
+
applyChangeToContextPanel: api === null || api === void 0 ? void 0 : (_api$contextPanel = api.contextPanel) === null || _api$contextPanel === void 0 ? void 0 : _api$contextPanel.actions.applyChange,
|
|
226
|
+
extensionApi: api === null || api === void 0 ? void 0 : (_api$extension = api.extension) === null || _api$extension === void 0 ? void 0 : _api$extension.actions.api()
|
|
227
|
+
});
|
|
228
|
+
case 'separator':
|
|
229
|
+
return jsx(Separator, {
|
|
230
|
+
key: idx
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
}));
|
|
234
|
+
}, function (prevProps, nextProps) {
|
|
235
|
+
if (!nextProps.node) {
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
// only rerender toolbar items if the node is different
|
|
239
|
+
// otherwise it causes an issue where multiple popups stays open
|
|
240
|
+
return !(prevProps.node.type !== nextProps.node.type || prevProps.node.attrs.localId !== nextProps.node.attrs.localId || !areSameItems(prevProps.items, nextProps.items) || !prevProps.mounted !== !nextProps.mounted);
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
244
|
+
var toolbarContainer = function toolbarContainer(theme, scrollable, hasSelect, firstElementIsSelect) {
|
|
245
|
+
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({
|
|
246
|
+
light: "var(--ds-surface-overlay, white)",
|
|
247
|
+
dark: "var(--ds-surface-overlay, ".concat(DN70, ")")
|
|
248
|
+
})(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)")));
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
252
|
+
var toolbarOverflow = function toolbarOverflow(scrollable, scrollDisabled, firstElementIsSelect) {
|
|
253
|
+
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 "]))));
|
|
254
|
+
};
|
|
255
|
+
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
256
|
+
var Toolbar = /*#__PURE__*/function (_Component) {
|
|
257
|
+
_inherits(Toolbar, _Component);
|
|
258
|
+
var _super = _createSuper(Toolbar);
|
|
259
|
+
function Toolbar(props) {
|
|
260
|
+
var _this;
|
|
261
|
+
_classCallCheck(this, Toolbar);
|
|
262
|
+
_this = _super.call(this, props);
|
|
263
|
+
_defineProperty(_assertThisInitialized(_this), "shouldHandleArrowKeys", function () {
|
|
264
|
+
var _this$props$items;
|
|
265
|
+
//To prevent the keydown handling of arrow keys for custom toolbar items with 'disableArrowNavigation' prop enabled,
|
|
266
|
+
//Usually the button which has menus or popups
|
|
267
|
+
return !((_this$props$items = _this.props.items) !== null && _this$props$items !== void 0 && _this$props$items.find(function (item) {
|
|
268
|
+
return item.type === 'custom' && item.disableArrowNavigation;
|
|
269
|
+
}));
|
|
270
|
+
});
|
|
271
|
+
_defineProperty(_assertThisInitialized(_this), "handleEscape", function (event) {
|
|
272
|
+
var _this$props$editorVie;
|
|
273
|
+
// If any menu is open inside the floating toolbar 'Esc' key should not
|
|
274
|
+
// focus the editorview.
|
|
275
|
+
// Event can't be stopped as they are not childnodes of floating toolbar
|
|
276
|
+
|
|
277
|
+
var isDropdownOpen = !!document.querySelector('[data-role="droplistContent"]');
|
|
278
|
+
var isSelectMenuOpen = !!document.querySelector('.floating-toolbar-select__menu');
|
|
279
|
+
if (isDropdownOpen || isSelectMenuOpen) {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
(_this$props$editorVie = _this.props.editorView) === null || _this$props$editorVie === void 0 ? void 0 : _this$props$editorVie.focus();
|
|
283
|
+
event.preventDefault();
|
|
284
|
+
event.stopPropagation();
|
|
285
|
+
});
|
|
286
|
+
_this.scrollContainerRef = /*#__PURE__*/React.createRef();
|
|
287
|
+
_this.mountRef = /*#__PURE__*/React.createRef();
|
|
288
|
+
_this.toolbarContainerRef = /*#__PURE__*/React.createRef();
|
|
289
|
+
_this.state = {
|
|
290
|
+
scrollDisabled: false,
|
|
291
|
+
mounted: false
|
|
292
|
+
};
|
|
293
|
+
return _this;
|
|
294
|
+
}
|
|
295
|
+
// remove any decorations added by toolbar buttons i.e danger and selected styling
|
|
296
|
+
// this prevents https://product-fabric.atlassian.net/browse/ED-10207
|
|
297
|
+
_createClass(Toolbar, [{
|
|
298
|
+
key: "resetStyling",
|
|
299
|
+
value: function resetStyling(_ref3) {
|
|
300
|
+
var table = _ref3.table;
|
|
301
|
+
if (this.props.editorView) {
|
|
302
|
+
var _this$props$api;
|
|
303
|
+
var _this$props$editorVie2 = this.props.editorView,
|
|
304
|
+
state = _this$props$editorVie2.state,
|
|
305
|
+
dispatch = _this$props$editorVie2.dispatch;
|
|
306
|
+
if (table) {
|
|
307
|
+
return clearHoverSelection()(state, dispatch);
|
|
308
|
+
}
|
|
309
|
+
(_this$props$api = this.props.api) === null || _this$props$api === void 0 ? void 0 : _this$props$api.decorations.actions.removeDecoration(state, dispatch);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}, {
|
|
313
|
+
key: "setDisableScroll",
|
|
314
|
+
value: function setDisableScroll(disabled) {
|
|
315
|
+
var _this2 = this;
|
|
316
|
+
// wait before setting disabled state incase users jumping from one popup to another
|
|
317
|
+
if (disabled) {
|
|
318
|
+
requestAnimationFrame(function () {
|
|
319
|
+
_this2.setState({
|
|
320
|
+
scrollDisabled: disabled
|
|
321
|
+
});
|
|
322
|
+
});
|
|
323
|
+
} else {
|
|
324
|
+
this.setState({
|
|
325
|
+
scrollDisabled: disabled
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}, {
|
|
330
|
+
key: "componentDidMount",
|
|
331
|
+
value: function componentDidMount() {
|
|
332
|
+
this.setState({
|
|
333
|
+
mounted: true
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
}, {
|
|
337
|
+
key: "componentDidUpdate",
|
|
338
|
+
value: function componentDidUpdate(prevProps) {
|
|
339
|
+
var _this$props;
|
|
340
|
+
checkShouldForceFocusAndApply((_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.editorView);
|
|
341
|
+
if (this.props.node !== prevProps.node) {
|
|
342
|
+
this.resetStyling({
|
|
343
|
+
table: (prevProps === null || prevProps === void 0 ? void 0 : prevProps.node.type.name) === 'table'
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}, {
|
|
348
|
+
key: "componentWillUnmount",
|
|
349
|
+
value: function componentWillUnmount() {
|
|
350
|
+
var editorView = this.props.editorView;
|
|
351
|
+
if (editorView) {
|
|
352
|
+
var tr = editorView.state.tr,
|
|
353
|
+
dispatch = editorView.dispatch;
|
|
354
|
+
dispatch(forceFocusSelector(null)(tr));
|
|
355
|
+
}
|
|
356
|
+
this.resetStyling({
|
|
357
|
+
table: this.props.node.type.name === 'table'
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
}, {
|
|
361
|
+
key: "render",
|
|
362
|
+
value: function render() {
|
|
363
|
+
var _this$props2 = this.props,
|
|
364
|
+
items = _this$props2.items,
|
|
365
|
+
className = _this$props2.className,
|
|
366
|
+
node = _this$props2.node,
|
|
367
|
+
intl = _this$props2.intl,
|
|
368
|
+
scrollable = _this$props2.scrollable;
|
|
369
|
+
if (!items || !items.length) {
|
|
370
|
+
return null;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
// Select has left padding of 4px to the border, everything else 8px
|
|
374
|
+
var firstElementIsSelect = items[0].type === 'select';
|
|
375
|
+
var hasSelect = items.find(function (item) {
|
|
376
|
+
return item.type === 'select' && item.selectType === 'list';
|
|
377
|
+
});
|
|
378
|
+
var isShortcutToFocusToolbar = function isShortcutToFocusToolbar(event) {
|
|
379
|
+
//Alt + F10 to reach first element in this floating toolbar
|
|
380
|
+
return event.altKey && (event.key === 'F10' || event.keyCode === 121);
|
|
381
|
+
};
|
|
382
|
+
return jsx(React.Fragment, null, jsx(ToolbarArrowKeyNavigationProvider, {
|
|
383
|
+
editorView: this.props.editorView,
|
|
384
|
+
handleEscape: this.handleEscape,
|
|
385
|
+
disableArrowKeyNavigation: !this.shouldHandleArrowKeys(),
|
|
386
|
+
childComponentSelector: "[data-testid='editor-floating-toolbar']",
|
|
387
|
+
isShortcutToFocusToolbar: isShortcutToFocusToolbar,
|
|
388
|
+
intl: intl
|
|
389
|
+
}, jsx("div", {
|
|
390
|
+
ref: this.toolbarContainerRef,
|
|
391
|
+
css: function css(theme) {
|
|
392
|
+
return [toolbarContainer({
|
|
393
|
+
theme: theme
|
|
394
|
+
}, scrollable, hasSelect !== undefined, firstElementIsSelect)];
|
|
395
|
+
},
|
|
396
|
+
"aria-label": intl.formatMessage(messages.floatingToolbarAriaLabel),
|
|
397
|
+
role: "toolbar",
|
|
398
|
+
"data-testid": "editor-floating-toolbar",
|
|
399
|
+
className: className
|
|
400
|
+
}, jsx(Announcer, {
|
|
401
|
+
text: intl.formatMessage(messages.floatingToolbarAnnouncer),
|
|
402
|
+
delay: 250
|
|
403
|
+
}), jsx("div", {
|
|
404
|
+
"data-testid": "floating-toolbar-items",
|
|
405
|
+
ref: this.scrollContainerRef
|
|
406
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
407
|
+
,
|
|
408
|
+
css: toolbarOverflow(scrollable, this.state.scrollDisabled, firstElementIsSelect)
|
|
409
|
+
}, jsx(ToolbarItems, _extends({}, this.props, {
|
|
410
|
+
setDisableScroll: this.setDisableScroll.bind(this),
|
|
411
|
+
mountRef: this.mountRef,
|
|
412
|
+
mounted: this.state.mounted,
|
|
413
|
+
featureFlags: this.props.featureFlags
|
|
414
|
+
}))), scrollable && jsx(ScrollButtons, {
|
|
415
|
+
intl: intl,
|
|
416
|
+
scrollContainerRef: this.scrollContainerRef,
|
|
417
|
+
node: node,
|
|
418
|
+
disabled: this.state.scrollDisabled
|
|
419
|
+
})), jsx("div", {
|
|
420
|
+
ref: this.mountRef
|
|
421
|
+
})));
|
|
422
|
+
}
|
|
423
|
+
}]);
|
|
424
|
+
return Toolbar;
|
|
425
|
+
}(Component);
|
|
426
|
+
export default injectIntl(Toolbar);
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { hexToRgba } from '@atlaskit/adf-schema';
|
|
2
|
+
import * as colors from '@atlaskit/theme/colors';
|
|
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
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FloatingToolbarConfig } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
+
import type { ConfigWithNodeInfo, FloatingToolbarPlugin, FloatingToolbarPluginState } from './types';
|
|
5
|
+
export declare const getRelevantConfig: (selection: Selection, configs: Array<FloatingToolbarConfig>) => ConfigWithNodeInfo | undefined;
|
|
6
|
+
export declare const floatingToolbarPlugin: FloatingToolbarPlugin;
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* ProseMirror Plugin
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
export declare const pluginKey: PluginKey<FloatingToolbarPluginState>;
|
|
@@ -0,0 +1,21 @@
|
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch<any>, initialState: import("../..").FloatingToolbarPluginData | ((state: import("prosemirror-state").EditorState) => import("../..").FloatingToolbarPluginData)) => import("prosemirror-state").SafeStateField<import("../..").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("../..").FloatingToolbarPluginData;
|
|
@@ -0,0 +1,4 @@
|
|
|
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;
|
|
@@ -0,0 +1,6 @@
|
|
|
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
|
+
};
|