@atlaskit/editor-common 134.12.0 → 134.14.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 +34 -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.compiled.css +1 -0
- package/dist/cjs/quick-insert/QuickInsertPreviewContent.js +9 -6
- package/dist/cjs/quick-insert/QuickInsertShortcut.js +1 -1
- package/dist/cjs/quick-insert/SkillTag.js +1 -1
- package/dist/cjs/quick-insert/messages.js +30 -0
- 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.compiled.css +1 -0
- package/dist/es2019/quick-insert/QuickInsertPreviewContent.js +9 -6
- package/dist/es2019/quick-insert/QuickInsertShortcut.js +1 -1
- package/dist/es2019/quick-insert/SkillTag.js +1 -1
- package/dist/es2019/quick-insert/messages.js +30 -0
- 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.compiled.css +1 -0
- package/dist/esm/quick-insert/QuickInsertPreviewContent.js +9 -6
- package/dist/esm/quick-insert/QuickInsertShortcut.js +1 -1
- package/dist/esm/quick-insert/SkillTag.js +1 -1
- package/dist/esm/quick-insert/messages.js +30 -0
- 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/quick-insert/messages.d.ts +1 -1
- package/dist/types/quick-insert/preview.d.ts +6 -0
- package/dist/types/ui/FloatingToolbar/Button.d.ts +1 -0
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 134.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`1754902b31de6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1754902b31de6) -
|
|
8
|
+
Element Browser (platform_editor_slash_command experiment): Quick Insert preview images accept an
|
|
9
|
+
optional `objectFit` (`contain` by default, or `cover` to crop the image to fill its area). Item
|
|
10
|
+
titles in Element Browser tiles and slash-menu previews use `color.text`. Adds Element Browser
|
|
11
|
+
messages for the dialog title, search, category and result labels.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
17
|
+
## 134.13.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- [`47ddac78e97b7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/47ddac78e97b7) -
|
|
22
|
+
Add an optional `id` prop to the floating toolbar `Button`, and the
|
|
23
|
+
`@atlaskit/editor-common/credit-guard/floating-toolbar-button`
|
|
24
|
+
(`CreditCheckedFloatingToolbarButton`) and
|
|
25
|
+
`@atlaskit/editor-common/credit-guard/floating-toolbar-item`
|
|
26
|
+
(`getCreditCheckedFloatingToolbarItem`) entry points, which wrap a floating toolbar button so it
|
|
27
|
+
checks `getAICreditStatus` before running and anchors the product's credits popup to itself when
|
|
28
|
+
credits are blocked.
|
|
29
|
+
- [`3d2733c4e7948`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3d2733c4e7948) -
|
|
30
|
+
Update i18n NPM package versions for editor,editor-extensions,activity-platform,media,elements
|
|
31
|
+
(Group 3)
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependencies
|
|
36
|
+
|
|
3
37
|
## 134.12.0
|
|
4
38
|
|
|
5
39
|
### 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.14.0";
|
|
31
31
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
32
32
|
// Remove URL as it has UGC
|
|
33
33
|
// Ignored via go/ees007
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
._4t3i1osq{height:100%}
|
|
28
28
|
._4t3i68cl{height:90pt}
|
|
29
29
|
._4t3i7vkz{height:1pc}
|
|
30
|
+
._5ral1dfr{object-fit:cover}
|
|
30
31
|
._5ral1f51{object-fit:contain}
|
|
31
32
|
._6rthu2gc{margin-block-end:var(--ds-space-100,8px)}
|
|
32
33
|
._bfhkhfxm{background-color:var(--ds-surface-sunken,#f8f8f8)}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* QuickInsertPreviewContent.tsx generated by @compiled/babel-plugin v3.0.
|
|
1
|
+
/* QuickInsertPreviewContent.tsx generated by @compiled/babel-plugin v3.0.4 */
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -28,13 +28,14 @@ var layoutStyles = {
|
|
|
28
28
|
var styles = {
|
|
29
29
|
root: "_1e0c1txw _2lx21bp4 _16jlkb7n _1ul9idpf",
|
|
30
30
|
content: "_zulpu2gc _1e0c1txw _2lx21bp4 _16jlkb7n",
|
|
31
|
-
title: "_11c81qyo _16jlidpf _1o9zkb7n _i0dl1wug
|
|
31
|
+
title: "_11c81qyo _16jlidpf _1o9zkb7n _i0dl1wug _syazi7uo _1ul9idpf _1i4qfg65",
|
|
32
32
|
clampedTitle: "_1reo15vq _18m915vq _1e0ccj1k _sudp1e54 _1yyjcs5v",
|
|
33
33
|
description: "_11c8fhey _1reo15vq _18m915vq _syazi7uo _1e0ccj1k _1i4qfg65 _sudp1e54 _1yyjegat",
|
|
34
34
|
unclampedDescription: "_11c8fhey _syazi7uo _1i4qfg65",
|
|
35
35
|
disabledText: "_syaz1gmx",
|
|
36
36
|
imageArea: "_2rko12b0 _1reo15vq _18m915vq _bfhkhfxm _4t3i68cl _6rthu2gc _1bsb1osq",
|
|
37
37
|
image: "_1e0c1ule _4t3i1osq _5ral1f51 _1bsb1osq",
|
|
38
|
+
imageCover: "_5ral1dfr",
|
|
38
39
|
imageHidden: "_3um015vq",
|
|
39
40
|
attribution: "_zulp1b66 _4cvr1h6o _syazazsu _1e0c1txw _1pfh1wug _1i4qfg65",
|
|
40
41
|
compactAttribution: "_11c8wadc",
|
|
@@ -46,7 +47,7 @@ var styles = {
|
|
|
46
47
|
* Element Browser tiles. It fills its container; callers own its width and accessible name.
|
|
47
48
|
*/
|
|
48
49
|
var QuickInsertPreviewContent = exports.QuickInsertPreviewContent = function QuickInsertPreviewContent(_ref) {
|
|
49
|
-
var _preview$attribution, _preview$attribution2;
|
|
50
|
+
var _preview$attribution, _preview$attribution2, _preview$image;
|
|
50
51
|
var description = _ref.description,
|
|
51
52
|
icon = _ref.icon,
|
|
52
53
|
id = _ref.id,
|
|
@@ -83,7 +84,8 @@ var QuickInsertPreviewContent = exports.QuickInsertPreviewContent = function Qui
|
|
|
83
84
|
className: (0, _runtime.ax)([styles.root])
|
|
84
85
|
}, imageUrl && /*#__PURE__*/_react.default.createElement(PreviewImage, {
|
|
85
86
|
key: imageUrl,
|
|
86
|
-
imageUrl: imageUrl
|
|
87
|
+
imageUrl: imageUrl,
|
|
88
|
+
objectFit: (_preview$image = preview.image) === null || _preview$image === void 0 ? void 0 : _preview$image.objectFit
|
|
87
89
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
88
90
|
className: (0, _runtime.ax)([styles.content])
|
|
89
91
|
}, shortcut ? /*#__PURE__*/_react.default.createElement(_inline.Inline, {
|
|
@@ -110,7 +112,8 @@ var QuickInsertPreviewContent = exports.QuickInsertPreviewContent = function Qui
|
|
|
110
112
|
}))))));
|
|
111
113
|
};
|
|
112
114
|
var PreviewImage = function PreviewImage(_ref2) {
|
|
113
|
-
var imageUrl = _ref2.imageUrl
|
|
115
|
+
var imageUrl = _ref2.imageUrl,
|
|
116
|
+
objectFit = _ref2.objectFit;
|
|
114
117
|
var _useState = (0, _react.useState)(false),
|
|
115
118
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
116
119
|
hasFailed = _useState2[0],
|
|
@@ -137,6 +140,6 @@ var PreviewImage = function PreviewImage(_ref2) {
|
|
|
137
140
|
onError: function onError() {
|
|
138
141
|
return setHasFailed(true);
|
|
139
142
|
},
|
|
140
|
-
className: (0, _runtime.ax)([styles.image, !hasLoaded && styles.imageHidden])
|
|
143
|
+
className: (0, _runtime.ax)([styles.image, objectFit === 'cover' && styles.imageCover, !hasLoaded && styles.imageHidden])
|
|
141
144
|
}));
|
|
142
145
|
};
|
|
@@ -210,5 +210,35 @@ var messages = exports.messages = (0, _reactIntl.defineMessages)({
|
|
|
210
210
|
id: 'editor-common.quick-insert.previewAttributionMicrosoft.ai-non-final',
|
|
211
211
|
defaultMessage: 'Microsoft',
|
|
212
212
|
description: 'Microsoft company name shown as the creator in a slash-command preview attribution.'
|
|
213
|
+
},
|
|
214
|
+
elementBrowserAllElements: {
|
|
215
|
+
id: 'editor.quick-insert.all-elements',
|
|
216
|
+
defaultMessage: 'All elements',
|
|
217
|
+
description: 'Heading above the remaining elements in the element browser All category, shown below the Recommended elements.'
|
|
218
|
+
},
|
|
219
|
+
elementBrowserCategoriesLabel: {
|
|
220
|
+
id: 'editor.quick-insert.categories-label',
|
|
221
|
+
defaultMessage: 'Element categories',
|
|
222
|
+
description: 'Accessible label for the group of category buttons in the element browser sidebar, read by screen readers.'
|
|
223
|
+
},
|
|
224
|
+
elementBrowserResultsAvailable: {
|
|
225
|
+
id: 'editor.quick-insert.results-available',
|
|
226
|
+
defaultMessage: '{count, plural, one {# result available} other {# results available}}',
|
|
227
|
+
description: 'Shown in the element browser footer. Tells the user how many elements match the current search and category.'
|
|
228
|
+
},
|
|
229
|
+
elementBrowserResultsLabel: {
|
|
230
|
+
id: 'editor.quick-insert.results-label',
|
|
231
|
+
defaultMessage: 'Element results',
|
|
232
|
+
description: 'Accessible label for the list of elements in the element browser, read by screen readers.'
|
|
233
|
+
},
|
|
234
|
+
elementBrowserSearch: {
|
|
235
|
+
id: 'editor.quick-insert.search',
|
|
236
|
+
defaultMessage: 'Search elements',
|
|
237
|
+
description: 'Accessible label for the search field at the top of the element browser, used to filter the elements that can be inserted.'
|
|
238
|
+
},
|
|
239
|
+
elementBrowserTitle: {
|
|
240
|
+
id: 'editor.quick-insert.title',
|
|
241
|
+
defaultMessage: 'Insert elements',
|
|
242
|
+
description: 'Title of the element browser dialog, where users browse and insert elements such as tables, panels and macros.'
|
|
213
243
|
}
|
|
214
244
|
});
|
|
@@ -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.14.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
|
+
});
|