@atlaskit/editor-common 134.11.0 → 134.11.2
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 +17 -0
- package/afm-products/tsconfig.json +3 -0
- package/dist/cjs/credit-guard/CreditCheckedPopup.compiled.css +4 -0
- package/dist/cjs/credit-guard/CreditCheckedPopup.js +30 -17
- package/dist/cjs/credit-guard/useAICreditGuard.js +11 -5
- package/dist/cjs/element-browser/components/ElementList/ElementList.js +21 -20
- package/dist/cjs/element-browser/components/StatelessElementBrowser.js +11 -9
- package/dist/cjs/link/ConfigureLinkOverlay/Dropdown.js +4 -4
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/quick-insert/insert-menu-check.js +6 -2
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/credit-guard/CreditCheckedPopup.compiled.css +4 -0
- package/dist/es2019/credit-guard/CreditCheckedPopup.js +30 -17
- package/dist/es2019/credit-guard/useAICreditGuard.js +11 -5
- package/dist/es2019/element-browser/components/ElementList/ElementList.js +21 -20
- package/dist/es2019/element-browser/components/StatelessElementBrowser.js +11 -5
- package/dist/es2019/link/ConfigureLinkOverlay/Dropdown.js +2 -2
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/quick-insert/insert-menu-check.js +6 -2
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/credit-guard/CreditCheckedPopup.compiled.css +4 -0
- package/dist/esm/credit-guard/CreditCheckedPopup.js +30 -17
- package/dist/esm/credit-guard/useAICreditGuard.js +11 -5
- package/dist/esm/element-browser/components/ElementList/ElementList.js +21 -20
- package/dist/esm/element-browser/components/StatelessElementBrowser.js +11 -9
- package/dist/esm/link/ConfigureLinkOverlay/Dropdown.js +2 -2
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/quick-insert/insert-menu-check.js +6 -2
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/quick-insert/insert-menu-check.d.ts +3 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 134.11.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`e0fb460e4c662`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e0fb460e4c662) -
|
|
8
|
+
Use named dropdown menu component imports from their dedicated export paths.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 134.11.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`151543bef053c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/151543bef053c) -
|
|
16
|
+
Simplify synchronous Editor credit checks at insert-menu call sites, preserve active feedback
|
|
17
|
+
across provider changes, and keep query keyboard listeners stable. Credit enforcement remains
|
|
18
|
+
behind the product UBP experiments and rovo_credits_degradation_ui.
|
|
19
|
+
|
|
3
20
|
## 134.11.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
|
@@ -154,6 +154,9 @@
|
|
|
154
154
|
{
|
|
155
155
|
"path": "../../../design-system/popper/afm-products/tsconfig.json"
|
|
156
156
|
},
|
|
157
|
+
{
|
|
158
|
+
"path": "../../../design-system/popup/afm-products/tsconfig.json"
|
|
159
|
+
},
|
|
157
160
|
{
|
|
158
161
|
"path": "../../../design-system/primitives/afm-products/tsconfig.json"
|
|
159
162
|
},
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
._19bvpxbi{padding-left:var(--ds-space-200,1pc)}
|
|
1
2
|
._1bsb5jys{width:11pc}
|
|
3
|
+
._ca0qpxbi{padding-top:var(--ds-space-200,1pc)}
|
|
4
|
+
._n3tdpxbi{padding-bottom:var(--ds-space-200,1pc)}
|
|
2
5
|
._p12f1osq{max-width:100%}
|
|
6
|
+
._u5f3pxbi{padding-right:var(--ds-space-200,1pc)}
|
|
3
7
|
._vchhusvi{box-sizing:border-box}
|
|
@@ -28,9 +28,13 @@ var CreditPopupTrigger = function CreditPopupTrigger(_ref) {
|
|
|
28
28
|
var popupRef = props.ref;
|
|
29
29
|
var ref = (0, _react.useCallback)(function (element) {
|
|
30
30
|
onElement(element);
|
|
31
|
-
if (typeof popupRef === 'function')
|
|
32
|
-
|
|
33
|
-
})
|
|
31
|
+
if (typeof popupRef === 'function') {
|
|
32
|
+
popupRef(element);
|
|
33
|
+
} else if (popupRef) {
|
|
34
|
+
Object.assign(popupRef, {
|
|
35
|
+
current: element
|
|
36
|
+
});
|
|
37
|
+
}
|
|
34
38
|
}, [onElement, popupRef]);
|
|
35
39
|
return renderTrigger(_objectSpread(_objectSpread({}, props), {}, {
|
|
36
40
|
ref: ref,
|
|
@@ -38,7 +42,7 @@ var CreditPopupTrigger = function CreditPopupTrigger(_ref) {
|
|
|
38
42
|
}));
|
|
39
43
|
};
|
|
40
44
|
var styles = {
|
|
41
|
-
content: "_1bsb5jys _p12f1osq _vchhusvi"
|
|
45
|
+
content: "_1bsb5jys _p12f1osq _vchhusvi _ca0qpxbi _u5f3pxbi _n3tdpxbi _19bvpxbi"
|
|
42
46
|
};
|
|
43
47
|
var stopPropagation = function stopPropagation(event) {
|
|
44
48
|
return event.stopPropagation();
|
|
@@ -74,14 +78,18 @@ var CreditPopup = function CreditPopup(_ref2) {
|
|
|
74
78
|
wasOpen.current = feedback !== null;
|
|
75
79
|
}, [feedback, triggerElement]);
|
|
76
80
|
(0, _react.useEffect)(function () {
|
|
77
|
-
if (!feedback || !contentElement || !isNestedMenu)
|
|
81
|
+
if (!feedback || !contentElement || !isNestedMenu) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
78
84
|
return (0, _bindEventListener.bind)(contentElement.ownerDocument, {
|
|
79
85
|
type: 'scroll',
|
|
80
86
|
options: {
|
|
81
87
|
capture: true
|
|
82
88
|
},
|
|
83
89
|
listener: function listener(event) {
|
|
84
|
-
if (event.target instanceof Node && contentElement.contains(event.target))
|
|
90
|
+
if (event.target instanceof Node && contentElement.contains(event.target)) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
85
93
|
close();
|
|
86
94
|
}
|
|
87
95
|
});
|
|
@@ -89,16 +97,17 @@ var CreditPopup = function CreditPopup(_ref2) {
|
|
|
89
97
|
var onKeyDown = (0, _react.useCallback)(function (event) {
|
|
90
98
|
event.stopPropagation();
|
|
91
99
|
if (event.key === 'Escape') {
|
|
92
|
-
var _returnFocus$current;
|
|
93
100
|
event.preventDefault();
|
|
94
101
|
close();
|
|
95
|
-
if (isNestedMenu)
|
|
102
|
+
if (isNestedMenu) {
|
|
103
|
+
var _returnFocus$current;
|
|
104
|
+
(_returnFocus$current = returnFocus.current) === null || _returnFocus$current === void 0 || _returnFocus$current.focus();
|
|
105
|
+
}
|
|
96
106
|
}
|
|
97
107
|
}, [close, isNestedMenu]);
|
|
98
108
|
var content = (0, _react.useCallback)(function () {
|
|
99
109
|
return /*#__PURE__*/_react.default.createElement(_box.Box, {
|
|
100
110
|
ref: setContentElement,
|
|
101
|
-
padding: "space.200",
|
|
102
111
|
xcss: styles.content,
|
|
103
112
|
role: "none",
|
|
104
113
|
onClick: stopPropagation,
|
|
@@ -147,7 +156,9 @@ var CreditCheckedActionPopup = function CreditCheckedActionPopup(_ref3) {
|
|
|
147
156
|
close();
|
|
148
157
|
return;
|
|
149
158
|
}
|
|
150
|
-
if (check(creditCheck))
|
|
159
|
+
if (check(creditCheck)) {
|
|
160
|
+
onAllowed(event);
|
|
161
|
+
}
|
|
151
162
|
}, [feedback, close, check, creditCheck, onAllowed]);
|
|
152
163
|
var trigger = (0, _react.useCallback)(function (props) {
|
|
153
164
|
return renderTrigger(_objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -165,13 +176,15 @@ var CreditCheckedActionPopup = function CreditCheckedActionPopup(_ref3) {
|
|
|
165
176
|
|
|
166
177
|
/** Reuses the toolbar action contract; insert-menu adapters can supply an externally triggered guard. */
|
|
167
178
|
var CreditCheckedPopup = exports.CreditCheckedPopup = function CreditCheckedPopup(props) {
|
|
168
|
-
if ('guard' in props)
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
179
|
+
if ('guard' in props) {
|
|
180
|
+
return /*#__PURE__*/_react.default.createElement(CreditPopup, {
|
|
181
|
+
guard: props.guard,
|
|
182
|
+
placement: props.placement,
|
|
183
|
+
renderTrigger: props.renderTrigger,
|
|
184
|
+
isNestedMenu: props.isNestedMenu,
|
|
185
|
+
shouldRenderToParent: props.shouldRenderToParent
|
|
186
|
+
});
|
|
187
|
+
}
|
|
175
188
|
return /*#__PURE__*/_react.default.createElement(CreditCheckedActionPopup, {
|
|
176
189
|
creditCheck: props.creditCheck,
|
|
177
190
|
getAICreditStatus: props.getAICreditStatus,
|
|
@@ -23,17 +23,23 @@ var useAICreditGuard = exports.useAICreditGuard = function useAICreditGuard(getA
|
|
|
23
23
|
return setFeedback(null);
|
|
24
24
|
}, []);
|
|
25
25
|
(0, _react.useLayoutEffect)(function () {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
if (!isActive) {
|
|
27
|
+
close();
|
|
28
|
+
setIsBlocked(false);
|
|
29
|
+
}
|
|
30
|
+
}, [isActive, close]);
|
|
29
31
|
var check = (0, _react.useCallback)(function (creditCheck) {
|
|
30
32
|
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
31
33
|
_ref$showFeedback = _ref.showFeedback,
|
|
32
34
|
showFeedback = _ref$showFeedback === void 0 ? true : _ref$showFeedback;
|
|
33
|
-
if (!isActive)
|
|
35
|
+
if (!isActive) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
34
38
|
var result = (0, _checkAICreditStatus.checkAICreditStatus)(getAICreditStatus, creditCheck);
|
|
35
39
|
setIsBlocked(result.isBlocked);
|
|
36
|
-
if (showFeedback)
|
|
40
|
+
if (showFeedback) {
|
|
41
|
+
setFeedback(result.isBlocked ? result : null);
|
|
42
|
+
}
|
|
37
43
|
return !result.isBlocked;
|
|
38
44
|
}, [getAICreditStatus, isActive]);
|
|
39
45
|
return {
|
|
@@ -25,7 +25,6 @@ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
|
25
25
|
var _Tooltip = _interopRequireDefault(require("@atlaskit/tooltip/Tooltip"));
|
|
26
26
|
var _analytics = require("../../../analytics");
|
|
27
27
|
var _quickInsert = require("../../../quick-insert");
|
|
28
|
-
var _insertMenuCheck = require("../../../quick-insert/insert-menu-check");
|
|
29
28
|
var _constants = require("../../constants");
|
|
30
29
|
var _useContainerWidth2 = _interopRequireDefault(require("../../hooks/use-container-width"));
|
|
31
30
|
var _useFocus = _interopRequireDefault(require("../../hooks/use-focus"));
|
|
@@ -395,31 +394,33 @@ function ElementItem(_ref6) {
|
|
|
395
394
|
* This implementation was changed for keyboard/click selection to work with `onInsertItem`.
|
|
396
395
|
*/
|
|
397
396
|
var onClick = (0, _react.useCallback)(function (e) {
|
|
397
|
+
var _item$onBeforeSelect;
|
|
398
398
|
e.preventDefault();
|
|
399
399
|
e.stopPropagation();
|
|
400
400
|
setFocusedItemIndex(index);
|
|
401
401
|
var detail = e.nativeEvent.detail;
|
|
402
|
-
(0
|
|
402
|
+
if (((_item$onBeforeSelect = item.onBeforeSelect) === null || _item$onBeforeSelect === void 0 ? void 0 : _item$onBeforeSelect.call(item, {
|
|
403
403
|
surface: surface
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
|
|
404
|
+
})) === false) {
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
switch (detail) {
|
|
408
|
+
case 0:
|
|
409
|
+
onInsertItem(item);
|
|
410
|
+
break;
|
|
411
|
+
case 1:
|
|
412
|
+
if (inlineMode) {
|
|
407
413
|
onInsertItem(item);
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
break;
|
|
419
|
-
default:
|
|
420
|
-
return;
|
|
421
|
-
}
|
|
422
|
-
});
|
|
414
|
+
}
|
|
415
|
+
break;
|
|
416
|
+
case 2:
|
|
417
|
+
if (!inlineMode) {
|
|
418
|
+
onInsertItem(item);
|
|
419
|
+
}
|
|
420
|
+
break;
|
|
421
|
+
default:
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
423
424
|
}, [index, inlineMode, item, onInsertItem, setFocusedItemIndex, surface]);
|
|
424
425
|
var renderItem = (0, _react.useCallback)(function (triggerProps) {
|
|
425
426
|
return (0, _react2.jsx)(ElementItemButton, {
|
|
@@ -15,7 +15,6 @@ var _withAnalyticsContext = _interopRequireDefault(require("@atlaskit/analytics-
|
|
|
15
15
|
var _withAnalyticsEvents = _interopRequireDefault(require("@atlaskit/analytics-next/withAnalyticsEvents"));
|
|
16
16
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
17
17
|
var _analytics = require("../../analytics");
|
|
18
|
-
var _insertMenuCheck = require("../../quick-insert/insert-menu-check");
|
|
19
18
|
var _getEditorUgcToken = _interopRequireDefault(require("../../ugc-tokens/get-editor-ugc-token"));
|
|
20
19
|
var _ViewMore = require("../components/ViewMore");
|
|
21
20
|
var _constants = require("../constants");
|
|
@@ -222,11 +221,12 @@ function StatelessElementBrowser(props) {
|
|
|
222
221
|
}
|
|
223
222
|
e.preventDefault();
|
|
224
223
|
if (onInsertItem && selectedItem != null && !((_selectedItem$isDisab = selectedItem.isDisabled) !== null && _selectedItem$isDisab !== void 0 ? _selectedItem$isDisab : false)) {
|
|
225
|
-
|
|
224
|
+
var _selectedItem$onBefor;
|
|
225
|
+
if (((_selectedItem$onBefor = selectedItem.onBeforeSelect) === null || _selectedItem$onBefor === void 0 ? void 0 : _selectedItem$onBefor.call(selectedItem, {
|
|
226
226
|
surface: surface
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
}
|
|
227
|
+
})) !== false) {
|
|
228
|
+
onInsertItem(selectedItem);
|
|
229
|
+
}
|
|
230
230
|
}
|
|
231
231
|
}, [onInsertItem, selectedItem, setFocusedCategoryIndex, showCategories, selectedCategoryIndex, surface]);
|
|
232
232
|
|
|
@@ -236,13 +236,15 @@ function StatelessElementBrowser(props) {
|
|
|
236
236
|
*/
|
|
237
237
|
(0, _react.useEffect)(function () {
|
|
238
238
|
if (onSelectItem && selectedItem != null) {
|
|
239
|
+
var _selectedItem$onBefor2;
|
|
239
240
|
// Highlighting is eligibility-only: arrows must never open a popup or take focus.
|
|
240
|
-
|
|
241
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-chain-state-updates -- Synchronize silent eligibility with the product-supplied guard before notifying the parent selection.
|
|
242
|
+
if (((_selectedItem$onBefor2 = selectedItem.onBeforeSelect) === null || _selectedItem$onBefor2 === void 0 ? void 0 : _selectedItem$onBefor2.call(selectedItem, {
|
|
241
243
|
surface: surface,
|
|
242
244
|
showFeedback: false
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
}
|
|
245
|
+
})) !== false) {
|
|
246
|
+
onSelectItem(selectedItem);
|
|
247
|
+
}
|
|
246
248
|
}
|
|
247
249
|
}, [onSelectItem, selectedItem, surface, focusedItemIndex, selectedItemIndex]);
|
|
248
250
|
var onSelectCategoryCB = (0, _react.useCallback)(function (category) {
|
|
@@ -11,9 +11,9 @@ var _react = require("react");
|
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
12
|
var _reactIntl = require("react-intl");
|
|
13
13
|
var _withAnalyticsContext = _interopRequireDefault(require("@atlaskit/analytics-next/withAnalyticsContext"));
|
|
14
|
+
var _dropdownItem = require("@atlaskit/dropdown-menu/dropdown-item");
|
|
15
|
+
var _dropdownItemGroup = require("@atlaskit/dropdown-menu/dropdown-item-group");
|
|
14
16
|
var _dropdownMenu = require("@atlaskit/dropdown-menu/dropdown-menu");
|
|
15
|
-
var _dropdownMenuItem = require("@atlaskit/dropdown-menu/dropdown-menu-item");
|
|
16
|
-
var _dropdownMenuItemGroup = require("@atlaskit/dropdown-menu/dropdown-menu-item-group");
|
|
17
17
|
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/core/chevron-down"));
|
|
18
18
|
var _customize = _interopRequireDefault(require("@atlaskit/icon/core/customize"));
|
|
19
19
|
var _linkExternal = _interopRequireDefault(require("@atlaskit/icon/core/link-external"));
|
|
@@ -117,13 +117,13 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
117
117
|
},
|
|
118
118
|
testId: "".concat(testId, "-dropdown"),
|
|
119
119
|
onOpenChange: onOpenChange
|
|
120
|
-
}, (0, _react2.jsx)(
|
|
120
|
+
}, (0, _react2.jsx)(_dropdownItemGroup.DropdownItemGroup, null, (0, _react2.jsx)(_dropdownItem.DropdownItem, {
|
|
121
121
|
elemBefore: (0, _react2.jsx)(_linkExternal.default, {
|
|
122
122
|
label: goToLinkLabel
|
|
123
123
|
}),
|
|
124
124
|
testId: "".concat(testId, "-dropdown-item-open-link"),
|
|
125
125
|
onClick: onGoToLinkClick
|
|
126
|
-
}, goToLinkLabel), (0, _react2.jsx)(
|
|
126
|
+
}, goToLinkLabel), (0, _react2.jsx)(_dropdownItem.DropdownItem, {
|
|
127
127
|
elemBefore: (0, _react2.jsx)(_customize.default, {
|
|
128
128
|
label: configureLinkLabel
|
|
129
129
|
}),
|
|
@@ -27,7 +27,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
|
|
|
27
27
|
var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
|
|
28
28
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
29
29
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
30
|
-
var packageVersion = "134.
|
|
30
|
+
var packageVersion = "134.11.1";
|
|
31
31
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
32
32
|
// Remove URL as it has UGC
|
|
33
33
|
// Ignored via go/ees007
|
|
@@ -4,8 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.runInsertMenuItemCheck = void 0;
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Compatibility helper for existing package consumers; Editor callers check item.onBeforeSelect directly.
|
|
9
|
+
*/
|
|
8
10
|
var runInsertMenuItemCheck = exports.runInsertMenuItemCheck = function runInsertMenuItemCheck(item, options, onAllowed) {
|
|
9
11
|
var _item$onBeforeSelect;
|
|
10
|
-
if (((_item$onBeforeSelect = item.onBeforeSelect) === null || _item$onBeforeSelect === void 0 ? void 0 : _item$onBeforeSelect.call(item, options)) !== false)
|
|
12
|
+
if (((_item$onBeforeSelect = item.onBeforeSelect) === null || _item$onBeforeSelect === void 0 ? void 0 : _item$onBeforeSelect.call(item, options)) !== false) {
|
|
13
|
+
onAllowed();
|
|
14
|
+
}
|
|
11
15
|
};
|
|
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
23
23
|
* @jsx jsx
|
|
24
24
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
25
25
|
var packageName = "@atlaskit/editor-common";
|
|
26
|
-
var packageVersion = "134.
|
|
26
|
+
var packageVersion = "134.11.1";
|
|
27
27
|
var halfFocusRing = 1;
|
|
28
28
|
var dropOffset = '0, 8';
|
|
29
29
|
// Ignored via go/ees005
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
._19bvpxbi{padding-left:var(--ds-space-200,1pc)}
|
|
1
2
|
._1bsb5jys{width:11pc}
|
|
3
|
+
._ca0qpxbi{padding-top:var(--ds-space-200,1pc)}
|
|
4
|
+
._n3tdpxbi{padding-bottom:var(--ds-space-200,1pc)}
|
|
2
5
|
._p12f1osq{max-width:100%}
|
|
6
|
+
._u5f3pxbi{padding-right:var(--ds-space-200,1pc)}
|
|
3
7
|
._vchhusvi{box-sizing:border-box}
|
|
@@ -16,9 +16,13 @@ const CreditPopupTrigger = ({
|
|
|
16
16
|
const popupRef = props.ref;
|
|
17
17
|
const ref = useCallback(element => {
|
|
18
18
|
onElement(element);
|
|
19
|
-
if (typeof popupRef === 'function')
|
|
20
|
-
|
|
21
|
-
})
|
|
19
|
+
if (typeof popupRef === 'function') {
|
|
20
|
+
popupRef(element);
|
|
21
|
+
} else if (popupRef) {
|
|
22
|
+
Object.assign(popupRef, {
|
|
23
|
+
current: element
|
|
24
|
+
});
|
|
25
|
+
}
|
|
22
26
|
}, [onElement, popupRef]);
|
|
23
27
|
return renderTrigger({
|
|
24
28
|
...props,
|
|
@@ -27,7 +31,7 @@ const CreditPopupTrigger = ({
|
|
|
27
31
|
});
|
|
28
32
|
};
|
|
29
33
|
const styles = {
|
|
30
|
-
content: "_1bsb5jys _p12f1osq _vchhusvi"
|
|
34
|
+
content: "_1bsb5jys _p12f1osq _vchhusvi _ca0qpxbi _u5f3pxbi _n3tdpxbi _19bvpxbi"
|
|
31
35
|
};
|
|
32
36
|
const stopPropagation = event => event.stopPropagation();
|
|
33
37
|
|
|
@@ -55,14 +59,18 @@ const CreditPopup = ({
|
|
|
55
59
|
wasOpen.current = feedback !== null;
|
|
56
60
|
}, [feedback, triggerElement]);
|
|
57
61
|
useEffect(() => {
|
|
58
|
-
if (!feedback || !contentElement || !isNestedMenu)
|
|
62
|
+
if (!feedback || !contentElement || !isNestedMenu) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
59
65
|
return bind(contentElement.ownerDocument, {
|
|
60
66
|
type: 'scroll',
|
|
61
67
|
options: {
|
|
62
68
|
capture: true
|
|
63
69
|
},
|
|
64
70
|
listener: event => {
|
|
65
|
-
if (event.target instanceof Node && contentElement.contains(event.target))
|
|
71
|
+
if (event.target instanceof Node && contentElement.contains(event.target)) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
66
74
|
close();
|
|
67
75
|
}
|
|
68
76
|
});
|
|
@@ -70,15 +78,16 @@ const CreditPopup = ({
|
|
|
70
78
|
const onKeyDown = useCallback(event => {
|
|
71
79
|
event.stopPropagation();
|
|
72
80
|
if (event.key === 'Escape') {
|
|
73
|
-
var _returnFocus$current;
|
|
74
81
|
event.preventDefault();
|
|
75
82
|
close();
|
|
76
|
-
if (isNestedMenu)
|
|
83
|
+
if (isNestedMenu) {
|
|
84
|
+
var _returnFocus$current;
|
|
85
|
+
(_returnFocus$current = returnFocus.current) === null || _returnFocus$current === void 0 ? void 0 : _returnFocus$current.focus();
|
|
86
|
+
}
|
|
77
87
|
}
|
|
78
88
|
}, [close, isNestedMenu]);
|
|
79
89
|
const content = useCallback(() => /*#__PURE__*/React.createElement(Box, {
|
|
80
90
|
ref: setContentElement,
|
|
81
|
-
padding: "space.200",
|
|
82
91
|
xcss: styles.content,
|
|
83
92
|
role: "none",
|
|
84
93
|
onClick: stopPropagation,
|
|
@@ -127,7 +136,9 @@ const CreditCheckedActionPopup = ({
|
|
|
127
136
|
close();
|
|
128
137
|
return;
|
|
129
138
|
}
|
|
130
|
-
if (check(creditCheck))
|
|
139
|
+
if (check(creditCheck)) {
|
|
140
|
+
onAllowed(event);
|
|
141
|
+
}
|
|
131
142
|
}, [feedback, close, check, creditCheck, onAllowed]);
|
|
132
143
|
const trigger = useCallback(props => renderTrigger({
|
|
133
144
|
...props,
|
|
@@ -144,13 +155,15 @@ const CreditCheckedActionPopup = ({
|
|
|
144
155
|
|
|
145
156
|
/** Reuses the toolbar action contract; insert-menu adapters can supply an externally triggered guard. */
|
|
146
157
|
export const CreditCheckedPopup = props => {
|
|
147
|
-
if ('guard' in props)
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
158
|
+
if ('guard' in props) {
|
|
159
|
+
return /*#__PURE__*/React.createElement(CreditPopup, {
|
|
160
|
+
guard: props.guard,
|
|
161
|
+
placement: props.placement,
|
|
162
|
+
renderTrigger: props.renderTrigger,
|
|
163
|
+
isNestedMenu: props.isNestedMenu,
|
|
164
|
+
shouldRenderToParent: props.shouldRenderToParent
|
|
165
|
+
});
|
|
166
|
+
}
|
|
154
167
|
return /*#__PURE__*/React.createElement(CreditCheckedActionPopup, {
|
|
155
168
|
creditCheck: props.creditCheck,
|
|
156
169
|
getAICreditStatus: props.getAICreditStatus,
|
|
@@ -6,16 +6,22 @@ export const useAICreditGuard = (getAICreditStatus, isActive = true) => {
|
|
|
6
6
|
const [isBlocked, setIsBlocked] = useState(false);
|
|
7
7
|
const close = useCallback(() => setFeedback(null), []);
|
|
8
8
|
useLayoutEffect(() => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
if (!isActive) {
|
|
10
|
+
close();
|
|
11
|
+
setIsBlocked(false);
|
|
12
|
+
}
|
|
13
|
+
}, [isActive, close]);
|
|
12
14
|
const check = useCallback((creditCheck, {
|
|
13
15
|
showFeedback = true
|
|
14
16
|
} = {}) => {
|
|
15
|
-
if (!isActive)
|
|
17
|
+
if (!isActive) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
16
20
|
const result = checkAICreditStatus(getAICreditStatus, creditCheck);
|
|
17
21
|
setIsBlocked(result.isBlocked);
|
|
18
|
-
if (showFeedback)
|
|
22
|
+
if (showFeedback) {
|
|
23
|
+
setFeedback(result.isBlocked ? result : null);
|
|
24
|
+
}
|
|
19
25
|
return !result.isBlocked;
|
|
20
26
|
}, [getAICreditStatus, isActive]);
|
|
21
27
|
return {
|
|
@@ -23,7 +23,6 @@ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
|
23
23
|
import Tooltip from '@atlaskit/tooltip/Tooltip';
|
|
24
24
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '../../../analytics';
|
|
25
25
|
import { IconFallback } from '../../../quick-insert';
|
|
26
|
-
import { runInsertMenuItemCheck } from '../../../quick-insert/insert-menu-check';
|
|
27
26
|
import { ELEMENT_ITEM_HEIGHT, ELEMENT_ITEM_PADDING, ELEMENT_LIST_PADDING, SCROLLBAR_WIDTH } from '../../constants';
|
|
28
27
|
import useContainerWidth from '../../hooks/use-container-width';
|
|
29
28
|
import useFocus from '../../hooks/use-focus';
|
|
@@ -387,31 +386,33 @@ export function ElementItem({
|
|
|
387
386
|
* This implementation was changed for keyboard/click selection to work with `onInsertItem`.
|
|
388
387
|
*/
|
|
389
388
|
const onClick = useCallback(e => {
|
|
389
|
+
var _item$onBeforeSelect;
|
|
390
390
|
e.preventDefault();
|
|
391
391
|
e.stopPropagation();
|
|
392
392
|
setFocusedItemIndex(index);
|
|
393
393
|
const detail = e.nativeEvent.detail;
|
|
394
|
-
|
|
394
|
+
if (((_item$onBeforeSelect = item.onBeforeSelect) === null || _item$onBeforeSelect === void 0 ? void 0 : _item$onBeforeSelect.call(item, {
|
|
395
395
|
surface
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
|
|
396
|
+
})) === false) {
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
switch (detail) {
|
|
400
|
+
case 0:
|
|
401
|
+
onInsertItem(item);
|
|
402
|
+
break;
|
|
403
|
+
case 1:
|
|
404
|
+
if (inlineMode) {
|
|
399
405
|
onInsertItem(item);
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
break;
|
|
411
|
-
default:
|
|
412
|
-
return;
|
|
413
|
-
}
|
|
414
|
-
});
|
|
406
|
+
}
|
|
407
|
+
break;
|
|
408
|
+
case 2:
|
|
409
|
+
if (!inlineMode) {
|
|
410
|
+
onInsertItem(item);
|
|
411
|
+
}
|
|
412
|
+
break;
|
|
413
|
+
default:
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
415
416
|
}, [index, inlineMode, item, onInsertItem, setFocusedItemIndex, surface]);
|
|
416
417
|
const renderItem = useCallback(triggerProps => jsx(ElementItemButton, {
|
|
417
418
|
item: item,
|
|
@@ -12,7 +12,6 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
12
12
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
13
13
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
14
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '../../analytics';
|
|
15
|
-
import { runInsertMenuItemCheck } from '../../quick-insert/insert-menu-check';
|
|
16
15
|
import editorUGCToken from '../../ugc-tokens/get-editor-ugc-token';
|
|
17
16
|
import { ViewMore } from '../components/ViewMore';
|
|
18
17
|
import { DEVICE_BREAKPOINT_NUMBERS, ELEMENT_BROWSER_ID, ELEMENT_BROWSER_LIST_ID, GRID_SIZE, INLINE_SIDEBAR_HEIGHT, SIDEBAR_HEADING_WRAPPER_HEIGHT, SIDEBAR_WIDTH } from '../constants';
|
|
@@ -208,9 +207,12 @@ function StatelessElementBrowser(props) {
|
|
|
208
207
|
}
|
|
209
208
|
e.preventDefault();
|
|
210
209
|
if (onInsertItem && selectedItem != null && !((_selectedItem$isDisab = selectedItem.isDisabled) !== null && _selectedItem$isDisab !== void 0 ? _selectedItem$isDisab : false)) {
|
|
211
|
-
|
|
210
|
+
var _selectedItem$onBefor;
|
|
211
|
+
if (((_selectedItem$onBefor = selectedItem.onBeforeSelect) === null || _selectedItem$onBefor === void 0 ? void 0 : _selectedItem$onBefor.call(selectedItem, {
|
|
212
212
|
surface
|
|
213
|
-
}
|
|
213
|
+
})) !== false) {
|
|
214
|
+
onInsertItem(selectedItem);
|
|
215
|
+
}
|
|
214
216
|
}
|
|
215
217
|
}, [onInsertItem, selectedItem, setFocusedCategoryIndex, showCategories, selectedCategoryIndex, surface]);
|
|
216
218
|
|
|
@@ -220,11 +222,15 @@ function StatelessElementBrowser(props) {
|
|
|
220
222
|
*/
|
|
221
223
|
useEffect(() => {
|
|
222
224
|
if (onSelectItem && selectedItem != null) {
|
|
225
|
+
var _selectedItem$onBefor2;
|
|
223
226
|
// Highlighting is eligibility-only: arrows must never open a popup or take focus.
|
|
224
|
-
|
|
227
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-chain-state-updates -- Synchronize silent eligibility with the product-supplied guard before notifying the parent selection.
|
|
228
|
+
if (((_selectedItem$onBefor2 = selectedItem.onBeforeSelect) === null || _selectedItem$onBefor2 === void 0 ? void 0 : _selectedItem$onBefor2.call(selectedItem, {
|
|
225
229
|
surface,
|
|
226
230
|
showFeedback: false
|
|
227
|
-
}
|
|
231
|
+
})) !== false) {
|
|
232
|
+
onSelectItem(selectedItem);
|
|
233
|
+
}
|
|
228
234
|
}
|
|
229
235
|
}, [onSelectItem, selectedItem, surface, focusedItemIndex, selectedItemIndex]);
|
|
230
236
|
const onSelectCategoryCB = useCallback(category => {
|
|
@@ -8,9 +8,9 @@ import { useCallback } from 'react';
|
|
|
8
8
|
import { jsx } from '@emotion/react';
|
|
9
9
|
import { useIntl } from 'react-intl';
|
|
10
10
|
import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext';
|
|
11
|
+
import { DropdownItem } from '@atlaskit/dropdown-menu/dropdown-item';
|
|
12
|
+
import { DropdownItemGroup } from '@atlaskit/dropdown-menu/dropdown-item-group';
|
|
11
13
|
import { DropdownMenu } from '@atlaskit/dropdown-menu/dropdown-menu';
|
|
12
|
-
import { DropdownItem } from '@atlaskit/dropdown-menu/dropdown-menu-item';
|
|
13
|
-
import { DropdownItemGroup } from '@atlaskit/dropdown-menu/dropdown-menu-item-group';
|
|
14
14
|
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
15
15
|
import PreferencesIcon from '@atlaskit/icon/core/customize';
|
|
16
16
|
import LinkExternalIcon from '@atlaskit/icon/core/link-external';
|
|
@@ -13,7 +13,7 @@ const NETWORK_FAILURE_REGEX = /^network failure/i;
|
|
|
13
13
|
const RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
|
|
14
14
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
15
15
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
16
|
-
const packageVersion = "134.
|
|
16
|
+
const packageVersion = "134.11.1";
|
|
17
17
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
18
18
|
// Remove URL as it has UGC
|
|
19
19
|
// Ignored via go/ees007
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Compatibility helper for existing package consumers; Editor callers check item.onBeforeSelect directly.
|
|
3
|
+
*/
|
|
2
4
|
export const runInsertMenuItemCheck = (item, options, onAllowed) => {
|
|
3
5
|
var _item$onBeforeSelect;
|
|
4
|
-
if (((_item$onBeforeSelect = item.onBeforeSelect) === null || _item$onBeforeSelect === void 0 ? void 0 : _item$onBeforeSelect.call(item, options)) !== false)
|
|
6
|
+
if (((_item$onBeforeSelect = item.onBeforeSelect) === null || _item$onBeforeSelect === void 0 ? void 0 : _item$onBeforeSelect.call(item, options)) !== false) {
|
|
7
|
+
onAllowed();
|
|
8
|
+
}
|
|
5
9
|
};
|
|
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
13
13
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
14
14
|
import Layer from '../Layer';
|
|
15
15
|
const packageName = "@atlaskit/editor-common";
|
|
16
|
-
const packageVersion = "134.
|
|
16
|
+
const packageVersion = "134.11.1";
|
|
17
17
|
const halfFocusRing = 1;
|
|
18
18
|
const dropOffset = '0, 8';
|
|
19
19
|
// Ignored via go/ees005
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
._19bvpxbi{padding-left:var(--ds-space-200,1pc)}
|
|
1
2
|
._1bsb5jys{width:11pc}
|
|
3
|
+
._ca0qpxbi{padding-top:var(--ds-space-200,1pc)}
|
|
4
|
+
._n3tdpxbi{padding-bottom:var(--ds-space-200,1pc)}
|
|
2
5
|
._p12f1osq{max-width:100%}
|
|
6
|
+
._u5f3pxbi{padding-right:var(--ds-space-200,1pc)}
|
|
3
7
|
._vchhusvi{box-sizing:border-box}
|
|
@@ -19,9 +19,13 @@ var CreditPopupTrigger = function CreditPopupTrigger(_ref) {
|
|
|
19
19
|
var popupRef = props.ref;
|
|
20
20
|
var ref = useCallback(function (element) {
|
|
21
21
|
onElement(element);
|
|
22
|
-
if (typeof popupRef === 'function')
|
|
23
|
-
|
|
24
|
-
})
|
|
22
|
+
if (typeof popupRef === 'function') {
|
|
23
|
+
popupRef(element);
|
|
24
|
+
} else if (popupRef) {
|
|
25
|
+
Object.assign(popupRef, {
|
|
26
|
+
current: element
|
|
27
|
+
});
|
|
28
|
+
}
|
|
25
29
|
}, [onElement, popupRef]);
|
|
26
30
|
return renderTrigger(_objectSpread(_objectSpread({}, props), {}, {
|
|
27
31
|
ref: ref,
|
|
@@ -29,7 +33,7 @@ var CreditPopupTrigger = function CreditPopupTrigger(_ref) {
|
|
|
29
33
|
}));
|
|
30
34
|
};
|
|
31
35
|
var styles = {
|
|
32
|
-
content: "_1bsb5jys _p12f1osq _vchhusvi"
|
|
36
|
+
content: "_1bsb5jys _p12f1osq _vchhusvi _ca0qpxbi _u5f3pxbi _n3tdpxbi _19bvpxbi"
|
|
33
37
|
};
|
|
34
38
|
var stopPropagation = function stopPropagation(event) {
|
|
35
39
|
return event.stopPropagation();
|
|
@@ -65,14 +69,18 @@ var CreditPopup = function CreditPopup(_ref2) {
|
|
|
65
69
|
wasOpen.current = feedback !== null;
|
|
66
70
|
}, [feedback, triggerElement]);
|
|
67
71
|
useEffect(function () {
|
|
68
|
-
if (!feedback || !contentElement || !isNestedMenu)
|
|
72
|
+
if (!feedback || !contentElement || !isNestedMenu) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
69
75
|
return bind(contentElement.ownerDocument, {
|
|
70
76
|
type: 'scroll',
|
|
71
77
|
options: {
|
|
72
78
|
capture: true
|
|
73
79
|
},
|
|
74
80
|
listener: function listener(event) {
|
|
75
|
-
if (event.target instanceof Node && contentElement.contains(event.target))
|
|
81
|
+
if (event.target instanceof Node && contentElement.contains(event.target)) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
76
84
|
close();
|
|
77
85
|
}
|
|
78
86
|
});
|
|
@@ -80,16 +88,17 @@ var CreditPopup = function CreditPopup(_ref2) {
|
|
|
80
88
|
var onKeyDown = useCallback(function (event) {
|
|
81
89
|
event.stopPropagation();
|
|
82
90
|
if (event.key === 'Escape') {
|
|
83
|
-
var _returnFocus$current;
|
|
84
91
|
event.preventDefault();
|
|
85
92
|
close();
|
|
86
|
-
if (isNestedMenu)
|
|
93
|
+
if (isNestedMenu) {
|
|
94
|
+
var _returnFocus$current;
|
|
95
|
+
(_returnFocus$current = returnFocus.current) === null || _returnFocus$current === void 0 || _returnFocus$current.focus();
|
|
96
|
+
}
|
|
87
97
|
}
|
|
88
98
|
}, [close, isNestedMenu]);
|
|
89
99
|
var content = useCallback(function () {
|
|
90
100
|
return /*#__PURE__*/React.createElement(Box, {
|
|
91
101
|
ref: setContentElement,
|
|
92
|
-
padding: "space.200",
|
|
93
102
|
xcss: styles.content,
|
|
94
103
|
role: "none",
|
|
95
104
|
onClick: stopPropagation,
|
|
@@ -138,7 +147,9 @@ var CreditCheckedActionPopup = function CreditCheckedActionPopup(_ref3) {
|
|
|
138
147
|
close();
|
|
139
148
|
return;
|
|
140
149
|
}
|
|
141
|
-
if (check(creditCheck))
|
|
150
|
+
if (check(creditCheck)) {
|
|
151
|
+
onAllowed(event);
|
|
152
|
+
}
|
|
142
153
|
}, [feedback, close, check, creditCheck, onAllowed]);
|
|
143
154
|
var trigger = useCallback(function (props) {
|
|
144
155
|
return renderTrigger(_objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -156,13 +167,15 @@ var CreditCheckedActionPopup = function CreditCheckedActionPopup(_ref3) {
|
|
|
156
167
|
|
|
157
168
|
/** Reuses the toolbar action contract; insert-menu adapters can supply an externally triggered guard. */
|
|
158
169
|
export var CreditCheckedPopup = function CreditCheckedPopup(props) {
|
|
159
|
-
if ('guard' in props)
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
170
|
+
if ('guard' in props) {
|
|
171
|
+
return /*#__PURE__*/React.createElement(CreditPopup, {
|
|
172
|
+
guard: props.guard,
|
|
173
|
+
placement: props.placement,
|
|
174
|
+
renderTrigger: props.renderTrigger,
|
|
175
|
+
isNestedMenu: props.isNestedMenu,
|
|
176
|
+
shouldRenderToParent: props.shouldRenderToParent
|
|
177
|
+
});
|
|
178
|
+
}
|
|
166
179
|
return /*#__PURE__*/React.createElement(CreditCheckedActionPopup, {
|
|
167
180
|
creditCheck: props.creditCheck,
|
|
168
181
|
getAICreditStatus: props.getAICreditStatus,
|
|
@@ -16,17 +16,23 @@ export var useAICreditGuard = function useAICreditGuard(getAICreditStatus) {
|
|
|
16
16
|
return setFeedback(null);
|
|
17
17
|
}, []);
|
|
18
18
|
useLayoutEffect(function () {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
if (!isActive) {
|
|
20
|
+
close();
|
|
21
|
+
setIsBlocked(false);
|
|
22
|
+
}
|
|
23
|
+
}, [isActive, close]);
|
|
22
24
|
var check = useCallback(function (creditCheck) {
|
|
23
25
|
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
24
26
|
_ref$showFeedback = _ref.showFeedback,
|
|
25
27
|
showFeedback = _ref$showFeedback === void 0 ? true : _ref$showFeedback;
|
|
26
|
-
if (!isActive)
|
|
28
|
+
if (!isActive) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
27
31
|
var result = checkAICreditStatus(getAICreditStatus, creditCheck);
|
|
28
32
|
setIsBlocked(result.isBlocked);
|
|
29
|
-
if (showFeedback)
|
|
33
|
+
if (showFeedback) {
|
|
34
|
+
setFeedback(result.isBlocked ? result : null);
|
|
35
|
+
}
|
|
30
36
|
return !result.isBlocked;
|
|
31
37
|
}, [getAICreditStatus, isActive]);
|
|
32
38
|
return {
|
|
@@ -24,7 +24,6 @@ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
|
24
24
|
import Tooltip from '@atlaskit/tooltip/Tooltip';
|
|
25
25
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '../../../analytics';
|
|
26
26
|
import { IconFallback } from '../../../quick-insert';
|
|
27
|
-
import { runInsertMenuItemCheck } from '../../../quick-insert/insert-menu-check';
|
|
28
27
|
import { ELEMENT_ITEM_HEIGHT, ELEMENT_ITEM_PADDING, ELEMENT_LIST_PADDING, SCROLLBAR_WIDTH } from '../../constants';
|
|
29
28
|
import useContainerWidth from '../../hooks/use-container-width';
|
|
30
29
|
import useFocus from '../../hooks/use-focus';
|
|
@@ -385,31 +384,33 @@ export function ElementItem(_ref6) {
|
|
|
385
384
|
* This implementation was changed for keyboard/click selection to work with `onInsertItem`.
|
|
386
385
|
*/
|
|
387
386
|
var onClick = useCallback(function (e) {
|
|
387
|
+
var _item$onBeforeSelect;
|
|
388
388
|
e.preventDefault();
|
|
389
389
|
e.stopPropagation();
|
|
390
390
|
setFocusedItemIndex(index);
|
|
391
391
|
var detail = e.nativeEvent.detail;
|
|
392
|
-
|
|
392
|
+
if (((_item$onBeforeSelect = item.onBeforeSelect) === null || _item$onBeforeSelect === void 0 ? void 0 : _item$onBeforeSelect.call(item, {
|
|
393
393
|
surface: surface
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
|
|
394
|
+
})) === false) {
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
switch (detail) {
|
|
398
|
+
case 0:
|
|
399
|
+
onInsertItem(item);
|
|
400
|
+
break;
|
|
401
|
+
case 1:
|
|
402
|
+
if (inlineMode) {
|
|
397
403
|
onInsertItem(item);
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
break;
|
|
409
|
-
default:
|
|
410
|
-
return;
|
|
411
|
-
}
|
|
412
|
-
});
|
|
404
|
+
}
|
|
405
|
+
break;
|
|
406
|
+
case 2:
|
|
407
|
+
if (!inlineMode) {
|
|
408
|
+
onInsertItem(item);
|
|
409
|
+
}
|
|
410
|
+
break;
|
|
411
|
+
default:
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
413
414
|
}, [index, inlineMode, item, onInsertItem, setFocusedItemIndex, surface]);
|
|
414
415
|
var renderItem = useCallback(function (triggerProps) {
|
|
415
416
|
return jsx(ElementItemButton, {
|
|
@@ -13,7 +13,6 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
13
13
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
14
14
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
15
15
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, fireAnalyticsEvent } from '../../analytics';
|
|
16
|
-
import { runInsertMenuItemCheck } from '../../quick-insert/insert-menu-check';
|
|
17
16
|
import editorUGCToken from '../../ugc-tokens/get-editor-ugc-token';
|
|
18
17
|
import { ViewMore } from '../components/ViewMore';
|
|
19
18
|
import { DEVICE_BREAKPOINT_NUMBERS, ELEMENT_BROWSER_ID, ELEMENT_BROWSER_LIST_ID, GRID_SIZE, INLINE_SIDEBAR_HEIGHT, SIDEBAR_HEADING_WRAPPER_HEIGHT, SIDEBAR_WIDTH } from '../constants';
|
|
@@ -212,11 +211,12 @@ function StatelessElementBrowser(props) {
|
|
|
212
211
|
}
|
|
213
212
|
e.preventDefault();
|
|
214
213
|
if (onInsertItem && selectedItem != null && !((_selectedItem$isDisab = selectedItem.isDisabled) !== null && _selectedItem$isDisab !== void 0 ? _selectedItem$isDisab : false)) {
|
|
215
|
-
|
|
214
|
+
var _selectedItem$onBefor;
|
|
215
|
+
if (((_selectedItem$onBefor = selectedItem.onBeforeSelect) === null || _selectedItem$onBefor === void 0 ? void 0 : _selectedItem$onBefor.call(selectedItem, {
|
|
216
216
|
surface: surface
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
}
|
|
217
|
+
})) !== false) {
|
|
218
|
+
onInsertItem(selectedItem);
|
|
219
|
+
}
|
|
220
220
|
}
|
|
221
221
|
}, [onInsertItem, selectedItem, setFocusedCategoryIndex, showCategories, selectedCategoryIndex, surface]);
|
|
222
222
|
|
|
@@ -226,13 +226,15 @@ function StatelessElementBrowser(props) {
|
|
|
226
226
|
*/
|
|
227
227
|
useEffect(function () {
|
|
228
228
|
if (onSelectItem && selectedItem != null) {
|
|
229
|
+
var _selectedItem$onBefor2;
|
|
229
230
|
// Highlighting is eligibility-only: arrows must never open a popup or take focus.
|
|
230
|
-
|
|
231
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-chain-state-updates -- Synchronize silent eligibility with the product-supplied guard before notifying the parent selection.
|
|
232
|
+
if (((_selectedItem$onBefor2 = selectedItem.onBeforeSelect) === null || _selectedItem$onBefor2 === void 0 ? void 0 : _selectedItem$onBefor2.call(selectedItem, {
|
|
231
233
|
surface: surface,
|
|
232
234
|
showFeedback: false
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
}
|
|
235
|
+
})) !== false) {
|
|
236
|
+
onSelectItem(selectedItem);
|
|
237
|
+
}
|
|
236
238
|
}
|
|
237
239
|
}, [onSelectItem, selectedItem, surface, focusedItemIndex, selectedItemIndex]);
|
|
238
240
|
var onSelectCategoryCB = useCallback(function (category) {
|
|
@@ -11,9 +11,9 @@ import { useCallback } from 'react';
|
|
|
11
11
|
import { jsx } from '@emotion/react';
|
|
12
12
|
import { useIntl } from 'react-intl';
|
|
13
13
|
import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext';
|
|
14
|
+
import { DropdownItem } from '@atlaskit/dropdown-menu/dropdown-item';
|
|
15
|
+
import { DropdownItemGroup } from '@atlaskit/dropdown-menu/dropdown-item-group';
|
|
14
16
|
import { DropdownMenu } from '@atlaskit/dropdown-menu/dropdown-menu';
|
|
15
|
-
import { DropdownItem } from '@atlaskit/dropdown-menu/dropdown-menu-item';
|
|
16
|
-
import { DropdownItemGroup } from '@atlaskit/dropdown-menu/dropdown-menu-item-group';
|
|
17
17
|
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
18
18
|
import PreferencesIcon from '@atlaskit/icon/core/customize';
|
|
19
19
|
import LinkExternalIcon from '@atlaskit/icon/core/link-external';
|
|
@@ -19,7 +19,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
|
|
|
19
19
|
var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
|
|
20
20
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
21
21
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
22
|
-
var packageVersion = "134.
|
|
22
|
+
var packageVersion = "134.11.1";
|
|
23
23
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
24
24
|
// Remove URL as it has UGC
|
|
25
25
|
// Ignored via go/ees007
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Compatibility helper for existing package consumers; Editor callers check item.onBeforeSelect directly.
|
|
3
|
+
*/
|
|
2
4
|
export var runInsertMenuItemCheck = function runInsertMenuItemCheck(item, options, onAllowed) {
|
|
3
5
|
var _item$onBeforeSelect;
|
|
4
|
-
if (((_item$onBeforeSelect = item.onBeforeSelect) === null || _item$onBeforeSelect === void 0 ? void 0 : _item$onBeforeSelect.call(item, options)) !== false)
|
|
6
|
+
if (((_item$onBeforeSelect = item.onBeforeSelect) === null || _item$onBeforeSelect === void 0 ? void 0 : _item$onBeforeSelect.call(item, options)) !== false) {
|
|
7
|
+
onAllowed();
|
|
8
|
+
}
|
|
5
9
|
};
|
|
@@ -20,7 +20,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
20
20
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
21
21
|
import Layer from '../Layer';
|
|
22
22
|
var packageName = "@atlaskit/editor-common";
|
|
23
|
-
var packageVersion = "134.
|
|
23
|
+
var packageVersion = "134.11.1";
|
|
24
24
|
var halfFocusRing = 1;
|
|
25
25
|
var dropOffset = '0, 8';
|
|
26
26
|
// Ignored via go/ees005
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { QuickInsertItem } from '../provider-factory/quick-insert-provider';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Compatibility helper for existing package consumers; Editor callers check item.onBeforeSelect directly.
|
|
4
|
+
*/
|
|
3
5
|
export declare const runInsertMenuItemCheck: (item: QuickInsertItem, options: Parameters<NonNullable<QuickInsertItem['onBeforeSelect']>>[0], onAllowed: () => void) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "134.11.
|
|
3
|
+
"version": "134.11.2",
|
|
4
4
|
"description": "A package that contains common classes and components for editor and renderer",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@atlaskit/codemod-utils": "^5.2.0",
|
|
42
42
|
"@atlaskit/css": "^1.1.0",
|
|
43
43
|
"@atlaskit/custom-steps": "^1.1.0",
|
|
44
|
-
"@atlaskit/dropdown-menu": "^21.
|
|
44
|
+
"@atlaskit/dropdown-menu": "^21.3.0",
|
|
45
45
|
"@atlaskit/editor-json-transformer": "^10.0.0",
|
|
46
46
|
"@atlaskit/editor-palette": "^3.5.0",
|
|
47
47
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@atlaskit/media-common": "^14.7.0",
|
|
64
64
|
"@atlaskit/media-file-preview": "^2.0.0",
|
|
65
65
|
"@atlaskit/media-picker": "^73.3.0",
|
|
66
|
-
"@atlaskit/media-ui": "^31.
|
|
66
|
+
"@atlaskit/media-ui": "^31.8.0",
|
|
67
67
|
"@atlaskit/media-viewer": "^54.12.0",
|
|
68
68
|
"@atlaskit/mention": "^30.8.0",
|
|
69
69
|
"@atlaskit/menu": "^11.0.0",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"@atlaskit/teams-app-config": "^3.1.0",
|
|
88
88
|
"@atlaskit/textfield": "^10.3.0",
|
|
89
89
|
"@atlaskit/tmp-editor-statsig": "^260.0.0",
|
|
90
|
-
"@atlaskit/tokens": "^20.
|
|
90
|
+
"@atlaskit/tokens": "^20.11.0",
|
|
91
91
|
"@atlaskit/tooltip": "^24.4.0",
|
|
92
92
|
"@atlaskit/width-detector": "^7.2.0",
|
|
93
93
|
"@babel/runtime": "^7.0.0",
|