@atlaskit/editor-plugin-paste-options-toolbar 13.1.5 → 13.1.7
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
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-paste-options-toolbar
|
|
2
2
|
|
|
3
|
+
## 13.1.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 13.1.6
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`0f828d3590ec8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0f828d3590ec8) -
|
|
14
|
+
Fix the paste actions menu to remain visible for single Smart Link pastes when an AI action is
|
|
15
|
+
available.
|
|
16
|
+
|
|
3
17
|
## 13.1.5
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -268,9 +268,22 @@ var PasteActionsMenu = exports.PasteActionsMenu = function PasteActionsMenu(_ref
|
|
|
268
268
|
}),
|
|
269
269
|
lastContentPasted = _useSharedPluginState.lastContentPasted;
|
|
270
270
|
var sliceForAgentMentionSuppression = lastContentPasted === null || lastContentPasted === void 0 ? void 0 : lastContentPasted.sourcePastedSlice;
|
|
271
|
+
var pasteMenuComponents = (_api$uiControlRegistr = api === null || api === void 0 || (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(_toolbar.PASTE_MENU.key)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : [];
|
|
272
|
+
|
|
273
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-expensive-computations-in-render -- pasteMenuComponents changes by reference each render; filter is small (< 10 items)
|
|
274
|
+
var aiMenuItems = pasteMenuComponents.filter(function (c) {
|
|
275
|
+
var _c$parents;
|
|
276
|
+
return c.type === 'menu-item' && ((_c$parents = c.parents) === null || _c$parents === void 0 ? void 0 : _c$parents.some(function (p) {
|
|
277
|
+
return p.key === _toolbar.AI_PASTE_MENU_SECTION.key;
|
|
278
|
+
}));
|
|
279
|
+
});
|
|
280
|
+
var visibleAiActionKeys = (0, _hasVisibleButton.getVisibleKeys)(aiMenuItems, ['menu-item']);
|
|
281
|
+
var hasVisibleAiActions = visibleAiActionKeys.length > 0;
|
|
271
282
|
var shouldSuppressPasteActions = (0, _react.useMemo)(function () {
|
|
272
|
-
|
|
273
|
-
|
|
283
|
+
var suppressForAgentMention = shouldSuppressPasteActionsForAgentMention(sliceForAgentMentionSuppression);
|
|
284
|
+
var suppressForSingleLink = shouldSuppressPasteActionsForSingleLink(sliceForAgentMentionSuppression) && !hasVisibleAiActions;
|
|
285
|
+
return suppressForAgentMention || suppressForSingleLink;
|
|
286
|
+
}, [sliceForAgentMentionSuppression, hasVisibleAiActions]);
|
|
274
287
|
var prevShowToolbarRef = (0, _react.useRef)(false);
|
|
275
288
|
var popupContentRef = (0, _react.useRef)(null);
|
|
276
289
|
(0, _react.useEffect)(function () {
|
|
@@ -347,27 +360,15 @@ var PasteActionsMenu = exports.PasteActionsMenu = function PasteActionsMenu(_ref
|
|
|
347
360
|
// onPositionCalculated with fresh viewport coordinates.
|
|
348
361
|
var overflowScrollParent = shouldRenderToolbar ? (0, _ui.findOverflowScrollParent)(editorView.dom) : false;
|
|
349
362
|
var effectiveScrollableElement = overflowScrollParent || scrollableElement;
|
|
350
|
-
var pasteMenuComponents = (_api$uiControlRegistr = api === null || api === void 0 || (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(_toolbar.PASTE_MENU.key)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : [];
|
|
351
363
|
var anyComponentVisible = (0, _hasVisibleButton.hasVisibleButton)(pasteMenuComponents);
|
|
352
364
|
|
|
353
|
-
// eslint-disable-next-line @atlassian/perf-linting/no-expensive-computations-in-render -- pasteMenuComponents changes by reference each render; filter is small (< 10 items)
|
|
354
|
-
var aiMenuItems = pasteMenuComponents.filter(function (c) {
|
|
355
|
-
var _c$parents;
|
|
356
|
-
return c.type === 'menu-item' && ((_c$parents = c.parents) === null || _c$parents === void 0 ? void 0 : _c$parents.some(function (p) {
|
|
357
|
-
return p.key === _toolbar.AI_PASTE_MENU_SECTION.key;
|
|
358
|
-
}));
|
|
359
|
-
});
|
|
360
|
-
var visibleAiActionKeys = (0, _hasVisibleButton.getVisibleKeys)(aiMenuItems, ['menu-item']);
|
|
361
|
-
|
|
362
365
|
// Whether the card plugin's "Display as" section is visible when the menu opens.
|
|
363
366
|
var displayAsVisible = (0, _hasVisibleButton.getVisibleKeys)(pasteMenuComponents, ['menu-section']).includes(_toolbar.SMART_LINK_DISPLAY_AS_PASTE_MENU_SECTION.key);
|
|
364
|
-
|
|
365
367
|
// Two positioning modes:
|
|
366
368
|
// 1. Inline: no AI actions visible — menu appears to the right of the cursor,
|
|
367
369
|
// vertically centered with the text line.
|
|
368
370
|
// 2. Block-anchored: AI actions are visible — menu appears at the right edge
|
|
369
371
|
// of the content block, aligned with paste start.
|
|
370
|
-
var hasVisibleAiActions = visibleAiActionKeys.length > 0;
|
|
371
372
|
(0, _react.useEffect)(function () {
|
|
372
373
|
if (!prevShowToolbarRef.current && shouldRenderToolbar) {
|
|
373
374
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.fireAnalyticsEvent({
|
|
@@ -247,7 +247,20 @@ export const PasteActionsMenu = ({
|
|
|
247
247
|
};
|
|
248
248
|
});
|
|
249
249
|
const sliceForAgentMentionSuppression = lastContentPasted === null || lastContentPasted === void 0 ? void 0 : lastContentPasted.sourcePastedSlice;
|
|
250
|
-
const
|
|
250
|
+
const pasteMenuComponents = (_api$uiControlRegistr = api === null || api === void 0 ? void 0 : (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(PASTE_MENU.key)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : [];
|
|
251
|
+
|
|
252
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-expensive-computations-in-render -- pasteMenuComponents changes by reference each render; filter is small (< 10 items)
|
|
253
|
+
const aiMenuItems = pasteMenuComponents.filter(c => {
|
|
254
|
+
var _c$parents;
|
|
255
|
+
return c.type === 'menu-item' && ((_c$parents = c.parents) === null || _c$parents === void 0 ? void 0 : _c$parents.some(p => p.key === AI_PASTE_MENU_SECTION.key));
|
|
256
|
+
});
|
|
257
|
+
const visibleAiActionKeys = getVisibleKeys(aiMenuItems, ['menu-item']);
|
|
258
|
+
const hasVisibleAiActions = visibleAiActionKeys.length > 0;
|
|
259
|
+
const shouldSuppressPasteActions = useMemo(() => {
|
|
260
|
+
const suppressForAgentMention = shouldSuppressPasteActionsForAgentMention(sliceForAgentMentionSuppression);
|
|
261
|
+
const suppressForSingleLink = shouldSuppressPasteActionsForSingleLink(sliceForAgentMentionSuppression) && !hasVisibleAiActions;
|
|
262
|
+
return suppressForAgentMention || suppressForSingleLink;
|
|
263
|
+
}, [sliceForAgentMentionSuppression, hasVisibleAiActions]);
|
|
251
264
|
const prevShowToolbarRef = useRef(false);
|
|
252
265
|
const popupContentRef = useRef(null);
|
|
253
266
|
useEffect(() => {
|
|
@@ -325,25 +338,15 @@ export const PasteActionsMenu = ({
|
|
|
325
338
|
// onPositionCalculated with fresh viewport coordinates.
|
|
326
339
|
const overflowScrollParent = shouldRenderToolbar ? findOverflowScrollParent(editorView.dom) : false;
|
|
327
340
|
const effectiveScrollableElement = overflowScrollParent || scrollableElement;
|
|
328
|
-
const pasteMenuComponents = (_api$uiControlRegistr = api === null || api === void 0 ? void 0 : (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(PASTE_MENU.key)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : [];
|
|
329
341
|
const anyComponentVisible = hasVisibleButton(pasteMenuComponents);
|
|
330
342
|
|
|
331
|
-
// eslint-disable-next-line @atlassian/perf-linting/no-expensive-computations-in-render -- pasteMenuComponents changes by reference each render; filter is small (< 10 items)
|
|
332
|
-
const aiMenuItems = pasteMenuComponents.filter(c => {
|
|
333
|
-
var _c$parents;
|
|
334
|
-
return c.type === 'menu-item' && ((_c$parents = c.parents) === null || _c$parents === void 0 ? void 0 : _c$parents.some(p => p.key === AI_PASTE_MENU_SECTION.key));
|
|
335
|
-
});
|
|
336
|
-
const visibleAiActionKeys = getVisibleKeys(aiMenuItems, ['menu-item']);
|
|
337
|
-
|
|
338
343
|
// Whether the card plugin's "Display as" section is visible when the menu opens.
|
|
339
344
|
const displayAsVisible = getVisibleKeys(pasteMenuComponents, ['menu-section']).includes(SMART_LINK_DISPLAY_AS_PASTE_MENU_SECTION.key);
|
|
340
|
-
|
|
341
345
|
// Two positioning modes:
|
|
342
346
|
// 1. Inline: no AI actions visible — menu appears to the right of the cursor,
|
|
343
347
|
// vertically centered with the text line.
|
|
344
348
|
// 2. Block-anchored: AI actions are visible — menu appears at the right edge
|
|
345
349
|
// of the content block, aligned with paste start.
|
|
346
|
-
const hasVisibleAiActions = visibleAiActionKeys.length > 0;
|
|
347
350
|
useEffect(() => {
|
|
348
351
|
if (!prevShowToolbarRef.current && shouldRenderToolbar) {
|
|
349
352
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.fireAnalyticsEvent({
|
|
@@ -252,9 +252,22 @@ export var PasteActionsMenu = function PasteActionsMenu(_ref) {
|
|
|
252
252
|
}),
|
|
253
253
|
lastContentPasted = _useSharedPluginState.lastContentPasted;
|
|
254
254
|
var sliceForAgentMentionSuppression = lastContentPasted === null || lastContentPasted === void 0 ? void 0 : lastContentPasted.sourcePastedSlice;
|
|
255
|
+
var pasteMenuComponents = (_api$uiControlRegistr = api === null || api === void 0 || (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(PASTE_MENU.key)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : [];
|
|
256
|
+
|
|
257
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-expensive-computations-in-render -- pasteMenuComponents changes by reference each render; filter is small (< 10 items)
|
|
258
|
+
var aiMenuItems = pasteMenuComponents.filter(function (c) {
|
|
259
|
+
var _c$parents;
|
|
260
|
+
return c.type === 'menu-item' && ((_c$parents = c.parents) === null || _c$parents === void 0 ? void 0 : _c$parents.some(function (p) {
|
|
261
|
+
return p.key === AI_PASTE_MENU_SECTION.key;
|
|
262
|
+
}));
|
|
263
|
+
});
|
|
264
|
+
var visibleAiActionKeys = getVisibleKeys(aiMenuItems, ['menu-item']);
|
|
265
|
+
var hasVisibleAiActions = visibleAiActionKeys.length > 0;
|
|
255
266
|
var shouldSuppressPasteActions = useMemo(function () {
|
|
256
|
-
|
|
257
|
-
|
|
267
|
+
var suppressForAgentMention = shouldSuppressPasteActionsForAgentMention(sliceForAgentMentionSuppression);
|
|
268
|
+
var suppressForSingleLink = shouldSuppressPasteActionsForSingleLink(sliceForAgentMentionSuppression) && !hasVisibleAiActions;
|
|
269
|
+
return suppressForAgentMention || suppressForSingleLink;
|
|
270
|
+
}, [sliceForAgentMentionSuppression, hasVisibleAiActions]);
|
|
258
271
|
var prevShowToolbarRef = useRef(false);
|
|
259
272
|
var popupContentRef = useRef(null);
|
|
260
273
|
useEffect(function () {
|
|
@@ -331,27 +344,15 @@ export var PasteActionsMenu = function PasteActionsMenu(_ref) {
|
|
|
331
344
|
// onPositionCalculated with fresh viewport coordinates.
|
|
332
345
|
var overflowScrollParent = shouldRenderToolbar ? findOverflowScrollParent(editorView.dom) : false;
|
|
333
346
|
var effectiveScrollableElement = overflowScrollParent || scrollableElement;
|
|
334
|
-
var pasteMenuComponents = (_api$uiControlRegistr = api === null || api === void 0 || (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(PASTE_MENU.key)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : [];
|
|
335
347
|
var anyComponentVisible = hasVisibleButton(pasteMenuComponents);
|
|
336
348
|
|
|
337
|
-
// eslint-disable-next-line @atlassian/perf-linting/no-expensive-computations-in-render -- pasteMenuComponents changes by reference each render; filter is small (< 10 items)
|
|
338
|
-
var aiMenuItems = pasteMenuComponents.filter(function (c) {
|
|
339
|
-
var _c$parents;
|
|
340
|
-
return c.type === 'menu-item' && ((_c$parents = c.parents) === null || _c$parents === void 0 ? void 0 : _c$parents.some(function (p) {
|
|
341
|
-
return p.key === AI_PASTE_MENU_SECTION.key;
|
|
342
|
-
}));
|
|
343
|
-
});
|
|
344
|
-
var visibleAiActionKeys = getVisibleKeys(aiMenuItems, ['menu-item']);
|
|
345
|
-
|
|
346
349
|
// Whether the card plugin's "Display as" section is visible when the menu opens.
|
|
347
350
|
var displayAsVisible = getVisibleKeys(pasteMenuComponents, ['menu-section']).includes(SMART_LINK_DISPLAY_AS_PASTE_MENU_SECTION.key);
|
|
348
|
-
|
|
349
351
|
// Two positioning modes:
|
|
350
352
|
// 1. Inline: no AI actions visible — menu appears to the right of the cursor,
|
|
351
353
|
// vertically centered with the text line.
|
|
352
354
|
// 2. Block-anchored: AI actions are visible — menu appears at the right edge
|
|
353
355
|
// of the content block, aligned with paste start.
|
|
354
|
-
var hasVisibleAiActions = visibleAiActionKeys.length > 0;
|
|
355
356
|
useEffect(function () {
|
|
356
357
|
if (!prevShowToolbarRef.current && shouldRenderToolbar) {
|
|
357
358
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.fireAnalyticsEvent({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-paste-options-toolbar",
|
|
3
|
-
"version": "13.1.
|
|
3
|
+
"version": "13.1.7",
|
|
4
4
|
"description": "Paste options toolbar for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
"@atlaskit/icon": "^37.0.0",
|
|
35
35
|
"@atlaskit/platform-feature-flags": "^2.0.0",
|
|
36
36
|
"@atlaskit/primitives": "^20.6.0",
|
|
37
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
38
|
-
"@atlaskit/tokens": "^15.
|
|
37
|
+
"@atlaskit/tmp-editor-statsig": "^125.0.0",
|
|
38
|
+
"@atlaskit/tokens": "^15.8.0",
|
|
39
39
|
"@babel/runtime": "^7.0.0",
|
|
40
40
|
"@compiled/react": "^0.20.0",
|
|
41
41
|
"@emotion/react": "^11.7.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"@atlaskit/editor-common": "^116.
|
|
44
|
+
"@atlaskit/editor-common": "^116.30.0",
|
|
45
45
|
"react": "^18.2.0",
|
|
46
46
|
"react-dom": "^18.2.0",
|
|
47
47
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|