@atlaskit/editor-plugin-insert-block 31.0.4 → 31.0.6
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 +14 -0
- package/package.json +4 -4
- package/dist/cjs/ui/ElementRail/useInsertMenuRailItems.js +0 -82
- package/dist/cjs/ui/toolbar-components/shared/constants.js +0 -18
- package/dist/es2019/ui/ElementRail/useInsertMenuRailItems.js +0 -73
- package/dist/es2019/ui/toolbar-components/shared/constants.js +0 -12
- package/dist/esm/ui/ElementRail/useInsertMenuRailItems.js +0 -75
- package/dist/esm/ui/toolbar-components/shared/constants.js +0 -12
- package/dist/types/ui/ElementRail/useInsertMenuRailItems.d.ts +0 -6
- package/dist/types/ui/toolbar-components/shared/constants.d.ts +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-insert-block
|
|
2
2
|
|
|
3
|
+
## 31.0.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 31.0.5
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`827a297d8c605`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/827a297d8c605) -
|
|
14
|
+
Delete unreachable source files
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 31.0.4
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-insert-block",
|
|
3
|
-
"version": "31.0.
|
|
3
|
+
"version": "31.0.6",
|
|
4
4
|
"description": "Insert block plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@atlaskit/editor-plugin-connectivity": "^30.0.0",
|
|
30
30
|
"@atlaskit/editor-plugin-date": "^32.0.0",
|
|
31
31
|
"@atlaskit/editor-plugin-emoji": "^31.0.0",
|
|
32
|
-
"@atlaskit/editor-plugin-expand": "^31.
|
|
32
|
+
"@atlaskit/editor-plugin-expand": "^31.1.0",
|
|
33
33
|
"@atlaskit/editor-plugin-extension": "^33.0.0",
|
|
34
34
|
"@atlaskit/editor-plugin-feature-flags": "^29.0.0",
|
|
35
35
|
"@atlaskit/editor-plugin-hyperlink": "^32.0.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@atlaskit/editor-plugin-type-ahead": "^31.0.0",
|
|
52
52
|
"@atlaskit/editor-plugin-ui-control-registry": "^24.0.0",
|
|
53
53
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
54
|
-
"@atlaskit/editor-shared-styles": "^
|
|
54
|
+
"@atlaskit/editor-shared-styles": "^5.0.0",
|
|
55
55
|
"@atlaskit/editor-toolbar": "^2.8.0",
|
|
56
56
|
"@atlaskit/editor-toolbar-model": "^1.2.0",
|
|
57
57
|
"@atlaskit/editor-ui-control-model": "^3.0.0",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"react-virtualized": "^9.22.6"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
|
-
"@atlaskit/editor-common": "^134.
|
|
75
|
+
"@atlaskit/editor-common": "^134.4.0",
|
|
76
76
|
"react": "^18.2.0 || ^19.2.0",
|
|
77
77
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
78
78
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.useInsertMenuRailItems = void 0;
|
|
8
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
-
var _react = require("react");
|
|
10
|
-
var _reactIntl = require("react-intl");
|
|
11
|
-
var _useSharedPluginStateWithSelector = require("@atlaskit/editor-common/useSharedPluginStateWithSelector");
|
|
12
|
-
var _createItems = require("../ToolbarInsertBlock/create-items");
|
|
13
|
-
var selector = function selector(states) {
|
|
14
|
-
var _states$dateState, _states$hyperlinkStat, _states$hyperlinkStat2, _states$typeAheadStat, _states$blockTypeStat, _states$imageUploadSt, _states$placeholderTe, _states$emojiState, _states$mentionState, _states$mentionState2, _states$mediaState;
|
|
15
|
-
return {
|
|
16
|
-
dateEnabled: (_states$dateState = states.dateState) === null || _states$dateState === void 0 ? void 0 : _states$dateState.isInitialised,
|
|
17
|
-
canInsertLink: (_states$hyperlinkStat = states.hyperlinkState) === null || _states$hyperlinkStat === void 0 ? void 0 : _states$hyperlinkStat.canInsertLink,
|
|
18
|
-
activeLinkMark: (_states$hyperlinkStat2 = states.hyperlinkState) === null || _states$hyperlinkStat2 === void 0 ? void 0 : _states$hyperlinkStat2.activeLinkMark,
|
|
19
|
-
isTypeAheadAllowed: (_states$typeAheadStat = states.typeAheadState) === null || _states$typeAheadStat === void 0 ? void 0 : _states$typeAheadStat.isAllowed,
|
|
20
|
-
availableWrapperBlockTypes: (_states$blockTypeStat = states.blockTypeState) === null || _states$blockTypeStat === void 0 ? void 0 : _states$blockTypeStat.availableWrapperBlockTypes,
|
|
21
|
-
imageUploadEnabled: (_states$imageUploadSt = states.imageUploadState) === null || _states$imageUploadSt === void 0 ? void 0 : _states$imageUploadSt.enabled,
|
|
22
|
-
placeholderTextAllowInserting: (_states$placeholderTe = states.placeholderTextState) === null || _states$placeholderTe === void 0 ? void 0 : _states$placeholderTe.allowInserting,
|
|
23
|
-
emojiProvider: (_states$emojiState = states.emojiState) === null || _states$emojiState === void 0 ? void 0 : _states$emojiState.emojiProvider,
|
|
24
|
-
mentionProvider: (_states$mentionState = states.mentionState) === null || _states$mentionState === void 0 ? void 0 : _states$mentionState.mentionProvider,
|
|
25
|
-
canInsertMention: (_states$mentionState2 = states.mentionState) === null || _states$mentionState2 === void 0 ? void 0 : _states$mentionState2.canInsertMention,
|
|
26
|
-
mediaAllowsUploads: (_states$mediaState = states.mediaState) === null || _states$mediaState === void 0 ? void 0 : _states$mediaState.allowsUploads
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
var useInsertMenuRailItems = exports.useInsertMenuRailItems = function useInsertMenuRailItems(editorView, options, api) {
|
|
30
|
-
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
31
|
-
formatMessage = _useIntl.formatMessage;
|
|
32
|
-
var _useSharedPluginState = (0, _useSharedPluginStateWithSelector.useSharedPluginStateWithSelector)(api, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText'], selector),
|
|
33
|
-
dateEnabled = _useSharedPluginState.dateEnabled,
|
|
34
|
-
canInsertLink = _useSharedPluginState.canInsertLink,
|
|
35
|
-
activeLinkMark = _useSharedPluginState.activeLinkMark,
|
|
36
|
-
isTypeAheadAllowed = _useSharedPluginState.isTypeAheadAllowed,
|
|
37
|
-
availableWrapperBlockTypes = _useSharedPluginState.availableWrapperBlockTypes,
|
|
38
|
-
imageUploadEnabled = _useSharedPluginState.imageUploadEnabled,
|
|
39
|
-
placeholderTextAllowInserting = _useSharedPluginState.placeholderTextAllowInserting,
|
|
40
|
-
emojiProvider = _useSharedPluginState.emojiProvider,
|
|
41
|
-
mentionProvider = _useSharedPluginState.mentionProvider,
|
|
42
|
-
canInsertMention = _useSharedPluginState.canInsertMention,
|
|
43
|
-
mediaAllowsUploads = _useSharedPluginState.mediaAllowsUploads;
|
|
44
|
-
var _useMemo = (0, _react.useMemo)(function () {
|
|
45
|
-
return (0, _createItems.createItems)({
|
|
46
|
-
isTypeAheadAllowed: Boolean(isTypeAheadAllowed),
|
|
47
|
-
tableSupported: !!editorView.state.schema.nodes.table,
|
|
48
|
-
tableSelectorSupported: options.tableSelectorSupported && !!editorView.state.schema.nodes.table,
|
|
49
|
-
mediaUploadsEnabled: mediaAllowsUploads !== null && mediaAllowsUploads !== void 0 ? mediaAllowsUploads : undefined,
|
|
50
|
-
mediaSupported: mediaAllowsUploads !== undefined,
|
|
51
|
-
imageUploadSupported: !!(api !== null && api !== void 0 && api.imageUpload),
|
|
52
|
-
imageUploadEnabled: imageUploadEnabled,
|
|
53
|
-
mentionsSupported: !!mentionProvider,
|
|
54
|
-
mentionsDisabled: !canInsertMention,
|
|
55
|
-
actionSupported: !!editorView.state.schema.nodes.taskItem,
|
|
56
|
-
decisionSupported: !!editorView.state.schema.nodes.decisionItem,
|
|
57
|
-
linkSupported: canInsertLink !== undefined,
|
|
58
|
-
linkDisabled: !canInsertLink || !!activeLinkMark,
|
|
59
|
-
emojiDisabled: !emojiProvider,
|
|
60
|
-
nativeStatusSupported: options.nativeStatusSupported,
|
|
61
|
-
dateEnabled: !!dateEnabled,
|
|
62
|
-
placeholderTextEnabled: placeholderTextAllowInserting,
|
|
63
|
-
horizontalRuleEnabled: options.horizontalRuleEnabled,
|
|
64
|
-
layoutSectionEnabled: Boolean(api === null || api === void 0 ? void 0 : api.layout),
|
|
65
|
-
expandEnabled: !!options.allowExpand,
|
|
66
|
-
showElementBrowserLink: options.showElementBrowserLink,
|
|
67
|
-
emojiProvider: emojiProvider,
|
|
68
|
-
availableWrapperBlockTypes: availableWrapperBlockTypes,
|
|
69
|
-
insertMenuItems: options.insertMenuItems,
|
|
70
|
-
schema: editorView.state.schema,
|
|
71
|
-
// numberOfButtons controls what items are returned and eventually display in the insert menu - but it relies on the main toolbar width which
|
|
72
|
-
// is not easily available here. I've used 7 as it's the value used for most widths see toolbarSizeToButtons
|
|
73
|
-
numberOfButtons: 7,
|
|
74
|
-
formatMessage: formatMessage,
|
|
75
|
-
isNewMenuEnabled: true
|
|
76
|
-
});
|
|
77
|
-
}, [activeLinkMark, api === null || api === void 0 ? void 0 : api.imageUpload, api === null || api === void 0 ? void 0 : api.layout, availableWrapperBlockTypes, canInsertLink, canInsertMention, dateEnabled, editorView.state.schema, emojiProvider, formatMessage, imageUploadEnabled, isTypeAheadAllowed, mediaAllowsUploads, mentionProvider, options.allowExpand, options.horizontalRuleEnabled, options.insertMenuItems, options.nativeStatusSupported, options.showElementBrowserLink, options.tableSelectorSupported, placeholderTextAllowInserting]),
|
|
78
|
-
_useMemo2 = (0, _slicedToArray2.default)(_useMemo, 2),
|
|
79
|
-
_ = _useMemo2[0],
|
|
80
|
-
dropdownItems = _useMemo2[1];
|
|
81
|
-
return dropdownItems;
|
|
82
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.POPUP_Z_INDEX = exports.POPUP_DIMENSIONS = exports.FOCUS_DELAY = void 0;
|
|
7
|
-
var POPUP_Z_INDEX = exports.POPUP_Z_INDEX = 'akEditorMenuZIndex';
|
|
8
|
-
var POPUP_DIMENSIONS = exports.POPUP_DIMENSIONS = {
|
|
9
|
-
EMOJI_PICKER: {
|
|
10
|
-
fitHeight: 350,
|
|
11
|
-
fitWidth: 350,
|
|
12
|
-
offset: [0, 3]
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
var FOCUS_DELAY = exports.FOCUS_DELAY = {
|
|
16
|
-
ANIMATION_FRAME: 'requestAnimationFrame',
|
|
17
|
-
MICROTASK: 'queueMicrotask'
|
|
18
|
-
};
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
import { useIntl } from 'react-intl';
|
|
3
|
-
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
|
|
4
|
-
import { createItems } from '../ToolbarInsertBlock/create-items';
|
|
5
|
-
const selector = states => {
|
|
6
|
-
var _states$dateState, _states$hyperlinkStat, _states$hyperlinkStat2, _states$typeAheadStat, _states$blockTypeStat, _states$imageUploadSt, _states$placeholderTe, _states$emojiState, _states$mentionState, _states$mentionState2, _states$mediaState;
|
|
7
|
-
return {
|
|
8
|
-
dateEnabled: (_states$dateState = states.dateState) === null || _states$dateState === void 0 ? void 0 : _states$dateState.isInitialised,
|
|
9
|
-
canInsertLink: (_states$hyperlinkStat = states.hyperlinkState) === null || _states$hyperlinkStat === void 0 ? void 0 : _states$hyperlinkStat.canInsertLink,
|
|
10
|
-
activeLinkMark: (_states$hyperlinkStat2 = states.hyperlinkState) === null || _states$hyperlinkStat2 === void 0 ? void 0 : _states$hyperlinkStat2.activeLinkMark,
|
|
11
|
-
isTypeAheadAllowed: (_states$typeAheadStat = states.typeAheadState) === null || _states$typeAheadStat === void 0 ? void 0 : _states$typeAheadStat.isAllowed,
|
|
12
|
-
availableWrapperBlockTypes: (_states$blockTypeStat = states.blockTypeState) === null || _states$blockTypeStat === void 0 ? void 0 : _states$blockTypeStat.availableWrapperBlockTypes,
|
|
13
|
-
imageUploadEnabled: (_states$imageUploadSt = states.imageUploadState) === null || _states$imageUploadSt === void 0 ? void 0 : _states$imageUploadSt.enabled,
|
|
14
|
-
placeholderTextAllowInserting: (_states$placeholderTe = states.placeholderTextState) === null || _states$placeholderTe === void 0 ? void 0 : _states$placeholderTe.allowInserting,
|
|
15
|
-
emojiProvider: (_states$emojiState = states.emojiState) === null || _states$emojiState === void 0 ? void 0 : _states$emojiState.emojiProvider,
|
|
16
|
-
mentionProvider: (_states$mentionState = states.mentionState) === null || _states$mentionState === void 0 ? void 0 : _states$mentionState.mentionProvider,
|
|
17
|
-
canInsertMention: (_states$mentionState2 = states.mentionState) === null || _states$mentionState2 === void 0 ? void 0 : _states$mentionState2.canInsertMention,
|
|
18
|
-
mediaAllowsUploads: (_states$mediaState = states.mediaState) === null || _states$mediaState === void 0 ? void 0 : _states$mediaState.allowsUploads
|
|
19
|
-
};
|
|
20
|
-
};
|
|
21
|
-
export const useInsertMenuRailItems = (editorView, options, api) => {
|
|
22
|
-
const {
|
|
23
|
-
formatMessage
|
|
24
|
-
} = useIntl();
|
|
25
|
-
const {
|
|
26
|
-
dateEnabled,
|
|
27
|
-
canInsertLink,
|
|
28
|
-
activeLinkMark,
|
|
29
|
-
isTypeAheadAllowed,
|
|
30
|
-
availableWrapperBlockTypes,
|
|
31
|
-
imageUploadEnabled,
|
|
32
|
-
placeholderTextAllowInserting,
|
|
33
|
-
emojiProvider,
|
|
34
|
-
mentionProvider,
|
|
35
|
-
canInsertMention,
|
|
36
|
-
mediaAllowsUploads
|
|
37
|
-
} = useSharedPluginStateWithSelector(api, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText'], selector);
|
|
38
|
-
const [_, dropdownItems] = useMemo(() => {
|
|
39
|
-
return createItems({
|
|
40
|
-
isTypeAheadAllowed: Boolean(isTypeAheadAllowed),
|
|
41
|
-
tableSupported: !!editorView.state.schema.nodes.table,
|
|
42
|
-
tableSelectorSupported: options.tableSelectorSupported && !!editorView.state.schema.nodes.table,
|
|
43
|
-
mediaUploadsEnabled: mediaAllowsUploads !== null && mediaAllowsUploads !== void 0 ? mediaAllowsUploads : undefined,
|
|
44
|
-
mediaSupported: mediaAllowsUploads !== undefined,
|
|
45
|
-
imageUploadSupported: !!(api !== null && api !== void 0 && api.imageUpload),
|
|
46
|
-
imageUploadEnabled: imageUploadEnabled,
|
|
47
|
-
mentionsSupported: !!mentionProvider,
|
|
48
|
-
mentionsDisabled: !canInsertMention,
|
|
49
|
-
actionSupported: !!editorView.state.schema.nodes.taskItem,
|
|
50
|
-
decisionSupported: !!editorView.state.schema.nodes.decisionItem,
|
|
51
|
-
linkSupported: canInsertLink !== undefined,
|
|
52
|
-
linkDisabled: !canInsertLink || !!activeLinkMark,
|
|
53
|
-
emojiDisabled: !emojiProvider,
|
|
54
|
-
nativeStatusSupported: options.nativeStatusSupported,
|
|
55
|
-
dateEnabled: !!dateEnabled,
|
|
56
|
-
placeholderTextEnabled: placeholderTextAllowInserting,
|
|
57
|
-
horizontalRuleEnabled: options.horizontalRuleEnabled,
|
|
58
|
-
layoutSectionEnabled: Boolean(api === null || api === void 0 ? void 0 : api.layout),
|
|
59
|
-
expandEnabled: !!options.allowExpand,
|
|
60
|
-
showElementBrowserLink: options.showElementBrowserLink,
|
|
61
|
-
emojiProvider: emojiProvider,
|
|
62
|
-
availableWrapperBlockTypes: availableWrapperBlockTypes,
|
|
63
|
-
insertMenuItems: options.insertMenuItems,
|
|
64
|
-
schema: editorView.state.schema,
|
|
65
|
-
// numberOfButtons controls what items are returned and eventually display in the insert menu - but it relies on the main toolbar width which
|
|
66
|
-
// is not easily available here. I've used 7 as it's the value used for most widths see toolbarSizeToButtons
|
|
67
|
-
numberOfButtons: 7,
|
|
68
|
-
formatMessage,
|
|
69
|
-
isNewMenuEnabled: true
|
|
70
|
-
});
|
|
71
|
-
}, [activeLinkMark, api === null || api === void 0 ? void 0 : api.imageUpload, api === null || api === void 0 ? void 0 : api.layout, availableWrapperBlockTypes, canInsertLink, canInsertMention, dateEnabled, editorView.state.schema, emojiProvider, formatMessage, imageUploadEnabled, isTypeAheadAllowed, mediaAllowsUploads, mentionProvider, options.allowExpand, options.horizontalRuleEnabled, options.insertMenuItems, options.nativeStatusSupported, options.showElementBrowserLink, options.tableSelectorSupported, placeholderTextAllowInserting]);
|
|
72
|
-
return dropdownItems;
|
|
73
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export const POPUP_Z_INDEX = 'akEditorMenuZIndex';
|
|
2
|
-
export const POPUP_DIMENSIONS = {
|
|
3
|
-
EMOJI_PICKER: {
|
|
4
|
-
fitHeight: 350,
|
|
5
|
-
fitWidth: 350,
|
|
6
|
-
offset: [0, 3]
|
|
7
|
-
}
|
|
8
|
-
};
|
|
9
|
-
export const FOCUS_DELAY = {
|
|
10
|
-
ANIMATION_FRAME: 'requestAnimationFrame',
|
|
11
|
-
MICROTASK: 'queueMicrotask'
|
|
12
|
-
};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
|
-
import { useIntl } from 'react-intl';
|
|
4
|
-
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
|
|
5
|
-
import { createItems } from '../ToolbarInsertBlock/create-items';
|
|
6
|
-
var selector = function selector(states) {
|
|
7
|
-
var _states$dateState, _states$hyperlinkStat, _states$hyperlinkStat2, _states$typeAheadStat, _states$blockTypeStat, _states$imageUploadSt, _states$placeholderTe, _states$emojiState, _states$mentionState, _states$mentionState2, _states$mediaState;
|
|
8
|
-
return {
|
|
9
|
-
dateEnabled: (_states$dateState = states.dateState) === null || _states$dateState === void 0 ? void 0 : _states$dateState.isInitialised,
|
|
10
|
-
canInsertLink: (_states$hyperlinkStat = states.hyperlinkState) === null || _states$hyperlinkStat === void 0 ? void 0 : _states$hyperlinkStat.canInsertLink,
|
|
11
|
-
activeLinkMark: (_states$hyperlinkStat2 = states.hyperlinkState) === null || _states$hyperlinkStat2 === void 0 ? void 0 : _states$hyperlinkStat2.activeLinkMark,
|
|
12
|
-
isTypeAheadAllowed: (_states$typeAheadStat = states.typeAheadState) === null || _states$typeAheadStat === void 0 ? void 0 : _states$typeAheadStat.isAllowed,
|
|
13
|
-
availableWrapperBlockTypes: (_states$blockTypeStat = states.blockTypeState) === null || _states$blockTypeStat === void 0 ? void 0 : _states$blockTypeStat.availableWrapperBlockTypes,
|
|
14
|
-
imageUploadEnabled: (_states$imageUploadSt = states.imageUploadState) === null || _states$imageUploadSt === void 0 ? void 0 : _states$imageUploadSt.enabled,
|
|
15
|
-
placeholderTextAllowInserting: (_states$placeholderTe = states.placeholderTextState) === null || _states$placeholderTe === void 0 ? void 0 : _states$placeholderTe.allowInserting,
|
|
16
|
-
emojiProvider: (_states$emojiState = states.emojiState) === null || _states$emojiState === void 0 ? void 0 : _states$emojiState.emojiProvider,
|
|
17
|
-
mentionProvider: (_states$mentionState = states.mentionState) === null || _states$mentionState === void 0 ? void 0 : _states$mentionState.mentionProvider,
|
|
18
|
-
canInsertMention: (_states$mentionState2 = states.mentionState) === null || _states$mentionState2 === void 0 ? void 0 : _states$mentionState2.canInsertMention,
|
|
19
|
-
mediaAllowsUploads: (_states$mediaState = states.mediaState) === null || _states$mediaState === void 0 ? void 0 : _states$mediaState.allowsUploads
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
export var useInsertMenuRailItems = function useInsertMenuRailItems(editorView, options, api) {
|
|
23
|
-
var _useIntl = useIntl(),
|
|
24
|
-
formatMessage = _useIntl.formatMessage;
|
|
25
|
-
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['hyperlink', 'date', 'imageUpload', 'mention', 'emoji', 'blockType', 'media', 'typeAhead', 'placeholderText'], selector),
|
|
26
|
-
dateEnabled = _useSharedPluginState.dateEnabled,
|
|
27
|
-
canInsertLink = _useSharedPluginState.canInsertLink,
|
|
28
|
-
activeLinkMark = _useSharedPluginState.activeLinkMark,
|
|
29
|
-
isTypeAheadAllowed = _useSharedPluginState.isTypeAheadAllowed,
|
|
30
|
-
availableWrapperBlockTypes = _useSharedPluginState.availableWrapperBlockTypes,
|
|
31
|
-
imageUploadEnabled = _useSharedPluginState.imageUploadEnabled,
|
|
32
|
-
placeholderTextAllowInserting = _useSharedPluginState.placeholderTextAllowInserting,
|
|
33
|
-
emojiProvider = _useSharedPluginState.emojiProvider,
|
|
34
|
-
mentionProvider = _useSharedPluginState.mentionProvider,
|
|
35
|
-
canInsertMention = _useSharedPluginState.canInsertMention,
|
|
36
|
-
mediaAllowsUploads = _useSharedPluginState.mediaAllowsUploads;
|
|
37
|
-
var _useMemo = useMemo(function () {
|
|
38
|
-
return createItems({
|
|
39
|
-
isTypeAheadAllowed: Boolean(isTypeAheadAllowed),
|
|
40
|
-
tableSupported: !!editorView.state.schema.nodes.table,
|
|
41
|
-
tableSelectorSupported: options.tableSelectorSupported && !!editorView.state.schema.nodes.table,
|
|
42
|
-
mediaUploadsEnabled: mediaAllowsUploads !== null && mediaAllowsUploads !== void 0 ? mediaAllowsUploads : undefined,
|
|
43
|
-
mediaSupported: mediaAllowsUploads !== undefined,
|
|
44
|
-
imageUploadSupported: !!(api !== null && api !== void 0 && api.imageUpload),
|
|
45
|
-
imageUploadEnabled: imageUploadEnabled,
|
|
46
|
-
mentionsSupported: !!mentionProvider,
|
|
47
|
-
mentionsDisabled: !canInsertMention,
|
|
48
|
-
actionSupported: !!editorView.state.schema.nodes.taskItem,
|
|
49
|
-
decisionSupported: !!editorView.state.schema.nodes.decisionItem,
|
|
50
|
-
linkSupported: canInsertLink !== undefined,
|
|
51
|
-
linkDisabled: !canInsertLink || !!activeLinkMark,
|
|
52
|
-
emojiDisabled: !emojiProvider,
|
|
53
|
-
nativeStatusSupported: options.nativeStatusSupported,
|
|
54
|
-
dateEnabled: !!dateEnabled,
|
|
55
|
-
placeholderTextEnabled: placeholderTextAllowInserting,
|
|
56
|
-
horizontalRuleEnabled: options.horizontalRuleEnabled,
|
|
57
|
-
layoutSectionEnabled: Boolean(api === null || api === void 0 ? void 0 : api.layout),
|
|
58
|
-
expandEnabled: !!options.allowExpand,
|
|
59
|
-
showElementBrowserLink: options.showElementBrowserLink,
|
|
60
|
-
emojiProvider: emojiProvider,
|
|
61
|
-
availableWrapperBlockTypes: availableWrapperBlockTypes,
|
|
62
|
-
insertMenuItems: options.insertMenuItems,
|
|
63
|
-
schema: editorView.state.schema,
|
|
64
|
-
// numberOfButtons controls what items are returned and eventually display in the insert menu - but it relies on the main toolbar width which
|
|
65
|
-
// is not easily available here. I've used 7 as it's the value used for most widths see toolbarSizeToButtons
|
|
66
|
-
numberOfButtons: 7,
|
|
67
|
-
formatMessage: formatMessage,
|
|
68
|
-
isNewMenuEnabled: true
|
|
69
|
-
});
|
|
70
|
-
}, [activeLinkMark, api === null || api === void 0 ? void 0 : api.imageUpload, api === null || api === void 0 ? void 0 : api.layout, availableWrapperBlockTypes, canInsertLink, canInsertMention, dateEnabled, editorView.state.schema, emojiProvider, formatMessage, imageUploadEnabled, isTypeAheadAllowed, mediaAllowsUploads, mentionProvider, options.allowExpand, options.horizontalRuleEnabled, options.insertMenuItems, options.nativeStatusSupported, options.showElementBrowserLink, options.tableSelectorSupported, placeholderTextAllowInserting]),
|
|
71
|
-
_useMemo2 = _slicedToArray(_useMemo, 2),
|
|
72
|
-
_ = _useMemo2[0],
|
|
73
|
-
dropdownItems = _useMemo2[1];
|
|
74
|
-
return dropdownItems;
|
|
75
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types/next-editor-plugin';
|
|
2
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
3
|
-
import type { insertBlockPlugin } from '../../insertBlockPlugin';
|
|
4
|
-
import type { InsertBlockOptions } from '../../types';
|
|
5
|
-
import type { BlockMenuItem } from '../ToolbarInsertBlock/create-items';
|
|
6
|
-
export declare const useInsertMenuRailItems: (editorView: EditorView, options: InsertBlockOptions, api?: ExtractInjectionAPI<typeof insertBlockPlugin>) => BlockMenuItem[];
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
};
|