@atlaskit/editor-common 134.12.0 → 134.13.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 +20 -0
- package/credit-guard/floating-toolbar-button/package.json +10 -0
- package/credit-guard/floating-toolbar-item/package.json +10 -0
- package/dist/cjs/credit-guard/CreditCheckedFloatingToolbarButton.js +114 -0
- package/dist/cjs/credit-guard/CreditCheckedPopup.js +1 -1
- package/dist/cjs/credit-guard/getCreditCheckedFloatingToolbarItem.js +30 -0
- package/dist/cjs/element-browser/components/ViewMore.js +1 -1
- package/dist/cjs/extensibility/Extension/Lozenge/ExtensionFloatingLabel.js +1 -1
- package/dist/cjs/extensibility/GeneratedContentReveal.js +1 -1
- package/dist/cjs/extensions/UnknownMacroPlaceholder.js +1 -1
- package/dist/cjs/icons/shared/PanelErrorIcon.js +1 -1
- package/dist/cjs/icons/shared/PanelInfoIcon.js +1 -1
- package/dist/cjs/icons/shared/PanelNoteIcon.js +1 -1
- package/dist/cjs/icons/shared/PanelSuccessIcon.js +1 -1
- package/dist/cjs/icons/shared/PanelWarningIcon.js +1 -1
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/quick-insert/CompactQuickInsertMenuItem.js +1 -1
- package/dist/cjs/quick-insert/ElementBrowserQuickInsertMenuItem.js +1 -1
- package/dist/cjs/quick-insert/QuickInsertHoverPreview.js +1 -1
- package/dist/cjs/quick-insert/QuickInsertPreviewContent.js +1 -1
- package/dist/cjs/quick-insert/QuickInsertShortcut.js +1 -1
- package/dist/cjs/quick-insert/SkillTag.js +1 -1
- package/dist/cjs/table/NewSortingIcon.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/FloatingToolbar/Button.js +2 -0
- package/dist/cjs/ui/Shortcut/index.js +1 -1
- package/dist/cjs/ui/Toolbar/ButtonGroup.js +1 -1
- package/dist/cjs/ui/Toolbar/DropdownTriggerWrapper.js +1 -1
- package/dist/cjs/ui/Toolbar/DropdownWrapper.js +1 -1
- package/dist/cjs/ui/Toolbar/ExpandIcon.js +1 -1
- package/dist/cjs/ui/Toolbar/Separator.js +1 -1
- package/dist/es2019/credit-guard/CreditCheckedFloatingToolbarButton.js +102 -0
- package/dist/es2019/credit-guard/CreditCheckedPopup.js +1 -1
- package/dist/es2019/credit-guard/getCreditCheckedFloatingToolbarItem.js +21 -0
- package/dist/es2019/element-browser/components/ViewMore.js +1 -1
- package/dist/es2019/extensibility/Extension/Lozenge/ExtensionFloatingLabel.js +1 -1
- package/dist/es2019/extensibility/GeneratedContentReveal.js +1 -1
- package/dist/es2019/extensions/UnknownMacroPlaceholder.js +1 -1
- package/dist/es2019/icons/shared/PanelErrorIcon.js +1 -1
- package/dist/es2019/icons/shared/PanelInfoIcon.js +1 -1
- package/dist/es2019/icons/shared/PanelNoteIcon.js +1 -1
- package/dist/es2019/icons/shared/PanelSuccessIcon.js +1 -1
- package/dist/es2019/icons/shared/PanelWarningIcon.js +1 -1
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/quick-insert/CompactQuickInsertMenuItem.js +1 -1
- package/dist/es2019/quick-insert/ElementBrowserQuickInsertMenuItem.js +1 -1
- package/dist/es2019/quick-insert/QuickInsertHoverPreview.js +1 -1
- package/dist/es2019/quick-insert/QuickInsertPreviewContent.js +1 -1
- package/dist/es2019/quick-insert/QuickInsertShortcut.js +1 -1
- package/dist/es2019/quick-insert/SkillTag.js +1 -1
- package/dist/es2019/table/NewSortingIcon.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/FloatingToolbar/Button.js +2 -0
- package/dist/es2019/ui/Shortcut/index.js +1 -1
- package/dist/es2019/ui/Toolbar/ButtonGroup.js +1 -1
- package/dist/es2019/ui/Toolbar/DropdownTriggerWrapper.js +1 -1
- package/dist/es2019/ui/Toolbar/DropdownWrapper.js +1 -1
- package/dist/es2019/ui/Toolbar/ExpandIcon.js +1 -1
- package/dist/es2019/ui/Toolbar/Separator.js +1 -1
- package/dist/esm/credit-guard/CreditCheckedFloatingToolbarButton.js +106 -0
- package/dist/esm/credit-guard/CreditCheckedPopup.js +1 -1
- package/dist/esm/credit-guard/getCreditCheckedFloatingToolbarItem.js +24 -0
- package/dist/esm/element-browser/components/ViewMore.js +1 -1
- package/dist/esm/extensibility/Extension/Lozenge/ExtensionFloatingLabel.js +1 -1
- package/dist/esm/extensibility/GeneratedContentReveal.js +1 -1
- package/dist/esm/extensions/UnknownMacroPlaceholder.js +1 -1
- package/dist/esm/icons/shared/PanelErrorIcon.js +1 -1
- package/dist/esm/icons/shared/PanelInfoIcon.js +1 -1
- package/dist/esm/icons/shared/PanelNoteIcon.js +1 -1
- package/dist/esm/icons/shared/PanelSuccessIcon.js +1 -1
- package/dist/esm/icons/shared/PanelWarningIcon.js +1 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/quick-insert/CompactQuickInsertMenuItem.js +1 -1
- package/dist/esm/quick-insert/ElementBrowserQuickInsertMenuItem.js +1 -1
- package/dist/esm/quick-insert/QuickInsertHoverPreview.js +1 -1
- package/dist/esm/quick-insert/QuickInsertPreviewContent.js +1 -1
- package/dist/esm/quick-insert/QuickInsertShortcut.js +1 -1
- package/dist/esm/quick-insert/SkillTag.js +1 -1
- package/dist/esm/table/NewSortingIcon.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/FloatingToolbar/Button.js +2 -0
- package/dist/esm/ui/Shortcut/index.js +1 -1
- package/dist/esm/ui/Toolbar/ButtonGroup.js +1 -1
- package/dist/esm/ui/Toolbar/DropdownTriggerWrapper.js +1 -1
- package/dist/esm/ui/Toolbar/DropdownWrapper.js +1 -1
- package/dist/esm/ui/Toolbar/ExpandIcon.js +1 -1
- package/dist/esm/ui/Toolbar/Separator.js +1 -1
- package/dist/types/credit-guard/CreditCheckedFloatingToolbarButton.d.ts +26 -0
- package/dist/types/credit-guard/getCreditCheckedFloatingToolbarItem.d.ts +5 -0
- package/dist/types/ui/FloatingToolbar/Button.d.ts +1 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 134.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`47ddac78e97b7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/47ddac78e97b7) -
|
|
8
|
+
Add an optional `id` prop to the floating toolbar `Button`, and the
|
|
9
|
+
`@atlaskit/editor-common/credit-guard/floating-toolbar-button`
|
|
10
|
+
(`CreditCheckedFloatingToolbarButton`) and
|
|
11
|
+
`@atlaskit/editor-common/credit-guard/floating-toolbar-item`
|
|
12
|
+
(`getCreditCheckedFloatingToolbarItem`) entry points, which wrap a floating toolbar button so it
|
|
13
|
+
checks `getAICreditStatus` before running and anchors the product's credits popup to itself when
|
|
14
|
+
credits are blocked.
|
|
15
|
+
- [`3d2733c4e7948`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3d2733c4e7948) -
|
|
16
|
+
Update i18n NPM package versions for editor,editor-extensions,activity-platform,media,elements
|
|
17
|
+
(Group 3)
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 134.12.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-common/credit-guard/floating-toolbar-button",
|
|
3
|
+
"main": "../../dist/cjs/credit-guard/CreditCheckedFloatingToolbarButton.js",
|
|
4
|
+
"module": "../../dist/esm/credit-guard/CreditCheckedFloatingToolbarButton.js",
|
|
5
|
+
"module:es2019": "../../dist/es2019/credit-guard/CreditCheckedFloatingToolbarButton.js",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.compiled.css"
|
|
8
|
+
],
|
|
9
|
+
"types": "../../dist/types/credit-guard/CreditCheckedFloatingToolbarButton.d.ts"
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-common/credit-guard/floating-toolbar-item",
|
|
3
|
+
"main": "../../dist/cjs/credit-guard/getCreditCheckedFloatingToolbarItem.js",
|
|
4
|
+
"module": "../../dist/esm/credit-guard/getCreditCheckedFloatingToolbarItem.js",
|
|
5
|
+
"module:es2019": "../../dist/es2019/credit-guard/getCreditCheckedFloatingToolbarItem.js",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.compiled.css"
|
|
8
|
+
],
|
|
9
|
+
"types": "../../dist/types/credit-guard/getCreditCheckedFloatingToolbarItem.d.ts"
|
|
10
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.CreditCheckedFloatingToolbarButton = void 0;
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _Button = _interopRequireDefault(require("../ui/FloatingToolbar/Button"));
|
|
11
|
+
var _CreditCheckedPopup = require("./CreditCheckedPopup");
|
|
12
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
13
|
+
/**
|
|
14
|
+
* A confirm dialog needs the floating toolbar's own state, and a link would navigate before the
|
|
15
|
+
* credit check, so neither can be credit checked.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A floating toolbar button that checks AI credits before running its action, and anchors the
|
|
20
|
+
* product's credits popup to itself when credits are blocked. Matches the floating toolbar's own buttons.
|
|
21
|
+
*/
|
|
22
|
+
var CreditCheckedFloatingToolbarButton = exports.CreditCheckedFloatingToolbarButton = function CreditCheckedFloatingToolbarButton(_ref) {
|
|
23
|
+
var areAnyNewToolbarFlagsEnabled = _ref.areAnyNewToolbarFlagsEnabled,
|
|
24
|
+
button = _ref.button,
|
|
25
|
+
creditCheck = _ref.creditCheck,
|
|
26
|
+
getAICreditStatus = _ref.getAICreditStatus,
|
|
27
|
+
view = _ref.view;
|
|
28
|
+
var runCommand = (0, _react.useCallback)(function (command) {
|
|
29
|
+
if (view && command) {
|
|
30
|
+
command(view.state, view.dispatch, view);
|
|
31
|
+
}
|
|
32
|
+
}, [view]);
|
|
33
|
+
var focusEditoronEnter = button.focusEditoronEnter,
|
|
34
|
+
onClick = button.onClick;
|
|
35
|
+
var runAction = (0, _react.useCallback)(function () {
|
|
36
|
+
runCommand(onClick);
|
|
37
|
+
if (focusEditoronEnter && !(view !== null && view !== void 0 && view.hasFocus())) {
|
|
38
|
+
view === null || view === void 0 || view.focus();
|
|
39
|
+
}
|
|
40
|
+
}, [runCommand, onClick, focusEditoronEnter, view]);
|
|
41
|
+
var renderTrigger = (0, _react.useCallback)(function (triggerProps) {
|
|
42
|
+
var _button$disabled = button.disabled,
|
|
43
|
+
disabled = _button$disabled === void 0 ? false : _button$disabled,
|
|
44
|
+
showTitle = button.showTitle,
|
|
45
|
+
title = button.title;
|
|
46
|
+
var selected = Boolean(button.selected) || triggerProps.isSelected;
|
|
47
|
+
// Ignored via go/ees005
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
49
|
+
var ButtonIcon = button.icon;
|
|
50
|
+
var IconAfter = button.iconAfter;
|
|
51
|
+
return /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
52
|
+
ref: triggerProps.ref,
|
|
53
|
+
id: triggerProps.id
|
|
54
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/design-system/no-unsafe-style-overrides -- Matches the floating toolbar's own buttons
|
|
55
|
+
,
|
|
56
|
+
className: button.className,
|
|
57
|
+
title: title,
|
|
58
|
+
ariaLabel: button.ariaLabel,
|
|
59
|
+
icon: ButtonIcon ? /*#__PURE__*/_react.default.createElement(ButtonIcon, {
|
|
60
|
+
color: disabled ? "var(--ds-icon-disabled, #080F214A)" : selected ? "var(--ds-icon-selected, #1868DB)" : 'currentColor',
|
|
61
|
+
spacing: "spacious",
|
|
62
|
+
label: undefined,
|
|
63
|
+
"aria-hidden": true
|
|
64
|
+
}) : undefined,
|
|
65
|
+
iconAfter: IconAfter ? /*#__PURE__*/_react.default.createElement(IconAfter, {
|
|
66
|
+
label: ""
|
|
67
|
+
}) : undefined,
|
|
68
|
+
appearance: button.appearance,
|
|
69
|
+
onClick: triggerProps.onClick
|
|
70
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Matches the floating toolbar's own buttons
|
|
71
|
+
,
|
|
72
|
+
onMouseEnter: function onMouseEnter() {
|
|
73
|
+
return runCommand(button.onMouseEnter);
|
|
74
|
+
}
|
|
75
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Matches the floating toolbar's own buttons
|
|
76
|
+
,
|
|
77
|
+
onMouseLeave: function onMouseLeave() {
|
|
78
|
+
return runCommand(button.onMouseLeave);
|
|
79
|
+
}
|
|
80
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Matches the floating toolbar's own buttons
|
|
81
|
+
,
|
|
82
|
+
onFocus: function onFocus() {
|
|
83
|
+
return runCommand(button.onFocus);
|
|
84
|
+
}
|
|
85
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Matches the floating toolbar's own buttons
|
|
86
|
+
,
|
|
87
|
+
onBlur: function onBlur() {
|
|
88
|
+
return runCommand(button.onBlur);
|
|
89
|
+
},
|
|
90
|
+
onMount: button.onMount,
|
|
91
|
+
onUnmount: button.onUnmount,
|
|
92
|
+
selected: selected,
|
|
93
|
+
disabled: disabled,
|
|
94
|
+
tooltipContent: button.tooltipContent,
|
|
95
|
+
hideTooltipOnClick: button.hideTooltipOnClick,
|
|
96
|
+
hasNewContentOnTriggerClick: button.hasNewContentOnTriggerClick,
|
|
97
|
+
ariaHasPopup: triggerProps['aria-haspopup'],
|
|
98
|
+
areaControls: triggerProps['aria-controls'],
|
|
99
|
+
tabIndex: button.tabIndex,
|
|
100
|
+
isRadioButton: button.isRadioButton,
|
|
101
|
+
pulse: button.pulse,
|
|
102
|
+
testId: button.testId,
|
|
103
|
+
interactionName: button.interactionName,
|
|
104
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
105
|
+
}, showTitle && title);
|
|
106
|
+
}, [areAnyNewToolbarFlagsEnabled, button, runCommand]);
|
|
107
|
+
return /*#__PURE__*/_react.default.createElement(_CreditCheckedPopup.CreditCheckedPopup, {
|
|
108
|
+
creditCheck: creditCheck,
|
|
109
|
+
getAICreditStatus: getAICreditStatus,
|
|
110
|
+
onAllowed: runAction,
|
|
111
|
+
placement: "bottom-start",
|
|
112
|
+
renderTrigger: renderTrigger
|
|
113
|
+
});
|
|
114
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getCreditCheckedFloatingToolbarItem = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _CreditCheckedFloatingToolbarButton = require("./CreditCheckedFloatingToolbarButton");
|
|
10
|
+
/** Wraps a floating toolbar button so it is credit checked, keeping its own appearance and handlers. */
|
|
11
|
+
var getCreditCheckedFloatingToolbarItem = exports.getCreditCheckedFloatingToolbarItem = function getCreditCheckedFloatingToolbarItem(_ref) {
|
|
12
|
+
var areAnyNewToolbarFlagsEnabled = _ref.areAnyNewToolbarFlagsEnabled,
|
|
13
|
+
button = _ref.button,
|
|
14
|
+
creditCheck = _ref.creditCheck,
|
|
15
|
+
getAICreditStatus = _ref.getAICreditStatus;
|
|
16
|
+
return {
|
|
17
|
+
type: 'custom',
|
|
18
|
+
fallback: [],
|
|
19
|
+
render: function render(view, idx) {
|
|
20
|
+
return /*#__PURE__*/_react.default.createElement(_CreditCheckedFloatingToolbarButton.CreditCheckedFloatingToolbarButton, {
|
|
21
|
+
key: idx,
|
|
22
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled,
|
|
23
|
+
button: button,
|
|
24
|
+
creditCheck: creditCheck,
|
|
25
|
+
getAICreditStatus: getAICreditStatus,
|
|
26
|
+
view: view
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -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.12.0";
|
|
31
31
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
32
32
|
// Remove URL as it has UGC
|
|
33
33
|
// Ignored via go/ees007
|
|
@@ -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.12.0";
|
|
27
27
|
var halfFocusRing = 1;
|
|
28
28
|
var dropOffset = '0, 8';
|
|
29
29
|
// Ignored via go/ees005
|
|
@@ -27,6 +27,7 @@ var FloatingToolbarButton = function FloatingToolbarButton(_ref, forwardedRef) {
|
|
|
27
27
|
var title = _ref.title,
|
|
28
28
|
icon = _ref.icon,
|
|
29
29
|
iconAfter = _ref.iconAfter,
|
|
30
|
+
id = _ref.id,
|
|
30
31
|
onClick = _ref.onClick,
|
|
31
32
|
onKeyDown = _ref.onKeyDown,
|
|
32
33
|
onMouseEnter = _ref.onMouseEnter,
|
|
@@ -118,6 +119,7 @@ var FloatingToolbarButton = function FloatingToolbarButton(_ref, forwardedRef) {
|
|
|
118
119
|
})), areAnyNewToolbarFlagsEnabled ? customSizeAndPadding : {})
|
|
119
120
|
}, rest);
|
|
120
121
|
},
|
|
122
|
+
id: id,
|
|
121
123
|
"aria-label": ariaLabel || title,
|
|
122
124
|
"aria-pressed": ariaPressed,
|
|
123
125
|
"aria-checked": ariaChecked,
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import FloatingToolbarButtonComponent from '../ui/FloatingToolbar/Button';
|
|
3
|
+
import { CreditCheckedPopup } from './CreditCheckedPopup';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A confirm dialog needs the floating toolbar's own state, and a link would navigate before the
|
|
7
|
+
* credit check, so neither can be credit checked.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A floating toolbar button that checks AI credits before running its action, and anchors the
|
|
12
|
+
* product's credits popup to itself when credits are blocked. Matches the floating toolbar's own buttons.
|
|
13
|
+
*/
|
|
14
|
+
export const CreditCheckedFloatingToolbarButton = ({
|
|
15
|
+
areAnyNewToolbarFlagsEnabled,
|
|
16
|
+
button,
|
|
17
|
+
creditCheck,
|
|
18
|
+
getAICreditStatus,
|
|
19
|
+
view
|
|
20
|
+
}) => {
|
|
21
|
+
const runCommand = useCallback(command => {
|
|
22
|
+
if (view && command) {
|
|
23
|
+
command(view.state, view.dispatch, view);
|
|
24
|
+
}
|
|
25
|
+
}, [view]);
|
|
26
|
+
const {
|
|
27
|
+
focusEditoronEnter,
|
|
28
|
+
onClick
|
|
29
|
+
} = button;
|
|
30
|
+
const runAction = useCallback(() => {
|
|
31
|
+
runCommand(onClick);
|
|
32
|
+
if (focusEditoronEnter && !(view !== null && view !== void 0 && view.hasFocus())) {
|
|
33
|
+
view === null || view === void 0 ? void 0 : view.focus();
|
|
34
|
+
}
|
|
35
|
+
}, [runCommand, onClick, focusEditoronEnter, view]);
|
|
36
|
+
const renderTrigger = useCallback(triggerProps => {
|
|
37
|
+
const {
|
|
38
|
+
disabled = false,
|
|
39
|
+
showTitle,
|
|
40
|
+
title
|
|
41
|
+
} = button;
|
|
42
|
+
const selected = Boolean(button.selected) || triggerProps.isSelected;
|
|
43
|
+
// Ignored via go/ees005
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
45
|
+
const ButtonIcon = button.icon;
|
|
46
|
+
const IconAfter = button.iconAfter;
|
|
47
|
+
return /*#__PURE__*/React.createElement(FloatingToolbarButtonComponent, {
|
|
48
|
+
ref: triggerProps.ref,
|
|
49
|
+
id: triggerProps.id
|
|
50
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/design-system/no-unsafe-style-overrides -- Matches the floating toolbar's own buttons
|
|
51
|
+
,
|
|
52
|
+
className: button.className,
|
|
53
|
+
title: title,
|
|
54
|
+
ariaLabel: button.ariaLabel,
|
|
55
|
+
icon: ButtonIcon ? /*#__PURE__*/React.createElement(ButtonIcon, {
|
|
56
|
+
color: disabled ? "var(--ds-icon-disabled, #080F214A)" : selected ? "var(--ds-icon-selected, #1868DB)" : 'currentColor',
|
|
57
|
+
spacing: "spacious",
|
|
58
|
+
label: undefined,
|
|
59
|
+
"aria-hidden": true
|
|
60
|
+
}) : undefined,
|
|
61
|
+
iconAfter: IconAfter ? /*#__PURE__*/React.createElement(IconAfter, {
|
|
62
|
+
label: ""
|
|
63
|
+
}) : undefined,
|
|
64
|
+
appearance: button.appearance,
|
|
65
|
+
onClick: triggerProps.onClick
|
|
66
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Matches the floating toolbar's own buttons
|
|
67
|
+
,
|
|
68
|
+
onMouseEnter: () => runCommand(button.onMouseEnter)
|
|
69
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Matches the floating toolbar's own buttons
|
|
70
|
+
,
|
|
71
|
+
onMouseLeave: () => runCommand(button.onMouseLeave)
|
|
72
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Matches the floating toolbar's own buttons
|
|
73
|
+
,
|
|
74
|
+
onFocus: () => runCommand(button.onFocus)
|
|
75
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Matches the floating toolbar's own buttons
|
|
76
|
+
,
|
|
77
|
+
onBlur: () => runCommand(button.onBlur),
|
|
78
|
+
onMount: button.onMount,
|
|
79
|
+
onUnmount: button.onUnmount,
|
|
80
|
+
selected: selected,
|
|
81
|
+
disabled: disabled,
|
|
82
|
+
tooltipContent: button.tooltipContent,
|
|
83
|
+
hideTooltipOnClick: button.hideTooltipOnClick,
|
|
84
|
+
hasNewContentOnTriggerClick: button.hasNewContentOnTriggerClick,
|
|
85
|
+
ariaHasPopup: triggerProps['aria-haspopup'],
|
|
86
|
+
areaControls: triggerProps['aria-controls'],
|
|
87
|
+
tabIndex: button.tabIndex,
|
|
88
|
+
isRadioButton: button.isRadioButton,
|
|
89
|
+
pulse: button.pulse,
|
|
90
|
+
testId: button.testId,
|
|
91
|
+
interactionName: button.interactionName,
|
|
92
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled
|
|
93
|
+
}, showTitle && title);
|
|
94
|
+
}, [areAnyNewToolbarFlagsEnabled, button, runCommand]);
|
|
95
|
+
return /*#__PURE__*/React.createElement(CreditCheckedPopup, {
|
|
96
|
+
creditCheck: creditCheck,
|
|
97
|
+
getAICreditStatus: getAICreditStatus,
|
|
98
|
+
onAllowed: runAction,
|
|
99
|
+
placement: "bottom-start",
|
|
100
|
+
renderTrigger: renderTrigger
|
|
101
|
+
});
|
|
102
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* CreditCheckedPopup.tsx generated by @compiled/babel-plugin v3.0.
|
|
1
|
+
/* CreditCheckedPopup.tsx generated by @compiled/babel-plugin v3.0.4 */
|
|
2
2
|
import "./CreditCheckedPopup.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React, { useCallback, useEffect, useId, useRef, useState } from 'react';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CreditCheckedFloatingToolbarButton } from './CreditCheckedFloatingToolbarButton';
|
|
3
|
+
|
|
4
|
+
/** Wraps a floating toolbar button so it is credit checked, keeping its own appearance and handlers. */
|
|
5
|
+
export const getCreditCheckedFloatingToolbarItem = ({
|
|
6
|
+
areAnyNewToolbarFlagsEnabled,
|
|
7
|
+
button,
|
|
8
|
+
creditCheck,
|
|
9
|
+
getAICreditStatus
|
|
10
|
+
}) => ({
|
|
11
|
+
type: 'custom',
|
|
12
|
+
fallback: [],
|
|
13
|
+
render: (view, idx) => /*#__PURE__*/React.createElement(CreditCheckedFloatingToolbarButton, {
|
|
14
|
+
key: idx,
|
|
15
|
+
areAnyNewToolbarFlagsEnabled: areAnyNewToolbarFlagsEnabled,
|
|
16
|
+
button: button,
|
|
17
|
+
creditCheck: creditCheck,
|
|
18
|
+
getAICreditStatus: getAICreditStatus,
|
|
19
|
+
view: view
|
|
20
|
+
})
|
|
21
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* ExtensionFloatingLabel.tsx generated by @compiled/babel-plugin v3.0.
|
|
1
|
+
/* ExtensionFloatingLabel.tsx generated by @compiled/babel-plugin v3.0.4 */
|
|
2
2
|
import "./ExtensionFloatingLabel.compiled.css";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* GeneratedContentReveal.tsx generated by @compiled/babel-plugin v3.0.
|
|
1
|
+
/* GeneratedContentReveal.tsx generated by @compiled/babel-plugin v3.0.4 */
|
|
2
2
|
import "./GeneratedContentReveal.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* UnknownMacroPlaceholder.tsx generated by @compiled/babel-plugin v3.0.
|
|
1
|
+
/* UnknownMacroPlaceholder.tsx generated by @compiled/babel-plugin v3.0.4 */
|
|
2
2
|
import "./UnknownMacroPlaceholder.compiled.css";
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
@@ -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.12.0";
|
|
17
17
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
18
18
|
// Remove URL as it has UGC
|
|
19
19
|
// Ignored via go/ees007
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* CompactQuickInsertMenuItem.tsx generated by @compiled/babel-plugin v3.0.
|
|
1
|
+
/* CompactQuickInsertMenuItem.tsx generated by @compiled/babel-plugin v3.0.4 */
|
|
2
2
|
import "./CompactQuickInsertMenuItem.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React, { useId, useMemo, useState } from 'react';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* ElementBrowserQuickInsertMenuItem.tsx generated by @compiled/babel-plugin v3.0.
|
|
1
|
+
/* ElementBrowserQuickInsertMenuItem.tsx generated by @compiled/babel-plugin v3.0.4 */
|
|
2
2
|
import "./ElementBrowserQuickInsertMenuItem.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React, { useId, useMemo } from 'react';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* QuickInsertHoverPreview.tsx generated by @compiled/babel-plugin v3.0.
|
|
1
|
+
/* QuickInsertHoverPreview.tsx generated by @compiled/babel-plugin v3.0.4 */
|
|
2
2
|
import "./QuickInsertHoverPreview.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React, { useLayoutEffect, useState } from 'react';
|