@atlaskit/editor-plugin-insert-block 4.3.3 → 4.3.4
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 +8 -0
- package/dist/cjs/insertBlockPlugin.js +8 -2
- package/dist/cjs/ui/toolbar-components/EmojiButton.js +25 -83
- package/dist/cjs/ui/toolbar-components/InsertButton.js +250 -0
- package/dist/cjs/ui/toolbar-components/TableSizePicker.js +25 -48
- package/dist/cjs/ui/toolbar-components/hooks/useEmojiPickerPopup.js +52 -0
- package/dist/cjs/ui/toolbar-components/hooks/useInsertButtonState.js +89 -0
- package/dist/cjs/ui/toolbar-components/hooks/usePopupManager.js +65 -0
- package/dist/cjs/ui/toolbar-components/hooks/useTableSelectorPopup.js +35 -0
- package/dist/cjs/ui/toolbar-components/popups/EmojiPickerPopup.js +53 -0
- package/dist/cjs/ui/toolbar-components/popups/TableSelectorPopupWrapper.js +36 -0
- package/dist/cjs/ui/toolbar-components/shared/constants.js +18 -0
- package/dist/cjs/ui/toolbar-components/shared/types.js +5 -0
- package/dist/cjs/ui/toolbar-components.js +66 -2
- package/dist/es2019/insertBlockPlugin.js +8 -2
- package/dist/es2019/ui/toolbar-components/EmojiButton.js +24 -77
- package/dist/es2019/ui/toolbar-components/InsertButton.js +243 -0
- package/dist/es2019/ui/toolbar-components/TableSizePicker.js +26 -41
- package/dist/es2019/ui/toolbar-components/hooks/useEmojiPickerPopup.js +42 -0
- package/dist/es2019/ui/toolbar-components/hooks/useInsertButtonState.js +81 -0
- package/dist/es2019/ui/toolbar-components/hooks/usePopupManager.js +50 -0
- package/dist/es2019/ui/toolbar-components/hooks/useTableSelectorPopup.js +27 -0
- package/dist/es2019/ui/toolbar-components/popups/EmojiPickerPopup.js +47 -0
- package/dist/es2019/ui/toolbar-components/popups/TableSelectorPopupWrapper.js +30 -0
- package/dist/es2019/ui/toolbar-components/shared/constants.js +12 -0
- package/dist/es2019/ui/toolbar-components/shared/types.js +1 -0
- package/dist/es2019/ui/toolbar-components.js +63 -3
- package/dist/esm/insertBlockPlugin.js +8 -2
- package/dist/esm/ui/toolbar-components/EmojiButton.js +26 -83
- package/dist/esm/ui/toolbar-components/InsertButton.js +242 -0
- package/dist/esm/ui/toolbar-components/TableSizePicker.js +26 -48
- package/dist/esm/ui/toolbar-components/hooks/useEmojiPickerPopup.js +45 -0
- package/dist/esm/ui/toolbar-components/hooks/useInsertButtonState.js +82 -0
- package/dist/esm/ui/toolbar-components/hooks/usePopupManager.js +58 -0
- package/dist/esm/ui/toolbar-components/hooks/useTableSelectorPopup.js +28 -0
- package/dist/esm/ui/toolbar-components/popups/EmojiPickerPopup.js +46 -0
- package/dist/esm/ui/toolbar-components/popups/TableSelectorPopupWrapper.js +29 -0
- package/dist/esm/ui/toolbar-components/shared/constants.js +12 -0
- package/dist/esm/ui/toolbar-components/shared/types.js +1 -0
- package/dist/esm/ui/toolbar-components.js +67 -3
- package/dist/types/ui/toolbar-components/EmojiButton.d.ts +2 -7
- package/dist/types/ui/toolbar-components/InsertButton.d.ts +18 -0
- package/dist/types/ui/toolbar-components/TableSizePicker.d.ts +3 -5
- package/dist/types/ui/toolbar-components/hooks/useEmojiPickerPopup.d.ts +20 -0
- package/dist/types/ui/toolbar-components/hooks/useInsertButtonState.d.ts +24 -0
- package/dist/types/ui/toolbar-components/hooks/usePopupManager.d.ts +21 -0
- package/dist/types/ui/toolbar-components/hooks/useTableSelectorPopup.d.ts +19 -0
- package/dist/types/ui/toolbar-components/popups/EmojiPickerPopup.d.ts +16 -0
- package/dist/types/ui/toolbar-components/popups/TableSelectorPopupWrapper.d.ts +15 -0
- package/dist/types/ui/toolbar-components/shared/constants.d.ts +12 -0
- package/dist/types/ui/toolbar-components/shared/types.d.ts +8 -0
- package/dist/types/ui/toolbar-components.d.ts +9 -2
- package/dist/types-ts4.5/ui/toolbar-components/EmojiButton.d.ts +2 -7
- package/dist/types-ts4.5/ui/toolbar-components/InsertButton.d.ts +18 -0
- package/dist/types-ts4.5/ui/toolbar-components/TableSizePicker.d.ts +3 -5
- package/dist/types-ts4.5/ui/toolbar-components/hooks/useEmojiPickerPopup.d.ts +20 -0
- package/dist/types-ts4.5/ui/toolbar-components/hooks/useInsertButtonState.d.ts +24 -0
- package/dist/types-ts4.5/ui/toolbar-components/hooks/usePopupManager.d.ts +21 -0
- package/dist/types-ts4.5/ui/toolbar-components/hooks/useTableSelectorPopup.d.ts +19 -0
- package/dist/types-ts4.5/ui/toolbar-components/popups/EmojiPickerPopup.d.ts +16 -0
- package/dist/types-ts4.5/ui/toolbar-components/popups/TableSelectorPopupWrapper.d.ts +15 -0
- package/dist/types-ts4.5/ui/toolbar-components/shared/constants.d.ts +15 -0
- package/dist/types-ts4.5/ui/toolbar-components/shared/types.d.ts +8 -0
- package/dist/types-ts4.5/ui/toolbar-components.d.ts +9 -2
- package/package.json +7 -7
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { useIntl } from 'react-intl-next';
|
|
3
|
+
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
4
|
+
import { createItems } from '../../ToolbarInsertBlock/create-items';
|
|
5
|
+
export var useInsertButtonState = function useInsertButtonState(_ref) {
|
|
6
|
+
var api = _ref.api,
|
|
7
|
+
editorView = _ref.editorView,
|
|
8
|
+
horizontalRuleEnabled = _ref.horizontalRuleEnabled,
|
|
9
|
+
insertMenuItems = _ref.insertMenuItems,
|
|
10
|
+
nativeStatusSupported = _ref.nativeStatusSupported,
|
|
11
|
+
numberOfButtons = _ref.numberOfButtons,
|
|
12
|
+
tableSelectorSupported = _ref.tableSelectorSupported,
|
|
13
|
+
expandEnabled = _ref.expandEnabled,
|
|
14
|
+
showElementBrowserLink = _ref.showElementBrowserLink;
|
|
15
|
+
var _useIntl = useIntl(),
|
|
16
|
+
formatMessage = _useIntl.formatMessage;
|
|
17
|
+
var isTypeAheadAllowed = useSharedPluginStateSelector(api, 'typeAhead.isAllowed');
|
|
18
|
+
var imageUploadEnabled = useSharedPluginStateSelector(api, 'imageUpload.enabled');
|
|
19
|
+
var mentionsSupported = !!useSharedPluginStateSelector(api, 'mention.mentionProvider');
|
|
20
|
+
var canInsertMention = useSharedPluginStateSelector(api, 'mention.canInsertMention');
|
|
21
|
+
var dateEnabled = useSharedPluginStateSelector(api, 'date.isInitialised');
|
|
22
|
+
var placeholderTextEnabled = useSharedPluginStateSelector(api, 'placeholderText.allowInserting');
|
|
23
|
+
var mediaAllowsUploads = useSharedPluginStateSelector(api, 'media.allowsUploads');
|
|
24
|
+
var canInsertLink = useSharedPluginStateSelector(api, 'hyperlink.canInsertLink');
|
|
25
|
+
var activeLinkMark = useSharedPluginStateSelector(api, 'hyperlink.activeLinkMark');
|
|
26
|
+
var connectivityMode = useSharedPluginStateSelector(api, 'connectivity.mode');
|
|
27
|
+
var emojiProvider = useSharedPluginStateSelector(api, 'emoji.emojiProvider');
|
|
28
|
+
var availableWrapperBlockTypes = useSharedPluginStateSelector(api, 'blockType.availableWrapperBlockTypes');
|
|
29
|
+
|
|
30
|
+
// Computed values
|
|
31
|
+
var mediaUploadsEnabled = mediaAllowsUploads;
|
|
32
|
+
var mediaSupported = mediaAllowsUploads !== undefined;
|
|
33
|
+
var isEditorOffline = connectivityMode === 'offline';
|
|
34
|
+
var imageUploadSupported = !!(api !== null && api !== void 0 && api.imageUpload);
|
|
35
|
+
var mentionsDisabled = !canInsertMention;
|
|
36
|
+
var linkSupported = canInsertLink !== undefined;
|
|
37
|
+
var linkDisabled = !canInsertLink || !!activeLinkMark;
|
|
38
|
+
var emojiDisabled = !emojiProvider;
|
|
39
|
+
var actionSupported = !!(editorView !== null && editorView !== void 0 && editorView.state.schema.nodes.taskItem);
|
|
40
|
+
var decisionSupported = !!(editorView !== null && editorView !== void 0 && editorView.state.schema.nodes.decisionItem);
|
|
41
|
+
var layoutSectionEnabled = !!(api !== null && api !== void 0 && api.layout);
|
|
42
|
+
var _ref2 = editorView !== null && editorView !== void 0 && editorView.state.schema ? createItems({
|
|
43
|
+
isTypeAheadAllowed: isTypeAheadAllowed,
|
|
44
|
+
tableSupported: !!(editorView !== null && editorView !== void 0 && editorView.state.schema.nodes.table),
|
|
45
|
+
tableSelectorSupported: tableSelectorSupported,
|
|
46
|
+
mediaUploadsEnabled: mediaUploadsEnabled,
|
|
47
|
+
mediaSupported: mediaSupported,
|
|
48
|
+
isEditorOffline: isEditorOffline,
|
|
49
|
+
imageUploadSupported: imageUploadSupported,
|
|
50
|
+
imageUploadEnabled: imageUploadEnabled,
|
|
51
|
+
mentionsSupported: mentionsSupported,
|
|
52
|
+
mentionsDisabled: mentionsDisabled,
|
|
53
|
+
actionSupported: actionSupported,
|
|
54
|
+
decisionSupported: decisionSupported,
|
|
55
|
+
linkSupported: linkSupported,
|
|
56
|
+
linkDisabled: linkDisabled,
|
|
57
|
+
emojiDisabled: emojiDisabled,
|
|
58
|
+
hasEmojiPlugin: !!(api !== null && api !== void 0 && api.emoji),
|
|
59
|
+
hasMentionsPlugin: !!(api !== null && api !== void 0 && api.mention),
|
|
60
|
+
hasMediaPlugin: !!(api !== null && api !== void 0 && api.media),
|
|
61
|
+
nativeStatusSupported: nativeStatusSupported,
|
|
62
|
+
dateEnabled: dateEnabled,
|
|
63
|
+
placeholderTextEnabled: placeholderTextEnabled,
|
|
64
|
+
horizontalRuleEnabled: horizontalRuleEnabled,
|
|
65
|
+
layoutSectionEnabled: layoutSectionEnabled,
|
|
66
|
+
expandEnabled: expandEnabled,
|
|
67
|
+
showElementBrowserLink: showElementBrowserLink,
|
|
68
|
+
emojiProvider: emojiProvider,
|
|
69
|
+
availableWrapperBlockTypes: availableWrapperBlockTypes,
|
|
70
|
+
insertMenuItems: insertMenuItems,
|
|
71
|
+
schema: editorView === null || editorView === void 0 ? void 0 : editorView.state.schema,
|
|
72
|
+
numberOfButtons: numberOfButtons || 0,
|
|
73
|
+
formatMessage: formatMessage
|
|
74
|
+
}) : [, []],
|
|
75
|
+
_ref3 = _slicedToArray(_ref2, 2),
|
|
76
|
+
dropdownItems = _ref3[1];
|
|
77
|
+
return {
|
|
78
|
+
dropdownItems: dropdownItems,
|
|
79
|
+
emojiProvider: emojiProvider,
|
|
80
|
+
isTypeAheadAllowed: isTypeAheadAllowed
|
|
81
|
+
};
|
|
82
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { useState, useCallback } from 'react';
|
|
3
|
+
import { isDetachedElement } from '../utils/utils';
|
|
4
|
+
export var usePopupManager = function usePopupManager() {
|
|
5
|
+
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
6
|
+
var _useState = useState(false),
|
|
7
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
8
|
+
isOpen = _useState2[0],
|
|
9
|
+
setIsOpen = _useState2[1];
|
|
10
|
+
var _useState3 = useState(false),
|
|
11
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
12
|
+
isOpenedByKeyboard = _useState4[0],
|
|
13
|
+
setIsOpenedByKeyboard = _useState4[1];
|
|
14
|
+
var toggle = useCallback(function (inputMethod) {
|
|
15
|
+
var _config$analytics, _config$analytics$onT;
|
|
16
|
+
var newState = !isOpen;
|
|
17
|
+
setIsOpen(newState);
|
|
18
|
+
if (newState) {
|
|
19
|
+
var _config$onOpen;
|
|
20
|
+
(_config$onOpen = config.onOpen) === null || _config$onOpen === void 0 || _config$onOpen.call(config, inputMethod);
|
|
21
|
+
} else {
|
|
22
|
+
var _config$onClose;
|
|
23
|
+
(_config$onClose = config.onClose) === null || _config$onClose === void 0 || _config$onClose.call(config);
|
|
24
|
+
}
|
|
25
|
+
(_config$analytics = config.analytics) === null || _config$analytics === void 0 || (_config$analytics$onT = _config$analytics.onToggle) === null || _config$analytics$onT === void 0 || _config$analytics$onT.call(_config$analytics, newState, inputMethod);
|
|
26
|
+
}, [isOpen, config]);
|
|
27
|
+
var close = useCallback(function () {
|
|
28
|
+
var _config$onClose2, _config$analytics2, _config$analytics2$on;
|
|
29
|
+
setIsOpen(false);
|
|
30
|
+
(_config$onClose2 = config.onClose) === null || _config$onClose2 === void 0 || _config$onClose2.call(config);
|
|
31
|
+
(_config$analytics2 = config.analytics) === null || _config$analytics2 === void 0 || (_config$analytics2$on = _config$analytics2.onToggle) === null || _config$analytics2$on === void 0 || _config$analytics2$on.call(_config$analytics2, false);
|
|
32
|
+
}, [config]);
|
|
33
|
+
var handleEscapeKeydown = useCallback(function () {
|
|
34
|
+
var _config$focusTarget;
|
|
35
|
+
close();
|
|
36
|
+
(_config$focusTarget = config.focusTarget) === null || _config$focusTarget === void 0 || (_config$focusTarget = _config$focusTarget.current) === null || _config$focusTarget === void 0 || _config$focusTarget.focus();
|
|
37
|
+
}, [close, config.focusTarget]);
|
|
38
|
+
var handleClickOutside = useCallback(function (e) {
|
|
39
|
+
if (e.target instanceof HTMLElement && !isDetachedElement(e.target)) {
|
|
40
|
+
close();
|
|
41
|
+
}
|
|
42
|
+
}, [close]);
|
|
43
|
+
var handleKeyboardOpen = useCallback(function (event) {
|
|
44
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
45
|
+
setIsOpenedByKeyboard(true);
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
}
|
|
48
|
+
}, []);
|
|
49
|
+
return {
|
|
50
|
+
isOpen: isOpen,
|
|
51
|
+
isOpenedByKeyboard: isOpenedByKeyboard,
|
|
52
|
+
toggle: toggle,
|
|
53
|
+
close: close,
|
|
54
|
+
handleEscapeKeydown: handleEscapeKeydown,
|
|
55
|
+
handleClickOutside: handleClickOutside,
|
|
56
|
+
handleKeyboardOpen: handleKeyboardOpen
|
|
57
|
+
};
|
|
58
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
import { useCallback } from 'react';
|
|
5
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
|
+
import { usePopupManager } from './usePopupManager';
|
|
7
|
+
export var useTableSelectorPopup = function useTableSelectorPopup(_ref) {
|
|
8
|
+
var api = _ref.api,
|
|
9
|
+
buttonRef = _ref.buttonRef;
|
|
10
|
+
var popupManager = usePopupManager({
|
|
11
|
+
focusTarget: buttonRef
|
|
12
|
+
});
|
|
13
|
+
var handleSelectedTableSize = useCallback(function (rowsCount, colsCount) {
|
|
14
|
+
// workaround to solve race condition where cursor is not placed correctly inside table
|
|
15
|
+
queueMicrotask(function () {
|
|
16
|
+
var _api$core, _api$table;
|
|
17
|
+
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$table = api.table) === null || _api$table === void 0 ? void 0 : _api$table.commands.insertTableWithSize(rowsCount, colsCount, INPUT_METHOD.PICKER));
|
|
18
|
+
});
|
|
19
|
+
popupManager.close();
|
|
20
|
+
}, [api, popupManager]);
|
|
21
|
+
var onPopupUnmount = useCallback(function () {
|
|
22
|
+
api === null || api === void 0 || api.core.actions.focus();
|
|
23
|
+
}, [api]);
|
|
24
|
+
return _objectSpread(_objectSpread({}, popupManager), {}, {
|
|
25
|
+
handleSelectedTableSize: handleSelectedTableSize,
|
|
26
|
+
onPopupUnmount: onPopupUnmount
|
|
27
|
+
});
|
|
28
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Popup } from '@atlaskit/editor-common/ui';
|
|
3
|
+
import { OutsideClickTargetRefContext, withReactEditorViewOuterListeners as withOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
4
|
+
import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
|
|
5
|
+
import { EmojiPicker as AkEmojiPicker } from '@atlaskit/emoji/picker';
|
|
6
|
+
var EmojiPicker = function EmojiPicker(props) {
|
|
7
|
+
var setOutsideClickTargetRef = React.useContext(OutsideClickTargetRefContext);
|
|
8
|
+
return /*#__PURE__*/React.createElement(AkEmojiPicker, {
|
|
9
|
+
onPickerRef: setOutsideClickTargetRef,
|
|
10
|
+
emojiProvider: props.emojiProvider,
|
|
11
|
+
onSelection: props.onSelection
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
var EmojiPickerWithListeners = withOuterListeners(EmojiPicker);
|
|
15
|
+
export var EmojiPickerPopup = function EmojiPickerPopup(_ref) {
|
|
16
|
+
var isOpen = _ref.isOpen,
|
|
17
|
+
targetRef = _ref.targetRef,
|
|
18
|
+
emojiProvider = _ref.emojiProvider,
|
|
19
|
+
onSelection = _ref.onSelection,
|
|
20
|
+
onClickOutside = _ref.onClickOutside,
|
|
21
|
+
onEscapeKeydown = _ref.onEscapeKeydown,
|
|
22
|
+
onUnmount = _ref.onUnmount,
|
|
23
|
+
popupsMountPoint = _ref.popupsMountPoint,
|
|
24
|
+
popupsBoundariesElement = _ref.popupsBoundariesElement,
|
|
25
|
+
popupsScrollableElement = _ref.popupsScrollableElement;
|
|
26
|
+
if (!isOpen || !targetRef.current || !emojiProvider) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
return /*#__PURE__*/React.createElement(Popup, {
|
|
30
|
+
target: targetRef.current,
|
|
31
|
+
fitHeight: 350,
|
|
32
|
+
fitWidth: 350,
|
|
33
|
+
offset: [0, 3],
|
|
34
|
+
mountTo: popupsMountPoint,
|
|
35
|
+
boundariesElement: popupsBoundariesElement,
|
|
36
|
+
scrollableElement: popupsScrollableElement,
|
|
37
|
+
onUnmount: onUnmount,
|
|
38
|
+
focusTrap: true,
|
|
39
|
+
zIndex: akEditorMenuZIndex
|
|
40
|
+
}, /*#__PURE__*/React.createElement(EmojiPickerWithListeners, {
|
|
41
|
+
emojiProvider: emojiProvider,
|
|
42
|
+
onSelection: onSelection,
|
|
43
|
+
handleClickOutside: onClickOutside,
|
|
44
|
+
handleEscapeKeydown: onEscapeKeydown
|
|
45
|
+
}));
|
|
46
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TableSelectorPopup } from '@atlaskit/editor-common/ui';
|
|
3
|
+
export var TableSelectorPopupWrapper = function TableSelectorPopupWrapper(_ref) {
|
|
4
|
+
var isOpen = _ref.isOpen,
|
|
5
|
+
targetRef = _ref.targetRef,
|
|
6
|
+
isOpenedByKeyboard = _ref.isOpenedByKeyboard,
|
|
7
|
+
onSelection = _ref.onSelection,
|
|
8
|
+
onClickOutside = _ref.onClickOutside,
|
|
9
|
+
onEscapeKeydown = _ref.onEscapeKeydown,
|
|
10
|
+
onUnmount = _ref.onUnmount,
|
|
11
|
+
popupsMountPoint = _ref.popupsMountPoint,
|
|
12
|
+
popupsBoundariesElement = _ref.popupsBoundariesElement,
|
|
13
|
+
popupsScrollableElement = _ref.popupsScrollableElement;
|
|
14
|
+
if (!isOpen || !targetRef.current) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return /*#__PURE__*/React.createElement(TableSelectorPopup, {
|
|
18
|
+
allowOutsideSelection: true,
|
|
19
|
+
target: targetRef.current,
|
|
20
|
+
onUnmount: onUnmount,
|
|
21
|
+
onSelection: onSelection,
|
|
22
|
+
popupsMountPoint: popupsMountPoint,
|
|
23
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
24
|
+
popupsScrollableElement: popupsScrollableElement,
|
|
25
|
+
handleClickOutside: onClickOutside,
|
|
26
|
+
handleEscapeKeydown: onEscapeKeydown,
|
|
27
|
+
isOpenedByKeyboard: isOpenedByKeyboard
|
|
28
|
+
});
|
|
29
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export var POPUP_Z_INDEX = 'akEditorMenuZIndex';
|
|
2
|
+
export var POPUP_DIMENSIONS = {
|
|
3
|
+
EMOJI_PICKER: {
|
|
4
|
+
fitHeight: 350,
|
|
5
|
+
fitWidth: 350,
|
|
6
|
+
offset: [0, 3]
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
export var FOCUS_DELAY = {
|
|
10
|
+
ANIMATION_FRAME: 'requestAnimationFrame',
|
|
11
|
+
MICROTASK: 'queueMicrotask'
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { INSERT_BLOCK_SECTION, TASK_LIST_GROUP, MEDIA_GROUP, INSERT_BLOCK_SECTION_RANK, TASK_LIST_BUTTON, TASK_LIST_GROUP_RANK, MEDIA_BUTTON, MENTION_GROUP, MEDIA_GROUP_RANK, MENTION_BUTTON, MENTION_GROUP_RANK, EMOJI_GROUP, EMOJI_BUTTON, EMOJI_GROUP_RANK, LAYOUT_GROUP, LAYOUT_BUTTON, LAYOUT_GROUP_RANK, TABLE_GROUP_RANK, TABLE_BUTTON, TABLE_GROUP, TABLE_SIZE_PICKER } from '@atlaskit/editor-common/toolbar';
|
|
3
|
+
import { INSERT_BLOCK_SECTION, TASK_LIST_GROUP, MEDIA_GROUP, INSERT_BLOCK_SECTION_RANK, TASK_LIST_BUTTON, TASK_LIST_GROUP_RANK, MEDIA_BUTTON, MENTION_GROUP, MEDIA_GROUP_RANK, MENTION_BUTTON, MENTION_GROUP_RANK, EMOJI_GROUP, EMOJI_BUTTON, EMOJI_GROUP_RANK, LAYOUT_GROUP, LAYOUT_BUTTON, LAYOUT_GROUP_RANK, TABLE_GROUP_RANK, TABLE_BUTTON, TABLE_GROUP, TABLE_SIZE_PICKER, INSERT_GROUP, INSERT_BUTTON, INSERT_GROUP_RANK } from '@atlaskit/editor-common/toolbar';
|
|
4
4
|
import { EmojiButton } from './toolbar-components/EmojiButton';
|
|
5
5
|
import { ImageButton } from './toolbar-components/ImageButton';
|
|
6
|
+
import { InsertButton } from './toolbar-components/InsertButton';
|
|
6
7
|
import { LayoutButton } from './toolbar-components/LayoutButton';
|
|
7
8
|
import { MediaButton } from './toolbar-components/MediaButton';
|
|
8
9
|
import { MentionButton } from './toolbar-components/MentionButton';
|
|
@@ -12,8 +13,42 @@ import { TaskListButton } from './toolbar-components/TaskListButton';
|
|
|
12
13
|
export var getToolbarComponents = function getToolbarComponents(_ref) {
|
|
13
14
|
var api = _ref.api,
|
|
14
15
|
tableSelectorSupported = _ref.tableSelectorSupported,
|
|
15
|
-
toolbarShowPlusInsertOnly = _ref.toolbarShowPlusInsertOnly
|
|
16
|
-
|
|
16
|
+
toolbarShowPlusInsertOnly = _ref.toolbarShowPlusInsertOnly,
|
|
17
|
+
showElementBrowserLink = _ref.showElementBrowserLink,
|
|
18
|
+
onInsertBlockType = _ref.onInsertBlockType,
|
|
19
|
+
nativeStatusSupported = _ref.nativeStatusSupported,
|
|
20
|
+
horizontalRuleEnabled = _ref.horizontalRuleEnabled,
|
|
21
|
+
expandEnabled = _ref.expandEnabled,
|
|
22
|
+
insertMenuItems = _ref.insertMenuItems;
|
|
23
|
+
return _toConsumableArray(toolbarShowPlusInsertOnly ? [{
|
|
24
|
+
type: INSERT_GROUP.type,
|
|
25
|
+
key: INSERT_GROUP.key,
|
|
26
|
+
parents: [{
|
|
27
|
+
type: INSERT_BLOCK_SECTION.type,
|
|
28
|
+
key: INSERT_BLOCK_SECTION.key,
|
|
29
|
+
rank: INSERT_BLOCK_SECTION_RANK[INSERT_GROUP.key]
|
|
30
|
+
}]
|
|
31
|
+
}, {
|
|
32
|
+
type: INSERT_BUTTON.type,
|
|
33
|
+
key: INSERT_BUTTON.key,
|
|
34
|
+
parents: [{
|
|
35
|
+
type: INSERT_GROUP.type,
|
|
36
|
+
key: INSERT_GROUP.key,
|
|
37
|
+
rank: INSERT_GROUP_RANK[INSERT_BUTTON.key]
|
|
38
|
+
}],
|
|
39
|
+
component: function component() {
|
|
40
|
+
return /*#__PURE__*/React.createElement(InsertButton, {
|
|
41
|
+
api: api,
|
|
42
|
+
showElementBrowserLink: showElementBrowserLink,
|
|
43
|
+
tableSelectorSupported: tableSelectorSupported,
|
|
44
|
+
onInsertBlockType: onInsertBlockType,
|
|
45
|
+
nativeStatusSupported: nativeStatusSupported,
|
|
46
|
+
horizontalRuleEnabled: horizontalRuleEnabled,
|
|
47
|
+
expandEnabled: expandEnabled,
|
|
48
|
+
insertMenuItems: insertMenuItems
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}] : [{
|
|
17
52
|
type: TASK_LIST_GROUP.type,
|
|
18
53
|
key: TASK_LIST_GROUP.key,
|
|
19
54
|
parents: [{
|
|
@@ -155,5 +190,34 @@ export var getToolbarComponents = function getToolbarComponents(_ref) {
|
|
|
155
190
|
tableSelectorSupported: tableSelectorSupported
|
|
156
191
|
});
|
|
157
192
|
}
|
|
193
|
+
}, {
|
|
194
|
+
type: INSERT_GROUP.type,
|
|
195
|
+
key: INSERT_GROUP.key,
|
|
196
|
+
parents: [{
|
|
197
|
+
type: INSERT_BLOCK_SECTION.type,
|
|
198
|
+
key: INSERT_BLOCK_SECTION.key,
|
|
199
|
+
rank: INSERT_BLOCK_SECTION_RANK[INSERT_GROUP.key]
|
|
200
|
+
}]
|
|
201
|
+
}, {
|
|
202
|
+
type: INSERT_BUTTON.type,
|
|
203
|
+
key: INSERT_BUTTON.key,
|
|
204
|
+
parents: [{
|
|
205
|
+
type: INSERT_GROUP.type,
|
|
206
|
+
key: INSERT_GROUP.key,
|
|
207
|
+
rank: INSERT_GROUP_RANK[INSERT_BUTTON.key]
|
|
208
|
+
}],
|
|
209
|
+
component: function component() {
|
|
210
|
+
return /*#__PURE__*/React.createElement(InsertButton, {
|
|
211
|
+
api: api,
|
|
212
|
+
showElementBrowserLink: showElementBrowserLink,
|
|
213
|
+
tableSelectorSupported: tableSelectorSupported,
|
|
214
|
+
onInsertBlockType: onInsertBlockType,
|
|
215
|
+
nativeStatusSupported: nativeStatusSupported,
|
|
216
|
+
horizontalRuleEnabled: horizontalRuleEnabled,
|
|
217
|
+
expandEnabled: expandEnabled,
|
|
218
|
+
insertMenuItems: insertMenuItems,
|
|
219
|
+
numberOfButtons: 7 // TODO: ED-28759 - Default to 7 buttons - Remove this once we have a proper way to do toolbar responsiveness
|
|
220
|
+
});
|
|
221
|
+
}
|
|
158
222
|
}]);
|
|
159
223
|
};
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
type EmojiButtonProps = {
|
|
5
|
-
api?: ExtractInjectionAPI<InsertBlockPlugin>;
|
|
6
|
-
};
|
|
7
|
-
export declare const EmojiButton: ({ api }: EmojiButtonProps) => React.JSX.Element | null;
|
|
8
|
-
export {};
|
|
2
|
+
import type { BaseToolbarButtonProps } from './shared/types';
|
|
3
|
+
export declare const EmojiButton: ({ api, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement }: BaseToolbarButtonProps) => React.JSX.Element | null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI, Command } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
4
|
+
import type { InsertBlockPlugin } from '../../insertBlockPluginType';
|
|
5
|
+
type InsertButtonProps = {
|
|
6
|
+
api?: ExtractInjectionAPI<InsertBlockPlugin>;
|
|
7
|
+
expandEnabled?: boolean;
|
|
8
|
+
horizontalRuleEnabled?: boolean;
|
|
9
|
+
insertMenuItems?: MenuItem[];
|
|
10
|
+
isFullPageAppearance?: boolean;
|
|
11
|
+
nativeStatusSupported?: boolean;
|
|
12
|
+
numberOfButtons?: number;
|
|
13
|
+
onInsertBlockType?: (name: string) => Command;
|
|
14
|
+
showElementBrowserLink?: boolean;
|
|
15
|
+
tableSelectorSupported?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare const InsertButton: ({ api, showElementBrowserLink, isFullPageAppearance, tableSelectorSupported, nativeStatusSupported, horizontalRuleEnabled, expandEnabled, insertMenuItems, numberOfButtons, onInsertBlockType, }: InsertButtonProps) => React.JSX.Element | null;
|
|
18
|
+
export {};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
type TableSizePickerProps = {
|
|
5
|
-
api?: ExtractInjectionAPI<InsertBlockPlugin>;
|
|
2
|
+
import type { BaseToolbarButtonProps } from './shared/types';
|
|
3
|
+
interface TableSizePickerProps extends BaseToolbarButtonProps {
|
|
6
4
|
tableSelectorSupported?: boolean;
|
|
7
|
-
}
|
|
5
|
+
}
|
|
8
6
|
export declare const TableSizePicker: ({ api, tableSelectorSupported }: TableSizePickerProps) => React.JSX.Element | null;
|
|
9
7
|
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { EmojiId } from '@atlaskit/emoji/types';
|
|
4
|
+
import type { InsertBlockPlugin } from '../../../insertBlockPluginType';
|
|
5
|
+
interface UseEmojiPickerPopupProps {
|
|
6
|
+
api?: ExtractInjectionAPI<InsertBlockPlugin>;
|
|
7
|
+
buttonRef: React.RefObject<HTMLElement>;
|
|
8
|
+
}
|
|
9
|
+
export declare const useEmojiPickerPopup: ({ api, buttonRef }: UseEmojiPickerPopupProps) => {
|
|
10
|
+
handleSelectedEmoji: (emojiId: EmojiId) => true;
|
|
11
|
+
onPopupUnmount: () => void;
|
|
12
|
+
isOpen: boolean;
|
|
13
|
+
isOpenedByKeyboard: boolean;
|
|
14
|
+
toggle: (inputMethod?: import("@atlaskit/editor-common/types").TOOLBAR_MENU_TYPE | INPUT_METHOD) => void;
|
|
15
|
+
close: () => void;
|
|
16
|
+
handleEscapeKeydown: () => void;
|
|
17
|
+
handleClickOutside: (e: MouseEvent) => void;
|
|
18
|
+
handleKeyboardOpen: (event: React.KeyboardEvent) => void;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
3
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/dist/types/view';
|
|
4
|
+
import type { EmojiProvider } from '@atlaskit/emoji';
|
|
5
|
+
import type { InsertBlockPlugin } from '../../../insertBlockPluginType';
|
|
6
|
+
import type { BlockMenuItem } from '../../ToolbarInsertBlock/create-items';
|
|
7
|
+
interface UseInsertButtonStateProps {
|
|
8
|
+
api?: ExtractInjectionAPI<InsertBlockPlugin>;
|
|
9
|
+
editorView?: EditorView;
|
|
10
|
+
expandEnabled?: boolean;
|
|
11
|
+
horizontalRuleEnabled?: boolean;
|
|
12
|
+
insertMenuItems?: MenuItem[];
|
|
13
|
+
nativeStatusSupported?: boolean;
|
|
14
|
+
numberOfButtons?: number;
|
|
15
|
+
showElementBrowserLink?: boolean;
|
|
16
|
+
tableSelectorSupported?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface InsertButtonState {
|
|
19
|
+
dropdownItems: BlockMenuItem[];
|
|
20
|
+
emojiProvider?: EmojiProvider;
|
|
21
|
+
isTypeAheadAllowed?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare const useInsertButtonState: ({ api, editorView, horizontalRuleEnabled, insertMenuItems, nativeStatusSupported, numberOfButtons, tableSelectorSupported, expandEnabled, showElementBrowserLink }: UseInsertButtonStateProps) => InsertButtonState;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { RefObject } from 'react';
|
|
2
|
+
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import type { TOOLBAR_MENU_TYPE } from '@atlaskit/editor-common/types';
|
|
4
|
+
interface PopupManagerConfig {
|
|
5
|
+
analytics?: {
|
|
6
|
+
onToggle?: (isOpen: boolean, inputMethod?: TOOLBAR_MENU_TYPE | INPUT_METHOD) => void;
|
|
7
|
+
};
|
|
8
|
+
focusTarget?: RefObject<HTMLElement>;
|
|
9
|
+
onClose?: () => void;
|
|
10
|
+
onOpen?: (inputMethod?: TOOLBAR_MENU_TYPE | INPUT_METHOD) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const usePopupManager: (config?: PopupManagerConfig) => {
|
|
13
|
+
isOpen: boolean;
|
|
14
|
+
isOpenedByKeyboard: boolean;
|
|
15
|
+
toggle: (inputMethod?: TOOLBAR_MENU_TYPE | INPUT_METHOD) => void;
|
|
16
|
+
close: () => void;
|
|
17
|
+
handleEscapeKeydown: () => void;
|
|
18
|
+
handleClickOutside: (e: MouseEvent) => void;
|
|
19
|
+
handleKeyboardOpen: (event: React.KeyboardEvent) => void;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { InsertBlockPlugin } from '../../../insertBlockPluginType';
|
|
4
|
+
interface UseTableSelectorPopupProps {
|
|
5
|
+
api?: ExtractInjectionAPI<InsertBlockPlugin>;
|
|
6
|
+
buttonRef: React.RefObject<HTMLElement>;
|
|
7
|
+
}
|
|
8
|
+
export declare const useTableSelectorPopup: ({ api, buttonRef }: UseTableSelectorPopupProps) => {
|
|
9
|
+
handleSelectedTableSize: (rowsCount: number, colsCount: number) => void;
|
|
10
|
+
onPopupUnmount: () => void;
|
|
11
|
+
isOpen: boolean;
|
|
12
|
+
isOpenedByKeyboard: boolean;
|
|
13
|
+
toggle: (inputMethod?: import("@atlaskit/editor-common/types").TOOLBAR_MENU_TYPE | INPUT_METHOD) => void;
|
|
14
|
+
close: () => void;
|
|
15
|
+
handleEscapeKeydown: () => void;
|
|
16
|
+
handleClickOutside: (e: MouseEvent) => void;
|
|
17
|
+
handleKeyboardOpen: (event: React.KeyboardEvent) => void;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { EmojiId, EmojiProvider } from '@atlaskit/emoji/types';
|
|
3
|
+
interface EmojiPickerPopupProps {
|
|
4
|
+
emojiProvider?: Promise<EmojiProvider>;
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
onClickOutside: (e: MouseEvent) => void;
|
|
7
|
+
onEscapeKeydown: () => void;
|
|
8
|
+
onSelection: (emojiId: EmojiId) => boolean;
|
|
9
|
+
onUnmount: () => void;
|
|
10
|
+
popupsBoundariesElement?: HTMLElement;
|
|
11
|
+
popupsMountPoint?: HTMLElement;
|
|
12
|
+
popupsScrollableElement?: HTMLElement;
|
|
13
|
+
targetRef: React.RefObject<HTMLElement>;
|
|
14
|
+
}
|
|
15
|
+
export declare const EmojiPickerPopup: ({ isOpen, targetRef, emojiProvider, onSelection, onClickOutside, onEscapeKeydown, onUnmount, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, }: EmojiPickerPopupProps) => React.JSX.Element | null;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface TableSelectorPopupWrapperProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
isOpenedByKeyboard: boolean;
|
|
5
|
+
onClickOutside: (e: MouseEvent) => void;
|
|
6
|
+
onEscapeKeydown: () => void;
|
|
7
|
+
onSelection: (rowsCount: number, colsCount: number) => void;
|
|
8
|
+
onUnmount: () => void;
|
|
9
|
+
popupsBoundariesElement?: HTMLElement;
|
|
10
|
+
popupsMountPoint?: HTMLElement;
|
|
11
|
+
popupsScrollableElement?: HTMLElement;
|
|
12
|
+
targetRef: React.RefObject<HTMLElement>;
|
|
13
|
+
}
|
|
14
|
+
export declare const TableSelectorPopupWrapper: ({ isOpen, targetRef, isOpenedByKeyboard, onSelection, onClickOutside, onEscapeKeydown, onUnmount, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement, }: TableSelectorPopupWrapperProps) => React.JSX.Element | null;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const POPUP_Z_INDEX = "akEditorMenuZIndex";
|
|
2
|
+
export declare const POPUP_DIMENSIONS: {
|
|
3
|
+
readonly EMOJI_PICKER: {
|
|
4
|
+
readonly fitHeight: 350;
|
|
5
|
+
readonly fitWidth: 350;
|
|
6
|
+
readonly offset: [number, number];
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare const FOCUS_DELAY: {
|
|
10
|
+
readonly ANIMATION_FRAME: "requestAnimationFrame";
|
|
11
|
+
readonly MICROTASK: "queueMicrotask";
|
|
12
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { InsertBlockPlugin } from '../../../insertBlockPluginType';
|
|
3
|
+
export interface BaseToolbarButtonProps {
|
|
4
|
+
api?: ExtractInjectionAPI<InsertBlockPlugin>;
|
|
5
|
+
popupsBoundariesElement?: HTMLElement;
|
|
6
|
+
popupsMountPoint?: HTMLElement;
|
|
7
|
+
popupsScrollableElement?: HTMLElement;
|
|
8
|
+
}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
1
|
+
import type { Command, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
2
3
|
import type { RegisterComponent } from '@atlaskit/editor-toolbar-model';
|
|
3
4
|
import type { InsertBlockPlugin } from '../insertBlockPluginType';
|
|
4
5
|
type GetToolbarComponentsProps = {
|
|
5
6
|
api?: ExtractInjectionAPI<InsertBlockPlugin>;
|
|
7
|
+
expandEnabled?: boolean;
|
|
8
|
+
horizontalRuleEnabled?: boolean;
|
|
9
|
+
insertMenuItems?: MenuItem[];
|
|
10
|
+
nativeStatusSupported?: boolean;
|
|
11
|
+
onInsertBlockType?: (name: string) => Command;
|
|
12
|
+
showElementBrowserLink?: boolean;
|
|
6
13
|
tableSelectorSupported?: boolean;
|
|
7
14
|
toolbarShowPlusInsertOnly?: boolean;
|
|
8
15
|
};
|
|
9
|
-
export declare const getToolbarComponents: ({ api, tableSelectorSupported, toolbarShowPlusInsertOnly, }: GetToolbarComponentsProps) => RegisterComponent[];
|
|
16
|
+
export declare const getToolbarComponents: ({ api, tableSelectorSupported, toolbarShowPlusInsertOnly, showElementBrowserLink, onInsertBlockType, nativeStatusSupported, horizontalRuleEnabled, expandEnabled, insertMenuItems, }: GetToolbarComponentsProps) => RegisterComponent[];
|
|
10
17
|
export {};
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
type EmojiButtonProps = {
|
|
5
|
-
api?: ExtractInjectionAPI<InsertBlockPlugin>;
|
|
6
|
-
};
|
|
7
|
-
export declare const EmojiButton: ({ api }: EmojiButtonProps) => React.JSX.Element | null;
|
|
8
|
-
export {};
|
|
2
|
+
import type { BaseToolbarButtonProps } from './shared/types';
|
|
3
|
+
export declare const EmojiButton: ({ api, popupsMountPoint, popupsBoundariesElement, popupsScrollableElement }: BaseToolbarButtonProps) => React.JSX.Element | null;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ExtractInjectionAPI, Command } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
4
|
+
import type { InsertBlockPlugin } from '../../insertBlockPluginType';
|
|
5
|
+
type InsertButtonProps = {
|
|
6
|
+
api?: ExtractInjectionAPI<InsertBlockPlugin>;
|
|
7
|
+
expandEnabled?: boolean;
|
|
8
|
+
horizontalRuleEnabled?: boolean;
|
|
9
|
+
insertMenuItems?: MenuItem[];
|
|
10
|
+
isFullPageAppearance?: boolean;
|
|
11
|
+
nativeStatusSupported?: boolean;
|
|
12
|
+
numberOfButtons?: number;
|
|
13
|
+
onInsertBlockType?: (name: string) => Command;
|
|
14
|
+
showElementBrowserLink?: boolean;
|
|
15
|
+
tableSelectorSupported?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare const InsertButton: ({ api, showElementBrowserLink, isFullPageAppearance, tableSelectorSupported, nativeStatusSupported, horizontalRuleEnabled, expandEnabled, insertMenuItems, numberOfButtons, onInsertBlockType, }: InsertButtonProps) => React.JSX.Element | null;
|
|
18
|
+
export {};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
type TableSizePickerProps = {
|
|
5
|
-
api?: ExtractInjectionAPI<InsertBlockPlugin>;
|
|
2
|
+
import type { BaseToolbarButtonProps } from './shared/types';
|
|
3
|
+
interface TableSizePickerProps extends BaseToolbarButtonProps {
|
|
6
4
|
tableSelectorSupported?: boolean;
|
|
7
|
-
}
|
|
5
|
+
}
|
|
8
6
|
export declare const TableSizePicker: ({ api, tableSelectorSupported }: TableSizePickerProps) => React.JSX.Element | null;
|
|
9
7
|
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { EmojiId } from '@atlaskit/emoji/types';
|
|
4
|
+
import type { InsertBlockPlugin } from '../../../insertBlockPluginType';
|
|
5
|
+
interface UseEmojiPickerPopupProps {
|
|
6
|
+
api?: ExtractInjectionAPI<InsertBlockPlugin>;
|
|
7
|
+
buttonRef: React.RefObject<HTMLElement>;
|
|
8
|
+
}
|
|
9
|
+
export declare const useEmojiPickerPopup: ({ api, buttonRef }: UseEmojiPickerPopupProps) => {
|
|
10
|
+
handleSelectedEmoji: (emojiId: EmojiId) => true;
|
|
11
|
+
onPopupUnmount: () => void;
|
|
12
|
+
isOpen: boolean;
|
|
13
|
+
isOpenedByKeyboard: boolean;
|
|
14
|
+
toggle: (inputMethod?: import("@atlaskit/editor-common/types").TOOLBAR_MENU_TYPE | INPUT_METHOD) => void;
|
|
15
|
+
close: () => void;
|
|
16
|
+
handleEscapeKeydown: () => void;
|
|
17
|
+
handleClickOutside: (e: MouseEvent) => void;
|
|
18
|
+
handleKeyboardOpen: (event: React.KeyboardEvent) => void;
|
|
19
|
+
};
|
|
20
|
+
export {};
|