@atlaskit/editor-plugin-paste-options-toolbar 8.2.4 → 8.4.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 +24 -0
- package/dist/cjs/editor-commands/commands.js +5 -1
- package/dist/cjs/pasteOptionsToolbarPlugin.js +44 -35
- package/dist/cjs/pm-plugins/main.js +16 -9
- package/dist/cjs/pm-plugins/reducer.js +2 -0
- package/dist/cjs/ui/on-paste-actions-menu/PasteActionsMenu.js +81 -60
- package/dist/cjs/ui/on-paste-actions-menu/PasteActionsMenuContent.compiled.css +2 -8
- package/dist/cjs/ui/on-paste-actions-menu/PasteActionsMenuContent.js +10 -13
- package/dist/cjs/ui/on-paste-actions-menu/PasteMenuComponents.compiled.css +1 -0
- package/dist/cjs/ui/on-paste-actions-menu/PasteMenuComponents.js +205 -0
- package/dist/es2019/editor-commands/commands.js +4 -2
- package/dist/es2019/pasteOptionsToolbarPlugin.js +41 -28
- package/dist/es2019/pm-plugins/main.js +12 -5
- package/dist/es2019/pm-plugins/reducer.js +2 -0
- package/dist/es2019/ui/on-paste-actions-menu/PasteActionsMenu.js +82 -62
- package/dist/es2019/ui/on-paste-actions-menu/PasteActionsMenuContent.compiled.css +2 -8
- package/dist/es2019/ui/on-paste-actions-menu/PasteActionsMenuContent.js +11 -12
- package/dist/es2019/ui/on-paste-actions-menu/PasteMenuComponents.compiled.css +1 -0
- package/dist/es2019/ui/on-paste-actions-menu/PasteMenuComponents.js +187 -0
- package/dist/esm/editor-commands/commands.js +5 -1
- package/dist/esm/pasteOptionsToolbarPlugin.js +44 -34
- package/dist/esm/pm-plugins/main.js +12 -5
- package/dist/esm/pm-plugins/reducer.js +2 -0
- package/dist/esm/ui/on-paste-actions-menu/PasteActionsMenu.js +84 -63
- package/dist/esm/ui/on-paste-actions-menu/PasteActionsMenuContent.compiled.css +2 -8
- package/dist/esm/ui/on-paste-actions-menu/PasteActionsMenuContent.js +11 -14
- package/dist/esm/ui/on-paste-actions-menu/PasteMenuComponents.compiled.css +1 -0
- package/dist/esm/ui/on-paste-actions-menu/PasteMenuComponents.js +196 -0
- package/dist/types/editor-actions/actions.d.ts +2 -0
- package/dist/types/editor-commands/commands.d.ts +1 -1
- package/dist/types/pasteOptionsToolbarPluginType.d.ts +3 -0
- package/dist/types/pm-plugins/main.d.ts +3 -1
- package/dist/types/types/types.d.ts +3 -0
- package/dist/types/ui/on-paste-actions-menu/PasteActionsMenu.d.ts +1 -3
- package/dist/types/ui/on-paste-actions-menu/PasteActionsMenuContent.d.ts +2 -8
- package/dist/types/ui/on-paste-actions-menu/PasteMenuComponents.d.ts +12 -0
- package/dist/types-ts4.5/editor-actions/actions.d.ts +2 -0
- package/dist/types-ts4.5/editor-commands/commands.d.ts +1 -1
- package/dist/types-ts4.5/pasteOptionsToolbarPluginType.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +3 -1
- package/dist/types-ts4.5/types/types.d.ts +3 -0
- package/dist/types-ts4.5/ui/on-paste-actions-menu/PasteActionsMenu.d.ts +1 -3
- package/dist/types-ts4.5/ui/on-paste-actions-menu/PasteActionsMenuContent.d.ts +2 -8
- package/dist/types-ts4.5/ui/on-paste-actions-menu/PasteMenuComponents.d.ts +12 -0
- package/package.json +6 -4
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/* PasteMenuComponents.tsx generated by @compiled/babel-plugin v0.39.1 */
|
|
2
|
+
import "./PasteMenuComponents.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
+
import React, { useCallback } from 'react';
|
|
5
|
+
import { cx } from '@compiled/react';
|
|
6
|
+
import { useIntl } from 'react-intl-next';
|
|
7
|
+
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
8
|
+
import { pasteOptionsToolbarMessages as messages } from '@atlaskit/editor-common/messages';
|
|
9
|
+
import { useEditorToolbar, PASTE_MENU, PASTE_MENU_SECTION, PASTE_NESTED_MENU, PASTE_MENU_NESTED_SECTION, PASTE_RICH_TEXT_MENU_ITEM, PASTE_MARKDOWN_MENU_ITEM, PASTE_PLAIN_TEXT_MENU_ITEM, PASTE_MENU_RANK, PASTE_MENU_SECTION_RANK, PASTE_NESTED_MENU_RANK, PASTE_MENU_NESTED_SECTION_RANK } from '@atlaskit/editor-common/toolbar';
|
|
10
|
+
import { ToolbarDropdownItem, ToolbarDropdownItemSection, ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar';
|
|
11
|
+
import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
|
|
12
|
+
import ClipboardIcon from '@atlaskit/icon/core/clipboard';
|
|
13
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
14
|
+
import { changeToMarkdownWithAnalytics, changeToPlainTextWithAnalytics, changeToRichTextWithAnalytics } from '../../editor-commands/commands';
|
|
15
|
+
import { ToolbarDropdownOption } from '../../types/types';
|
|
16
|
+
const nestedMenuStyles = {
|
|
17
|
+
narrowSection: "_10gv1lit"
|
|
18
|
+
};
|
|
19
|
+
export const isPasteOptionSelected = (pasteType, selectedOption) => {
|
|
20
|
+
switch (pasteType) {
|
|
21
|
+
case 'rich-text':
|
|
22
|
+
return selectedOption === ToolbarDropdownOption.RichText;
|
|
23
|
+
case 'markdown':
|
|
24
|
+
return selectedOption === ToolbarDropdownOption.Markdown;
|
|
25
|
+
case 'plain-text':
|
|
26
|
+
return selectedOption === ToolbarDropdownOption.PlainText;
|
|
27
|
+
default:
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const PasteMenuItem = ({
|
|
32
|
+
api,
|
|
33
|
+
editorAnalyticsAPI,
|
|
34
|
+
pasteType
|
|
35
|
+
}) => {
|
|
36
|
+
const intl = useIntl();
|
|
37
|
+
const {
|
|
38
|
+
editorView
|
|
39
|
+
} = useEditorToolbar();
|
|
40
|
+
const {
|
|
41
|
+
selectedOption,
|
|
42
|
+
plaintextLength,
|
|
43
|
+
isPlainText
|
|
44
|
+
} = useSharedPluginStateWithSelector(api, ['pasteOptionsToolbarPlugin'], states => {
|
|
45
|
+
var _pluginState$selected, _pluginState$plaintex, _pluginState$isPlainT;
|
|
46
|
+
const pluginState = states.pasteOptionsToolbarPluginState;
|
|
47
|
+
return {
|
|
48
|
+
selectedOption: (_pluginState$selected = pluginState === null || pluginState === void 0 ? void 0 : pluginState.selectedOption) !== null && _pluginState$selected !== void 0 ? _pluginState$selected : ToolbarDropdownOption.None,
|
|
49
|
+
plaintextLength: (_pluginState$plaintex = pluginState === null || pluginState === void 0 ? void 0 : pluginState.plaintextLength) !== null && _pluginState$plaintex !== void 0 ? _pluginState$plaintex : 0,
|
|
50
|
+
isPlainText: (_pluginState$isPlainT = pluginState === null || pluginState === void 0 ? void 0 : pluginState.isPlainText) !== null && _pluginState$isPlainT !== void 0 ? _pluginState$isPlainT : false
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
const getDefaultLabel = useCallback(type => {
|
|
54
|
+
switch (type) {
|
|
55
|
+
case 'rich-text':
|
|
56
|
+
return intl.formatMessage(messages.richTextAction);
|
|
57
|
+
case 'markdown':
|
|
58
|
+
return intl.formatMessage(messages.markdownAction);
|
|
59
|
+
case 'plain-text':
|
|
60
|
+
return intl.formatMessage(messages.plainTextAction);
|
|
61
|
+
default:
|
|
62
|
+
return type;
|
|
63
|
+
}
|
|
64
|
+
}, [intl]);
|
|
65
|
+
const handleClick = useCallback(e => {
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
if (!editorView) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
switch (pasteType) {
|
|
71
|
+
case 'rich-text':
|
|
72
|
+
changeToRichTextWithAnalytics(editorAnalyticsAPI)()(editorView.state, editorView.dispatch);
|
|
73
|
+
break;
|
|
74
|
+
case 'markdown':
|
|
75
|
+
changeToMarkdownWithAnalytics(editorAnalyticsAPI, plaintextLength)()(editorView.state, editorView.dispatch);
|
|
76
|
+
break;
|
|
77
|
+
case 'plain-text':
|
|
78
|
+
changeToPlainTextWithAnalytics(editorAnalyticsAPI, plaintextLength)()(editorView.state, editorView.dispatch);
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
}, [editorView, editorAnalyticsAPI, plaintextLength, pasteType]);
|
|
82
|
+
if (pasteType === 'rich-text' && isPlainText) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
const displayLabel = getDefaultLabel(pasteType);
|
|
86
|
+
const isSelected = isPasteOptionSelected(pasteType, selectedOption);
|
|
87
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
88
|
+
onClick: handleClick,
|
|
89
|
+
isSelected: isSelected,
|
|
90
|
+
testId: `paste-${pasteType}-menu-item`,
|
|
91
|
+
hasNestedDropdownMenu: true
|
|
92
|
+
}, displayLabel);
|
|
93
|
+
};
|
|
94
|
+
const PasteOptionsNestedMenu = ({
|
|
95
|
+
children
|
|
96
|
+
}) => {
|
|
97
|
+
const intl = useIntl();
|
|
98
|
+
return /*#__PURE__*/React.createElement(ToolbarNestedDropdownMenu, {
|
|
99
|
+
elemBefore: /*#__PURE__*/React.createElement(ClipboardIcon, {
|
|
100
|
+
size: "small",
|
|
101
|
+
label: intl.formatMessage(messages.pasteOptions)
|
|
102
|
+
}),
|
|
103
|
+
elemAfter: /*#__PURE__*/React.createElement(ChevronRightIcon, {
|
|
104
|
+
size: "small",
|
|
105
|
+
label: intl.formatMessage(messages.pasteOptions)
|
|
106
|
+
}),
|
|
107
|
+
testId: "paste-options-nested-menu",
|
|
108
|
+
text: intl.formatMessage(messages.pasteOptions)
|
|
109
|
+
}, children);
|
|
110
|
+
};
|
|
111
|
+
export const getPasteMenuComponents = ({
|
|
112
|
+
api,
|
|
113
|
+
editorAnalyticsAPI
|
|
114
|
+
}) => [{
|
|
115
|
+
type: PASTE_MENU.type,
|
|
116
|
+
key: PASTE_MENU.key
|
|
117
|
+
}, {
|
|
118
|
+
type: PASTE_MENU_SECTION.type,
|
|
119
|
+
key: PASTE_MENU_SECTION.key,
|
|
120
|
+
parents: [{
|
|
121
|
+
type: PASTE_MENU.type,
|
|
122
|
+
key: PASTE_MENU.key,
|
|
123
|
+
rank: PASTE_MENU_RANK[PASTE_MENU_SECTION.key]
|
|
124
|
+
}],
|
|
125
|
+
component: props => /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
126
|
+
hasSeparator: true
|
|
127
|
+
}, props.children)
|
|
128
|
+
}, {
|
|
129
|
+
type: PASTE_NESTED_MENU.type,
|
|
130
|
+
key: PASTE_NESTED_MENU.key,
|
|
131
|
+
parents: [{
|
|
132
|
+
type: PASTE_MENU_SECTION.type,
|
|
133
|
+
key: PASTE_MENU_SECTION.key,
|
|
134
|
+
rank: PASTE_MENU_SECTION_RANK[PASTE_NESTED_MENU.key]
|
|
135
|
+
}],
|
|
136
|
+
component: props => /*#__PURE__*/React.createElement(PasteOptionsNestedMenu, null, props.children)
|
|
137
|
+
}, {
|
|
138
|
+
type: PASTE_MENU_NESTED_SECTION.type,
|
|
139
|
+
key: PASTE_MENU_NESTED_SECTION.key,
|
|
140
|
+
parents: [{
|
|
141
|
+
type: PASTE_NESTED_MENU.type,
|
|
142
|
+
key: PASTE_NESTED_MENU.key,
|
|
143
|
+
rank: PASTE_NESTED_MENU_RANK[PASTE_MENU_NESTED_SECTION.key]
|
|
144
|
+
}],
|
|
145
|
+
component: props => /*#__PURE__*/React.createElement(Box, {
|
|
146
|
+
xcss: cx(nestedMenuStyles.narrowSection)
|
|
147
|
+
}, /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, props.children))
|
|
148
|
+
}, {
|
|
149
|
+
key: PASTE_RICH_TEXT_MENU_ITEM.key,
|
|
150
|
+
type: PASTE_RICH_TEXT_MENU_ITEM.type,
|
|
151
|
+
component: () => /*#__PURE__*/React.createElement(PasteMenuItem, {
|
|
152
|
+
api: api,
|
|
153
|
+
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
154
|
+
pasteType: "rich-text"
|
|
155
|
+
}),
|
|
156
|
+
parents: [{
|
|
157
|
+
key: PASTE_MENU_NESTED_SECTION.key,
|
|
158
|
+
type: PASTE_MENU_NESTED_SECTION.type,
|
|
159
|
+
rank: PASTE_MENU_NESTED_SECTION_RANK[PASTE_RICH_TEXT_MENU_ITEM.key]
|
|
160
|
+
}]
|
|
161
|
+
}, {
|
|
162
|
+
key: PASTE_MARKDOWN_MENU_ITEM.key,
|
|
163
|
+
type: PASTE_MARKDOWN_MENU_ITEM.type,
|
|
164
|
+
component: () => /*#__PURE__*/React.createElement(PasteMenuItem, {
|
|
165
|
+
api: api,
|
|
166
|
+
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
167
|
+
pasteType: "markdown"
|
|
168
|
+
}),
|
|
169
|
+
parents: [{
|
|
170
|
+
key: PASTE_MENU_NESTED_SECTION.key,
|
|
171
|
+
type: PASTE_MENU_NESTED_SECTION.type,
|
|
172
|
+
rank: PASTE_MENU_NESTED_SECTION_RANK[PASTE_MARKDOWN_MENU_ITEM.key]
|
|
173
|
+
}]
|
|
174
|
+
}, {
|
|
175
|
+
key: PASTE_PLAIN_TEXT_MENU_ITEM.key,
|
|
176
|
+
type: PASTE_PLAIN_TEXT_MENU_ITEM.type,
|
|
177
|
+
component: () => /*#__PURE__*/React.createElement(PasteMenuItem, {
|
|
178
|
+
api: api,
|
|
179
|
+
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
180
|
+
pasteType: "plain-text"
|
|
181
|
+
}),
|
|
182
|
+
parents: [{
|
|
183
|
+
key: PASTE_MENU_NESTED_SECTION.key,
|
|
184
|
+
type: PASTE_MENU_NESTED_SECTION.type,
|
|
185
|
+
rank: PASTE_MENU_NESTED_SECTION_RANK[PASTE_PLAIN_TEXT_MENU_ITEM.key]
|
|
186
|
+
}]
|
|
187
|
+
}];
|
|
@@ -5,6 +5,8 @@ import { createCommand } from '../pm-plugins/plugin-factory';
|
|
|
5
5
|
import { formatMarkdown, formatPlainText, formatRichText } from '../pm-plugins/util/format-handlers';
|
|
6
6
|
import { pasteOptionsPluginKey, ToolbarDropdownOption } from '../types/types';
|
|
7
7
|
export var showToolbar = function showToolbar(lastContentPasted, selectedOption) {
|
|
8
|
+
var showLegacyOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
9
|
+
var pasteAncestorNodeNames = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
8
10
|
var commandAction = function commandAction(_editorState) {
|
|
9
11
|
var _lastContentPasted$te;
|
|
10
12
|
return {
|
|
@@ -15,7 +17,9 @@ export var showToolbar = function showToolbar(lastContentPasted, selectedOption)
|
|
|
15
17
|
isPlainText: lastContentPasted.isPlainText,
|
|
16
18
|
richTextSlice: lastContentPasted.pastedSlice,
|
|
17
19
|
pasteStartPos: lastContentPasted.pasteStartPos,
|
|
18
|
-
pasteEndPos: lastContentPasted.pasteEndPos
|
|
20
|
+
pasteEndPos: lastContentPasted.pasteEndPos,
|
|
21
|
+
showLegacyOptions: showLegacyOptions,
|
|
22
|
+
pasteAncestorNodeNames: pasteAncestorNodeNames
|
|
19
23
|
}
|
|
20
24
|
};
|
|
21
25
|
};
|
|
@@ -1,6 +1,3 @@
|
|
|
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
1
|
import React, { useEffect } from 'react';
|
|
5
2
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
6
3
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
@@ -8,47 +5,58 @@ import { hideToolbar, showToolbar } from './editor-commands/commands';
|
|
|
8
5
|
import { createPlugin } from './pm-plugins/main';
|
|
9
6
|
import { pasteOptionsPluginKey, ToolbarDropdownOption } from './types/types';
|
|
10
7
|
import { PasteActionsMenu } from './ui/on-paste-actions-menu/PasteActionsMenu';
|
|
8
|
+
import { getPasteMenuComponents } from './ui/on-paste-actions-menu/PasteMenuComponents';
|
|
11
9
|
import { buildToolbar, isToolbarVisible } from './ui/toolbar';
|
|
12
10
|
export var pasteOptionsToolbarPlugin = function pasteOptionsToolbarPlugin(_ref) {
|
|
13
11
|
var _api$analytics;
|
|
14
12
|
var api = _ref.api;
|
|
15
13
|
var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
16
|
-
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
selectedOption: ToolbarDropdownOption.None,
|
|
25
|
-
showToolbar: false
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
var pluginState = pasteOptionsPluginKey.getState(editorState);
|
|
29
|
-
return {
|
|
30
|
-
isPlainText: (_pluginState$isPlainT = pluginState === null || pluginState === void 0 ? void 0 : pluginState.isPlainText) !== null && _pluginState$isPlainT !== void 0 ? _pluginState$isPlainT : false,
|
|
31
|
-
pasteEndPos: (_pluginState$pasteEnd = pluginState === null || pluginState === void 0 ? void 0 : pluginState.pasteEndPos) !== null && _pluginState$pasteEnd !== void 0 ? _pluginState$pasteEnd : 0,
|
|
32
|
-
pasteStartPos: (_pluginState$pasteSta = pluginState === null || pluginState === void 0 ? void 0 : pluginState.pasteStartPos) !== null && _pluginState$pasteSta !== void 0 ? _pluginState$pasteSta : 0,
|
|
33
|
-
plaintextLength: (_pluginState$plaintex = pluginState === null || pluginState === void 0 ? void 0 : pluginState.plaintext.length) !== null && _pluginState$plaintex !== void 0 ? _pluginState$plaintex : 0,
|
|
34
|
-
selectedOption: (_pluginState$selected = pluginState === null || pluginState === void 0 ? void 0 : pluginState.selectedOption) !== null && _pluginState$selected !== void 0 ? _pluginState$selected : ToolbarDropdownOption.None,
|
|
35
|
-
showToolbar: (_pluginState$showTool = pluginState === null || pluginState === void 0 ? void 0 : pluginState.showToolbar) !== null && _pluginState$showTool !== void 0 ? _pluginState$showTool : false
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
return _objectSpread(_objectSpread({
|
|
14
|
+
if (expValEquals('platform_editor_paste_actions_menu', 'isEnabled', true)) {
|
|
15
|
+
var _api$uiControlRegistr;
|
|
16
|
+
api === null || api === void 0 || (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 || _api$uiControlRegistr.actions.register(getPasteMenuComponents({
|
|
17
|
+
api: api,
|
|
18
|
+
editorAnalyticsAPI: editorAnalyticsAPI
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
39
22
|
name: 'pasteOptionsToolbarPlugin',
|
|
40
23
|
pmPlugins: function pmPlugins() {
|
|
41
24
|
return [{
|
|
42
25
|
name: 'pasteOptionsToolbarPlugin',
|
|
43
26
|
plugin: function plugin(_ref2) {
|
|
44
27
|
var dispatch = _ref2.dispatch;
|
|
45
|
-
return createPlugin(dispatch
|
|
28
|
+
return createPlugin(dispatch, {
|
|
29
|
+
useNewPasteMenu: expValEquals('platform_editor_paste_actions_menu', 'isEnabled', true)
|
|
30
|
+
});
|
|
46
31
|
}
|
|
47
32
|
}];
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
33
|
+
},
|
|
34
|
+
getSharedState: function getSharedState(editorState) {
|
|
35
|
+
var _pluginState$isPlainT, _pluginState$pasteAnc, _pluginState$pasteEnd, _pluginState$pasteSta, _pluginState$plaintex, _pluginState$selected, _pluginState$showLega, _pluginState$showTool;
|
|
36
|
+
if (!editorState) {
|
|
37
|
+
return {
|
|
38
|
+
isPlainText: false,
|
|
39
|
+
pasteAncestorNodeNames: [],
|
|
40
|
+
pasteEndPos: 0,
|
|
41
|
+
pasteStartPos: 0,
|
|
42
|
+
plaintextLength: 0,
|
|
43
|
+
selectedOption: ToolbarDropdownOption.None,
|
|
44
|
+
showLegacyOptions: false,
|
|
45
|
+
showToolbar: false
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
var pluginState = pasteOptionsPluginKey.getState(editorState);
|
|
49
|
+
return {
|
|
50
|
+
isPlainText: (_pluginState$isPlainT = pluginState === null || pluginState === void 0 ? void 0 : pluginState.isPlainText) !== null && _pluginState$isPlainT !== void 0 ? _pluginState$isPlainT : false,
|
|
51
|
+
pasteAncestorNodeNames: (_pluginState$pasteAnc = pluginState === null || pluginState === void 0 ? void 0 : pluginState.pasteAncestorNodeNames) !== null && _pluginState$pasteAnc !== void 0 ? _pluginState$pasteAnc : [],
|
|
52
|
+
pasteEndPos: (_pluginState$pasteEnd = pluginState === null || pluginState === void 0 ? void 0 : pluginState.pasteEndPos) !== null && _pluginState$pasteEnd !== void 0 ? _pluginState$pasteEnd : 0,
|
|
53
|
+
pasteStartPos: (_pluginState$pasteSta = pluginState === null || pluginState === void 0 ? void 0 : pluginState.pasteStartPos) !== null && _pluginState$pasteSta !== void 0 ? _pluginState$pasteSta : 0,
|
|
54
|
+
plaintextLength: (_pluginState$plaintex = pluginState === null || pluginState === void 0 ? void 0 : pluginState.plaintext.length) !== null && _pluginState$plaintex !== void 0 ? _pluginState$plaintex : 0,
|
|
55
|
+
selectedOption: (_pluginState$selected = pluginState === null || pluginState === void 0 ? void 0 : pluginState.selectedOption) !== null && _pluginState$selected !== void 0 ? _pluginState$selected : ToolbarDropdownOption.None,
|
|
56
|
+
showLegacyOptions: (_pluginState$showLega = pluginState === null || pluginState === void 0 ? void 0 : pluginState.showLegacyOptions) !== null && _pluginState$showLega !== void 0 ? _pluginState$showLega : false,
|
|
57
|
+
showToolbar: (_pluginState$showTool = pluginState === null || pluginState === void 0 ? void 0 : pluginState.showToolbar) !== null && _pluginState$showTool !== void 0 ? _pluginState$showTool : false
|
|
58
|
+
};
|
|
59
|
+
},
|
|
52
60
|
pluginsOptions: {
|
|
53
61
|
floatingToolbar: function floatingToolbar(state, intl) {
|
|
54
62
|
if (expValEquals('platform_editor_paste_actions_menu', 'isEnabled', true)) {
|
|
@@ -74,8 +82,7 @@ export var pasteOptionsToolbarPlugin = function pasteOptionsToolbarPlugin(_ref)
|
|
|
74
82
|
editorView: editorView,
|
|
75
83
|
mountTo: popupsMountPoint,
|
|
76
84
|
boundariesElement: popupsBoundariesElement,
|
|
77
|
-
scrollableElement: popupsScrollableElement
|
|
78
|
-
editorAnalyticsAPI: editorAnalyticsAPI
|
|
85
|
+
scrollableElement: popupsScrollableElement
|
|
79
86
|
});
|
|
80
87
|
},
|
|
81
88
|
usePluginHook: function usePluginHook(_ref4) {
|
|
@@ -88,6 +95,9 @@ export var pasteOptionsToolbarPlugin = function pasteOptionsToolbarPlugin(_ref)
|
|
|
88
95
|
}),
|
|
89
96
|
lastContentPasted = _useSharedPluginState.lastContentPasted;
|
|
90
97
|
useEffect(function () {
|
|
98
|
+
if (expValEquals('platform_editor_paste_actions_menu', 'isEnabled', true)) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
91
101
|
if (!lastContentPasted) {
|
|
92
102
|
hideToolbar()(editorView.state, editorView.dispatch);
|
|
93
103
|
return;
|
|
@@ -106,5 +116,5 @@ export var pasteOptionsToolbarPlugin = function pasteOptionsToolbarPlugin(_ref)
|
|
|
106
116
|
showToolbar(lastContentPasted, selectedOption)(editorView.state, editorView.dispatch);
|
|
107
117
|
}, [lastContentPasted, editorView]);
|
|
108
118
|
}
|
|
109
|
-
}
|
|
119
|
+
};
|
|
110
120
|
};
|
|
@@ -5,11 +5,13 @@ import { checkAndHideToolbar } from '../editor-commands/commands';
|
|
|
5
5
|
import { pasteOptionsPluginKey, ToolbarDropdownOption } from '../types/types';
|
|
6
6
|
import { PASTE_HIGHLIGHT_DECORATION_KEY, TEXT_HIGHLIGHT_CLASS } from './constants';
|
|
7
7
|
import { createPluginState } from './plugin-factory';
|
|
8
|
-
export function createPlugin(dispatch) {
|
|
8
|
+
export function createPlugin(dispatch, options) {
|
|
9
9
|
return new SafePlugin({
|
|
10
10
|
key: pasteOptionsPluginKey,
|
|
11
11
|
state: createPluginState(dispatch, {
|
|
12
12
|
showToolbar: false,
|
|
13
|
+
showLegacyOptions: false,
|
|
14
|
+
pasteAncestorNodeNames: [],
|
|
13
15
|
pasteStartPos: 0,
|
|
14
16
|
pasteEndPos: 0,
|
|
15
17
|
plaintext: '',
|
|
@@ -19,17 +21,22 @@ export function createPlugin(dispatch) {
|
|
|
19
21
|
richTextSlice: Slice.empty,
|
|
20
22
|
selectedOption: ToolbarDropdownOption.None
|
|
21
23
|
}),
|
|
22
|
-
view: function view(
|
|
24
|
+
view: function view(_editorView) {
|
|
23
25
|
return {
|
|
24
|
-
update: function update(
|
|
26
|
+
update: function update(_view, prevState) {
|
|
25
27
|
return prevState;
|
|
26
28
|
}
|
|
27
29
|
};
|
|
28
30
|
},
|
|
29
31
|
props: {
|
|
30
32
|
handleDOMEvents: {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
blur: function blur(view) {
|
|
34
|
+
if (options !== null && options !== void 0 && options.useNewPasteMenu) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
checkAndHideToolbar(view);
|
|
38
|
+
return false;
|
|
39
|
+
},
|
|
33
40
|
// Hide toolbar when clicked anywhere within the editor, tr.getMeta('pointer') does not work if clicked on the same line after pasting so relying on mousedown event
|
|
34
41
|
mousedown: checkAndHideToolbar
|
|
35
42
|
},
|
|
@@ -8,6 +8,8 @@ export var reducer = function reducer(state, action) {
|
|
|
8
8
|
{
|
|
9
9
|
return _objectSpread(_objectSpread({}, state), {}, {
|
|
10
10
|
showToolbar: true,
|
|
11
|
+
showLegacyOptions: action.data.showLegacyOptions,
|
|
12
|
+
pasteAncestorNodeNames: action.data.pasteAncestorNodeNames,
|
|
11
13
|
highlightContent: false,
|
|
12
14
|
isPlainText: action.data.isPlainText,
|
|
13
15
|
plaintext: action.data.plaintext,
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import React, { useCallback,
|
|
2
|
-
import { useIntl } from 'react-intl-next';
|
|
1
|
+
import React, { useCallback, useEffect } from 'react';
|
|
3
2
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
|
-
import {
|
|
5
|
-
import { EditorToolbarProvider } from '@atlaskit/editor-common/toolbar';
|
|
3
|
+
import { EditorToolbarProvider, PASTE_MENU } from '@atlaskit/editor-common/toolbar';
|
|
6
4
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
7
5
|
import { withReactEditorViewOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
8
6
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
9
7
|
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
10
|
-
import {
|
|
8
|
+
import { ToolbarDropdownMenuProvider } from '@atlaskit/editor-toolbar';
|
|
9
|
+
import { buildChildrenMap, willComponentRender } from '@atlaskit/editor-ui-control-model';
|
|
10
|
+
import { hideToolbar, highlightContent, showToolbar } from '../../editor-commands/commands';
|
|
11
11
|
import { ToolbarDropdownOption } from '../../types/types';
|
|
12
|
+
import { isToolbarVisible } from '../toolbar';
|
|
12
13
|
import { PasteActionsMenuContent } from './PasteActionsMenuContent';
|
|
13
14
|
var PopupWithListeners = withReactEditorViewOuterListeners(Popup);
|
|
14
15
|
function getTargetElement(editorView) {
|
|
@@ -30,29 +31,63 @@ function getPopupOffset(dom) {
|
|
|
30
31
|
var rightEdge = dom.getBoundingClientRect().right;
|
|
31
32
|
return [-(window.innerWidth - rightEdge - 50), 20];
|
|
32
33
|
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Returns true when at least one component in the given list would produce
|
|
37
|
+
* visible output (i.e. is not hidden and, for containers, has at least one
|
|
38
|
+
* visible descendant).
|
|
39
|
+
*/
|
|
40
|
+
var hasVisibleComponent = function hasVisibleComponent(components) {
|
|
41
|
+
var childrenMap = buildChildrenMap(components);
|
|
42
|
+
return components.some(function (c) {
|
|
43
|
+
return willComponentRender(c, childrenMap);
|
|
44
|
+
});
|
|
45
|
+
};
|
|
33
46
|
export var PasteActionsMenu = function PasteActionsMenu(_ref) {
|
|
34
|
-
var _api$uiControlRegistr, _api$uiControlRegistr2;
|
|
47
|
+
var _api$uiControlRegistr, _api$uiControlRegistr2, _api$uiControlRegistr3, _api$uiControlRegistr4;
|
|
35
48
|
var api = _ref.api,
|
|
36
49
|
editorView = _ref.editorView,
|
|
37
50
|
mountTo = _ref.mountTo,
|
|
38
51
|
boundariesElement = _ref.boundariesElement,
|
|
39
|
-
scrollableElement = _ref.scrollableElement
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
52
|
+
scrollableElement = _ref.scrollableElement;
|
|
53
|
+
var _useSharedPluginState = useSharedPluginStateWithSelector(api, ['paste'], function (states) {
|
|
54
|
+
var _states$pasteState;
|
|
55
|
+
return {
|
|
56
|
+
lastContentPasted: (_states$pasteState = states.pasteState) === null || _states$pasteState === void 0 ? void 0 : _states$pasteState.lastContentPasted
|
|
57
|
+
};
|
|
58
|
+
}),
|
|
59
|
+
lastContentPasted = _useSharedPluginState.lastContentPasted;
|
|
60
|
+
useEffect(function () {
|
|
61
|
+
if (!lastContentPasted) {
|
|
62
|
+
hideToolbar()(editorView.state, editorView.dispatch);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
var selectedOption = ToolbarDropdownOption.None;
|
|
66
|
+
if (!lastContentPasted.isPlainText) {
|
|
67
|
+
selectedOption = ToolbarDropdownOption.RichText;
|
|
68
|
+
} else if (lastContentPasted.isShiftPressed) {
|
|
69
|
+
selectedOption = ToolbarDropdownOption.PlainText;
|
|
70
|
+
} else {
|
|
71
|
+
selectedOption = ToolbarDropdownOption.Markdown;
|
|
72
|
+
}
|
|
73
|
+
var $pos = editorView.state.doc.resolve(lastContentPasted.pasteStartPos);
|
|
74
|
+
var pasteAncestorNodeNames = [];
|
|
75
|
+
for (var depth = $pos.depth; depth > 0; depth--) {
|
|
76
|
+
pasteAncestorNodeNames.push($pos.node(depth).type.name);
|
|
77
|
+
}
|
|
78
|
+
var legacyVisible = isToolbarVisible(editorView.state, lastContentPasted);
|
|
79
|
+
showToolbar(lastContentPasted, selectedOption, legacyVisible, pasteAncestorNodeNames)(editorView.state, editorView.dispatch);
|
|
80
|
+
}, [lastContentPasted, editorView]);
|
|
81
|
+
var _useSharedPluginState2 = useSharedPluginStateWithSelector(api, ['pasteOptionsToolbarPlugin'], function (states) {
|
|
82
|
+
var _pluginState$showTool, _pluginState$showLega;
|
|
44
83
|
var pluginState = states.pasteOptionsToolbarPluginState;
|
|
45
84
|
return {
|
|
46
85
|
showToolbar: (_pluginState$showTool = pluginState === null || pluginState === void 0 ? void 0 : pluginState.showToolbar) !== null && _pluginState$showTool !== void 0 ? _pluginState$showTool : false,
|
|
47
|
-
|
|
48
|
-
selectedOption: (_pluginState$selected = pluginState === null || pluginState === void 0 ? void 0 : pluginState.selectedOption) !== null && _pluginState$selected !== void 0 ? _pluginState$selected : ToolbarDropdownOption.None,
|
|
49
|
-
plaintextLength: (_pluginState$plaintex = pluginState === null || pluginState === void 0 ? void 0 : pluginState.plaintextLength) !== null && _pluginState$plaintex !== void 0 ? _pluginState$plaintex : 0
|
|
86
|
+
showLegacyOptions: (_pluginState$showLega = pluginState === null || pluginState === void 0 ? void 0 : pluginState.showLegacyOptions) !== null && _pluginState$showLega !== void 0 ? _pluginState$showLega : false
|
|
50
87
|
};
|
|
51
88
|
}),
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
selectedOption = _useSharedPluginState.selectedOption,
|
|
55
|
-
plaintextLength = _useSharedPluginState.plaintextLength;
|
|
89
|
+
isToolbarShown = _useSharedPluginState2.showToolbar,
|
|
90
|
+
showLegacyOptions = _useSharedPluginState2.showLegacyOptions;
|
|
56
91
|
var preventEditorFocusLoss = useCallback(function (e) {
|
|
57
92
|
e.preventDefault();
|
|
58
93
|
}, []);
|
|
@@ -62,54 +97,37 @@ export var PasteActionsMenu = function PasteActionsMenu(_ref) {
|
|
|
62
97
|
var handleMouseEnter = useCallback(function () {
|
|
63
98
|
highlightContent()(editorView.state, editorView.dispatch);
|
|
64
99
|
}, [editorView]);
|
|
65
|
-
var
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
changeToMarkdownWithAnalytics(editorAnalyticsAPI, plaintextLength)()(editorView.state, editorView.dispatch);
|
|
72
|
-
}, [editorView, editorAnalyticsAPI, plaintextLength]);
|
|
73
|
-
var handlePlainText = useCallback(function (e) {
|
|
74
|
-
e.preventDefault();
|
|
75
|
-
changeToPlainTextWithAnalytics(editorAnalyticsAPI, plaintextLength)()(editorView.state, editorView.dispatch);
|
|
76
|
-
}, [editorView, editorAnalyticsAPI, plaintextLength]);
|
|
77
|
-
var options = useMemo(function () {
|
|
78
|
-
var items = [];
|
|
79
|
-
if (!isPlainText) {
|
|
80
|
-
items.push({
|
|
81
|
-
id: 'editor.paste.richText',
|
|
82
|
-
label: intl.formatMessage(messages.richText),
|
|
83
|
-
selected: selectedOption === ToolbarDropdownOption.RichText,
|
|
84
|
-
onClick: handleRichText
|
|
85
|
-
});
|
|
100
|
+
var handleClickOutside = useCallback(function (evt) {
|
|
101
|
+
if (evt.target instanceof Element) {
|
|
102
|
+
var isInsideNestedDropdown = evt.target.closest('[data-toolbar-nested-dropdown-menu]');
|
|
103
|
+
if (isInsideNestedDropdown) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
86
106
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if (!
|
|
107
|
+
handleDismiss();
|
|
108
|
+
}, [handleDismiss]);
|
|
109
|
+
var handleSetIsOpen = useCallback(function (isOpen) {
|
|
110
|
+
if (!isOpen) {
|
|
111
|
+
handleDismiss();
|
|
112
|
+
}
|
|
113
|
+
}, [handleDismiss]);
|
|
114
|
+
var aiSurface = {
|
|
115
|
+
type: 'menu',
|
|
116
|
+
key: 'ai-paste-menu'
|
|
117
|
+
};
|
|
118
|
+
var aiSurfaceComponents = (_api$uiControlRegistr = api === null || api === void 0 || (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(aiSurface.key)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : [];
|
|
119
|
+
var pasteSurfaceComponents = (_api$uiControlRegistr3 = api === null || api === void 0 || (_api$uiControlRegistr4 = api.uiControlRegistry) === null || _api$uiControlRegistr4 === void 0 ? void 0 : _api$uiControlRegistr4.actions.getComponents(PASTE_MENU.key)) !== null && _api$uiControlRegistr3 !== void 0 ? _api$uiControlRegistr3 : [];
|
|
120
|
+
var anyAiComponentVisible = hasVisibleComponent(aiSurfaceComponents);
|
|
121
|
+
if (!isToolbarShown) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
if (!showLegacyOptions && !anyAiComponentVisible) {
|
|
102
125
|
return null;
|
|
103
126
|
}
|
|
104
127
|
var target = getTargetElement(editorView);
|
|
105
128
|
if (!target) {
|
|
106
129
|
return null;
|
|
107
130
|
}
|
|
108
|
-
var aiSurface = {
|
|
109
|
-
type: 'menu',
|
|
110
|
-
key: 'ai-paste-menu'
|
|
111
|
-
};
|
|
112
|
-
var aiSurfaceComponents = (_api$uiControlRegistr = api === null || api === void 0 || (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(aiSurface.key)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : [];
|
|
113
131
|
return /*#__PURE__*/React.createElement(PopupWithListeners, {
|
|
114
132
|
target: target,
|
|
115
133
|
mountTo: mountTo,
|
|
@@ -119,15 +137,18 @@ export var PasteActionsMenu = function PasteActionsMenu(_ref) {
|
|
|
119
137
|
zIndex: akEditorFloatingPanelZIndex,
|
|
120
138
|
alignX: "right",
|
|
121
139
|
alignY: "bottom",
|
|
122
|
-
handleClickOutside:
|
|
140
|
+
handleClickOutside: handleClickOutside,
|
|
123
141
|
handleEscapeKeydown: handleDismiss
|
|
124
142
|
}, /*#__PURE__*/React.createElement(EditorToolbarProvider, {
|
|
125
143
|
editorView: editorView
|
|
144
|
+
}, /*#__PURE__*/React.createElement(ToolbarDropdownMenuProvider, {
|
|
145
|
+
isOpen: isToolbarShown,
|
|
146
|
+
setIsOpen: handleSetIsOpen
|
|
126
147
|
}, /*#__PURE__*/React.createElement(PasteActionsMenuContent, {
|
|
127
|
-
options: options,
|
|
128
148
|
onMouseDown: preventEditorFocusLoss,
|
|
129
149
|
onMouseEnter: handleMouseEnter,
|
|
130
150
|
aiSurface: aiSurface,
|
|
131
|
-
aiSurfaceComponents: aiSurfaceComponents
|
|
132
|
-
|
|
151
|
+
aiSurfaceComponents: aiSurfaceComponents,
|
|
152
|
+
pasteSurfaceComponents: showLegacyOptions ? pasteSurfaceComponents : []
|
|
153
|
+
}))));
|
|
133
154
|
};
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
|
|
2
2
|
._2rko12b0{border-radius:var(--ds-radius-small,4px)}
|
|
3
|
-
.
|
|
4
|
-
.
|
|
5
|
-
._1rjcu2gc{padding-block:var(--ds-space-100,8px)}._16qs130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}
|
|
6
|
-
._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
|
|
7
|
-
._bfhksm61{background-color:var(--ds-background-neutral-subtle,#00000000)}
|
|
8
|
-
._k48pwu06{font-weight:var(--ds-font-weight-bold,653)}
|
|
9
|
-
._syazi7uo{color:var(--ds-text,#292a2e)}
|
|
10
|
-
._irr31dpa:hover{background-color:var(--ds-background-neutral-subtle-hovered,#0515240f)}
|
|
3
|
+
._1rjc1b66{padding-block:var(--ds-space-050,4px)}._16qs130s{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #1e1f2126,0 0 1px #1e1f214f)}
|
|
4
|
+
._bfhk1bhr{background-color:var(--ds-surface-overlay,#fff)}
|
|
@@ -2,21 +2,18 @@
|
|
|
2
2
|
import "./PasteActionsMenuContent.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React, { useContext } from 'react';
|
|
5
|
-
import { cx } from '@atlaskit/css';
|
|
6
5
|
import { OutsideClickTargetRefContext } from '@atlaskit/editor-common/ui-react';
|
|
7
6
|
import { SurfaceRenderer } from '@atlaskit/editor-ui-control-model';
|
|
8
|
-
import { Box
|
|
7
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
9
8
|
var styles = {
|
|
10
|
-
container: "_2rko12b0 _1rjc1b66 _bfhk1bhr _16qs130s"
|
|
11
|
-
option: "_1rjcu2gc _18zrpxbi _syazi7uo _bfhksm61 _irr31dpa",
|
|
12
|
-
selectedOption: "_k48pwu06"
|
|
9
|
+
container: "_2rko12b0 _1rjc1b66 _bfhk1bhr _16qs130s"
|
|
13
10
|
};
|
|
14
11
|
export var PasteActionsMenuContent = function PasteActionsMenuContent(_ref) {
|
|
15
|
-
var
|
|
16
|
-
onMouseDown = _ref.onMouseDown,
|
|
12
|
+
var onMouseDown = _ref.onMouseDown,
|
|
17
13
|
onMouseEnter = _ref.onMouseEnter,
|
|
18
14
|
aiSurface = _ref.aiSurface,
|
|
19
|
-
aiSurfaceComponents = _ref.aiSurfaceComponents
|
|
15
|
+
aiSurfaceComponents = _ref.aiSurfaceComponents,
|
|
16
|
+
pasteSurfaceComponents = _ref.pasteSurfaceComponents;
|
|
20
17
|
var setOutsideClickTargetRef = useContext(OutsideClickTargetRefContext);
|
|
21
18
|
return /*#__PURE__*/React.createElement(Box, {
|
|
22
19
|
ref: setOutsideClickTargetRef,
|
|
@@ -26,11 +23,11 @@ export var PasteActionsMenuContent = function PasteActionsMenuContent(_ref) {
|
|
|
26
23
|
}, aiSurface && aiSurfaceComponents && aiSurfaceComponents.length > 0 && /*#__PURE__*/React.createElement(SurfaceRenderer, {
|
|
27
24
|
surface: aiSurface,
|
|
28
25
|
components: aiSurfaceComponents
|
|
29
|
-
}),
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
}), pasteSurfaceComponents && pasteSurfaceComponents.length > 0 && /*#__PURE__*/React.createElement(SurfaceRenderer, {
|
|
27
|
+
surface: {
|
|
28
|
+
type: 'menu',
|
|
29
|
+
key: 'paste-menu'
|
|
30
|
+
},
|
|
31
|
+
components: pasteSurfaceComponents
|
|
35
32
|
}));
|
|
36
33
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._10gv1lit button{min-width:10pc}
|