@atlaskit/editor-core 239.0.2 → 240.0.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/dist/cjs/composable-editor/hooks/useMemoEditorProps.js +1 -3
- package/dist/cjs/ui/Appearance/FullPage/FullPageContentArea.js +3 -9
- package/dist/cjs/ui/EditorContentContainer/EditorContentContainer-compiled.compiled.css +1 -0
- package/dist/cjs/ui/EditorContentContainer/EditorContentContainer-compiled.js +2 -1
- package/dist/cjs/ui/Toolbar/Toolbar.js +2 -2
- package/dist/cjs/ui/quick-insert/ExtensionQuickInsertMenuItem.js +22 -2
- package/dist/cjs/ui/quick-insert/app-vendor/AppVendorRequestError.js +31 -0
- package/dist/cjs/ui/quick-insert/app-vendor/appVendorCache.js +14 -0
- package/dist/cjs/ui/quick-insert/app-vendor/fetchAppVendors.js +112 -0
- package/dist/cjs/ui/quick-insert/app-vendor/fetchAppVendorsInBatches.js +101 -0
- package/dist/cjs/ui/quick-insert/app-vendor/getAppVendorLookup.js +33 -0
- package/dist/cjs/ui/quick-insert/app-vendor/prefetchAppVendors.js +129 -0
- package/dist/cjs/ui/quick-insert/app-vendor/useAppVendorName.js +26 -0
- package/dist/cjs/ui/quick-insert/getExtensionQuickInsertComponents.js +13 -2
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/composable-editor/hooks/useMemoEditorProps.js +1 -3
- package/dist/es2019/ui/Appearance/FullPage/FullPageContentArea.js +3 -9
- package/dist/es2019/ui/EditorContentContainer/EditorContentContainer-compiled.compiled.css +1 -0
- package/dist/es2019/ui/EditorContentContainer/EditorContentContainer-compiled.js +2 -1
- package/dist/es2019/ui/Toolbar/Toolbar.js +1 -1
- package/dist/es2019/ui/quick-insert/ExtensionQuickInsertMenuItem.js +20 -3
- package/dist/es2019/ui/quick-insert/app-vendor/AppVendorRequestError.js +11 -0
- package/dist/es2019/ui/quick-insert/app-vendor/appVendorCache.js +8 -0
- package/dist/es2019/ui/quick-insert/app-vendor/fetchAppVendors.js +69 -0
- package/dist/es2019/ui/quick-insert/app-vendor/fetchAppVendorsInBatches.js +51 -0
- package/dist/es2019/ui/quick-insert/app-vendor/getAppVendorLookup.js +28 -0
- package/dist/es2019/ui/quick-insert/app-vendor/prefetchAppVendors.js +109 -0
- package/dist/es2019/ui/quick-insert/app-vendor/useAppVendorName.js +18 -0
- package/dist/es2019/ui/quick-insert/getExtensionQuickInsertComponents.js +17 -10
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/composable-editor/hooks/useMemoEditorProps.js +1 -3
- package/dist/esm/ui/Appearance/FullPage/FullPageContentArea.js +3 -9
- package/dist/esm/ui/EditorContentContainer/EditorContentContainer-compiled.compiled.css +1 -0
- package/dist/esm/ui/EditorContentContainer/EditorContentContainer-compiled.js +2 -1
- package/dist/esm/ui/Toolbar/Toolbar.js +1 -1
- package/dist/esm/ui/quick-insert/ExtensionQuickInsertMenuItem.js +22 -3
- package/dist/esm/ui/quick-insert/app-vendor/AppVendorRequestError.js +24 -0
- package/dist/esm/ui/quick-insert/app-vendor/appVendorCache.js +8 -0
- package/dist/esm/ui/quick-insert/app-vendor/fetchAppVendors.js +105 -0
- package/dist/esm/ui/quick-insert/app-vendor/fetchAppVendorsInBatches.js +94 -0
- package/dist/esm/ui/quick-insert/app-vendor/getAppVendorLookup.js +27 -0
- package/dist/esm/ui/quick-insert/app-vendor/prefetchAppVendors.js +119 -0
- package/dist/esm/ui/quick-insert/app-vendor/useAppVendorName.js +20 -0
- package/dist/esm/ui/quick-insert/getExtensionQuickInsertComponents.js +13 -2
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/editor-appearances/ChromelessEditor.d.ts +1 -1
- package/dist/types/editor-appearances/CommentEditor.d.ts +1 -1
- package/dist/types/editor-appearances/FullPageEditor.d.ts +1 -1
- package/dist/types/editor-appearances/FullWidthEditor.d.ts +1 -1
- package/dist/types/types/editor-props.d.ts +1 -13
- package/dist/types/ui/quick-insert/ExtensionQuickInsertMenuItem.d.ts +3 -1
- package/dist/types/ui/quick-insert/app-vendor/AppVendorRequestError.d.ts +5 -0
- package/dist/types/ui/quick-insert/app-vendor/appVendorCache.d.ts +17 -0
- package/dist/types/ui/quick-insert/app-vendor/fetchAppVendors.d.ts +8 -0
- package/dist/types/ui/quick-insert/app-vendor/fetchAppVendorsInBatches.d.ts +23 -0
- package/dist/types/ui/quick-insert/app-vendor/getAppVendorLookup.d.ts +11 -0
- package/dist/types/ui/quick-insert/app-vendor/prefetchAppVendors.d.ts +7 -0
- package/dist/types/ui/quick-insert/app-vendor/useAppVendorName.d.ts +2 -0
- package/package.json +14 -14
|
@@ -0,0 +1,129 @@
|
|
|
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.prefetchAppVendors = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _error = require("@atlaskit/editor-common/monitoring/error");
|
|
11
|
+
var _appVendorCache = require("./appVendorCache");
|
|
12
|
+
var _getAppVendorLookup = require("./getAppVendorLookup");
|
|
13
|
+
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); }
|
|
14
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
|
+
/** Failed lookups are retried on later menu opens, up to this many attempts per page load. */
|
|
17
|
+
var MAX_ATTEMPTS = 3;
|
|
18
|
+
var LOG_LOCATION = 'editor-core/quick-insert/prefetchAppVendors';
|
|
19
|
+
var entries = _appVendorCache.appVendorCache.entries,
|
|
20
|
+
listeners = _appVendorCache.appVendorCache.listeners;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Set once any batch fails with 401, 403, or 429. Those mean the session cannot read Marketplace
|
|
24
|
+
* data or the gateway is throttling, which applies to every editor on the page, so all further
|
|
25
|
+
* lookups stop until the page reloads.
|
|
26
|
+
*/
|
|
27
|
+
var isBlocked = false;
|
|
28
|
+
var shouldFetch = function shouldFetch(entry) {
|
|
29
|
+
return !entry || entry.status === 'failed' && entry.attempts < MAX_ATTEMPTS;
|
|
30
|
+
};
|
|
31
|
+
var getAttempts = function getAttempts(entry) {
|
|
32
|
+
return (entry === null || entry === void 0 ? void 0 : entry.status) === 'failed' ? entry.attempts : 0;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// A throwing subscriber must not stop the others or abort the batch that is being settled.
|
|
36
|
+
var notify = function notify() {
|
|
37
|
+
return listeners.forEach(function (listener) {
|
|
38
|
+
try {
|
|
39
|
+
listener();
|
|
40
|
+
} catch (error) {
|
|
41
|
+
(0, _error.logException)(error, {
|
|
42
|
+
location: LOG_LOCATION
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
var markFailed = function markFailed(_ref) {
|
|
48
|
+
var attempts = _ref.attempts,
|
|
49
|
+
id = _ref.id;
|
|
50
|
+
return entries.set(id, {
|
|
51
|
+
attempts: attempts,
|
|
52
|
+
status: 'failed'
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
var settleBatch = function settleBatch(batch, result) {
|
|
56
|
+
if (result.status !== 'fulfilled') {
|
|
57
|
+
if (result.status === 'rejected') {
|
|
58
|
+
isBlocked || (isBlocked = result.isBlocking);
|
|
59
|
+
(0, _error.logException)(result.error, {
|
|
60
|
+
location: LOG_LOCATION
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
batch.forEach(markFailed);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Lookups missing from the result errored individually and stay retryable.
|
|
68
|
+
batch.forEach(function (lookup) {
|
|
69
|
+
var name = result.names.get(lookup.id);
|
|
70
|
+
if (name === undefined) {
|
|
71
|
+
markFailed(lookup);
|
|
72
|
+
} else {
|
|
73
|
+
entries.set(lookup.id, {
|
|
74
|
+
name: name,
|
|
75
|
+
status: 'resolved'
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
notify();
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Starts fetching Marketplace partner names for every ecosystem app among `items`.
|
|
84
|
+
* Safe to call repeatedly: cached, in-flight, and exhausted lookups are skipped. The fetching code
|
|
85
|
+
* is loaded only once a lookup is queued.
|
|
86
|
+
*/
|
|
87
|
+
var prefetchAppVendors = exports.prefetchAppVendors = function prefetchAppVendors(items) {
|
|
88
|
+
if (isBlocked) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
var lookups = [];
|
|
92
|
+
items.forEach(function (item) {
|
|
93
|
+
var lookup = (0, _getAppVendorLookup.getAppVendorLookup)(item);
|
|
94
|
+
var entry = lookup && entries.get(lookup.id);
|
|
95
|
+
if (lookup && shouldFetch(entry)) {
|
|
96
|
+
lookups.push(_objectSpread(_objectSpread({}, lookup), {}, {
|
|
97
|
+
attempts: getAttempts(entry) + 1
|
|
98
|
+
}));
|
|
99
|
+
entries.set(lookup.id, {
|
|
100
|
+
status: 'pending'
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
if (lookups.length === 0) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
void Promise.resolve().then(function () {
|
|
108
|
+
return _interopRequireWildcard(require( /* webpackChunkName: "@atlaskit-internal_editor-core-quick-insert-app-vendor" */'./fetchAppVendorsInBatches'));
|
|
109
|
+
}).then(function (_ref2) {
|
|
110
|
+
var fetchAppVendorsInBatches = _ref2.fetchAppVendorsInBatches;
|
|
111
|
+
return fetchAppVendorsInBatches(lookups, {
|
|
112
|
+
onBatch: settleBatch,
|
|
113
|
+
shouldContinue: function shouldContinue() {
|
|
114
|
+
return !isBlocked;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}, function (error) {
|
|
118
|
+
// The chunk failed to load; nothing was requested, so every queued lookup can retry.
|
|
119
|
+
lookups.forEach(markFailed);
|
|
120
|
+
(0, _error.logException)(error, {
|
|
121
|
+
location: LOG_LOCATION
|
|
122
|
+
});
|
|
123
|
+
}).catch(function (error) {
|
|
124
|
+
// Fetch errors are reported per batch; this only catches an unexpected throw while settling.
|
|
125
|
+
(0, _error.logException)(error, {
|
|
126
|
+
location: LOG_LOCATION
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useAppVendorName = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _appVendorCache = require("./appVendorCache");
|
|
9
|
+
var subscribe = function subscribe(listener) {
|
|
10
|
+
_appVendorCache.appVendorCache.listeners.add(listener);
|
|
11
|
+
return function () {
|
|
12
|
+
_appVendorCache.appVendorCache.listeners.delete(listener);
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
var getServerSnapshot = function getServerSnapshot() {
|
|
16
|
+
return undefined;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** Returns the partner name, `null` for unlisted apps, or `undefined` while unknown. */
|
|
20
|
+
var useAppVendorName = exports.useAppVendorName = function useAppVendorName(id) {
|
|
21
|
+
var getSnapshot = function getSnapshot() {
|
|
22
|
+
var entry = id ? _appVendorCache.appVendorCache.entries.get(id) : undefined;
|
|
23
|
+
return (entry === null || entry === void 0 ? void 0 : entry.status) === 'resolved' ? entry.name : undefined;
|
|
24
|
+
};
|
|
25
|
+
return (0, _react.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
|
|
26
|
+
};
|
|
@@ -13,6 +13,7 @@ var _createQuickInsertMatcher = require("@atlaskit/editor-common/quick-insert/cr
|
|
|
13
13
|
var _getMenuItemParents = require("@atlaskit/editor-common/quick-insert/get-menu-item-parents");
|
|
14
14
|
var _keys = require("@atlaskit/editor-common/quick-insert/keys");
|
|
15
15
|
var _rank = require("@atlaskit/editor-common/quick-insert/rank");
|
|
16
|
+
var _prefetchAppVendors = require("./app-vendor/prefetchAppVendors");
|
|
16
17
|
var _ExtensionQuickInsertMenuItem = require("./ExtensionQuickInsertMenuItem");
|
|
17
18
|
var _QuickInsertSkillMenuItem = require("./QuickInsertSkillMenuItem");
|
|
18
19
|
var structureExtensionItemKeyRanks = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({
|
|
@@ -89,6 +90,10 @@ var getExtensionQuickInsertComponents = exports.getExtensionQuickInsertComponent
|
|
|
89
90
|
editorActions = _ref4.editorActions,
|
|
90
91
|
items = _ref4.items;
|
|
91
92
|
var getExtensionItemRank = createExtensionItemRanker(items);
|
|
93
|
+
// Every row prefetches all items so the first row to mount fetches vendors in one batch.
|
|
94
|
+
var prefetchVendors = function prefetchVendors() {
|
|
95
|
+
return (0, _prefetchAppVendors.prefetchAppVendors)(items);
|
|
96
|
+
};
|
|
92
97
|
return items.map(function (item, index) {
|
|
93
98
|
var structureRank = getStructureExtensionItemRank(item);
|
|
94
99
|
var isStructureItem = structureRank !== undefined;
|
|
@@ -123,13 +128,19 @@ var getExtensionQuickInsertComponents = exports.getExtensionQuickInsertComponent
|
|
|
123
128
|
};
|
|
124
129
|
}),
|
|
125
130
|
component: function component(props) {
|
|
126
|
-
|
|
127
|
-
return /*#__PURE__*/_react.default.createElement(Component, {
|
|
131
|
+
return item.extensionType === 'com.atlassian.rovo.skill' ? /*#__PURE__*/_react.default.createElement(_QuickInsertSkillMenuItem.QuickInsertSkillMenuItem, {
|
|
128
132
|
apiRef: apiRef,
|
|
129
133
|
createAnalyticsEvent: createAnalyticsEvent,
|
|
130
134
|
editorActions: editorActions,
|
|
131
135
|
item: item,
|
|
132
136
|
onInsert: props.onInsert
|
|
137
|
+
}) : /*#__PURE__*/_react.default.createElement(_ExtensionQuickInsertMenuItem.ExtensionQuickInsertMenuItem, {
|
|
138
|
+
apiRef: apiRef,
|
|
139
|
+
createAnalyticsEvent: createAnalyticsEvent,
|
|
140
|
+
editorActions: editorActions,
|
|
141
|
+
item: item,
|
|
142
|
+
onInsert: props.onInsert,
|
|
143
|
+
prefetchVendors: prefetchVendors
|
|
133
144
|
});
|
|
134
145
|
}
|
|
135
146
|
};
|
|
@@ -6,4 +6,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.version = exports.name = void 0;
|
|
7
7
|
var name = exports.name = "@atlaskit/editor-core";
|
|
8
8
|
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
9
|
-
var version = exports.version = "239.0.
|
|
9
|
+
var version = exports.version = "239.0.3";
|
|
@@ -41,8 +41,6 @@ export const useMemoEditorProps = passedProps => {
|
|
|
41
41
|
media: passedProps.media,
|
|
42
42
|
collabEdit: passedProps.collabEdit,
|
|
43
43
|
primaryToolbarComponents: passedProps.primaryToolbarComponents,
|
|
44
|
-
performanceTracking: passedProps.performanceTracking,
|
|
45
|
-
inputSamplingLimit: passedProps.inputSamplingLimit,
|
|
46
44
|
allowUndoRedoButtons: passedProps.allowUndoRedoButtons,
|
|
47
45
|
linking: passedProps.linking,
|
|
48
46
|
activityProvider: passedProps.activityProvider,
|
|
@@ -114,7 +112,7 @@ export const useMemoEditorProps = passedProps => {
|
|
|
114
112
|
...allProps
|
|
115
113
|
};
|
|
116
114
|
return nextProps;
|
|
117
|
-
}, [passedProps.preset, passedProps.appearance, passedProps.contentMode, passedProps.contentComponents, passedProps.primaryToolbarIconBefore, passedProps.secondaryToolbarComponents, passedProps.persistScrollGutter, passedProps.quickInsert, passedProps.shouldFocus, passedProps.disabled, passedProps.contextPanel, passedProps.errorReporterHandler, passedProps.contentTransformerProvider, passedProps.maxHeight, passedProps.minHeight, passedProps.placeholder, passedProps.placeholderBracketHint, passedProps.
|
|
115
|
+
}, [passedProps.preset, passedProps.appearance, passedProps.contentMode, passedProps.contentComponents, passedProps.primaryToolbarIconBefore, passedProps.secondaryToolbarComponents, passedProps.persistScrollGutter, passedProps.quickInsert, passedProps.shouldFocus, passedProps.disabled, passedProps.contextPanel, passedProps.errorReporterHandler, passedProps.contentTransformerProvider, passedProps.maxHeight, passedProps.minHeight, passedProps.placeholder, passedProps.placeholderBracketHint, passedProps.defaultValue, passedProps.assistiveLabel, passedProps.assistiveDescribedBy, passedProps.popupsMountPoint, passedProps.popupsBoundariesElement, passedProps.popupsScrollableElement, passedProps.editorActions, passedProps.onEditorReady, passedProps.onDestroy, passedProps.onChange, passedProps.onCancel, passedProps.onSSRMeasure, passedProps.extensionProviders, passedProps.UNSAFE_useAnalyticsContext, passedProps.useStickyToolbar, passedProps.isEditorModernisationEnabled, passedProps.featureFlags, passedProps.onSave, passedProps.sanitizePrivateContent, passedProps.media, passedProps.collabEdit, passedProps.primaryToolbarComponents, passedProps.allowUndoRedoButtons, passedProps.linking, passedProps.activityProvider, passedProps.searchProvider, passedProps.annotationProviders, passedProps.collabEditProvider, passedProps.presenceProvider, passedProps.emojiProvider, passedProps.taskDecisionProvider, passedProps.legacyImageUploadProvider, passedProps.mentionProvider, passedProps.autoformattingProvider, passedProps.macroProvider, passedProps.contextIdentifierProvider, passedProps.allowExpand, passedProps.allowNestedTasks, passedProps.allowBlockType, passedProps.allowTasksAndDecisions, passedProps.allowBreakout, passedProps.allowRule, passedProps.allowHelpDialog, passedProps.allowPanel, passedProps.allowExtension, passedProps.allowConfluenceInlineComment, passedProps.allowTemplatePlaceholders, passedProps.allowDate, passedProps.allowLayouts, passedProps.allowStatus, passedProps.allowTextAlignment, passedProps.allowIndentation, passedProps.showIndentationButtons, passedProps.allowFindReplace, passedProps.allowBorderMark, passedProps.allowFragmentMark, passedProps.autoScrollIntoView, passedProps.elementBrowser, passedProps.maxContentSize, passedProps.saveOnEnter, passedProps.feedbackInfo, passedProps.mention, passedProps.mentionInsertDisplayName, passedProps.uploadErrorHandler, passedProps.waitForMediaUpload, passedProps.extensionHandlers, passedProps.allowTextColor, passedProps.allowTables, passedProps.insertMenuItems, passedProps.UNSAFE_cards, passedProps.smartLinks, passedProps.allowAnalyticsGASV3, passedProps.codeBlock, passedProps.textFormatting, passedProps.__livePage, passedProps.AppearanceComponent, passedProps.skipValidation, passedProps.syncBlock, passedProps.syncedBlockProvider, passedProps.pasteWarningOptions, passedProps.UNSAFE_containLayout]);
|
|
118
116
|
return memodProps;
|
|
119
117
|
};
|
|
120
118
|
|
|
@@ -51,7 +51,7 @@ const compiledStyles = {
|
|
|
51
51
|
export const CONTENT_AREA_TEST_ID = 'ak-editor-fp-content-area';
|
|
52
52
|
const EDITOR_CONTAINER = 'ak-editor-container';
|
|
53
53
|
const Content = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
54
|
-
var _props$editorAPI, _props$editorAPI$base, _props$editorAPI$base2, _props$editorAPI$bloc, _props$editorAPI2, _props$editorAPI2$blo, _props$editorAPI2$blo2, _props$editorAPI2$blo3, _contentAreaRef$curre, _allowScrollGutter$gu
|
|
54
|
+
var _props$editorAPI, _props$editorAPI$base, _props$editorAPI$base2, _props$editorAPI$bloc, _props$editorAPI2, _props$editorAPI2$blo, _props$editorAPI2$blo2, _props$editorAPI2$blo3, _contentAreaRef$curre, _allowScrollGutter$gu;
|
|
55
55
|
const fullWidthMode = props.appearance === 'full-width';
|
|
56
56
|
const maxWidthMode = props.appearance === 'max';
|
|
57
57
|
const scrollContainerRef = useRef(null);
|
|
@@ -127,20 +127,14 @@ const Content = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
127
127
|
containerElement: scrollContainerRef.current,
|
|
128
128
|
dispatchAnalyticsEvent: props.dispatchAnalyticsEvent,
|
|
129
129
|
wrapperElement: props.wrapperElement
|
|
130
|
-
}), props.editorDOMElement, !!props.customContentComponents && 'after' in props.customContentComponents ? contentComponentClickWrapper(props.customContentComponents.after) : null, allowScrollGutter &&
|
|
130
|
+
}), props.editorDOMElement, !!props.customContentComponents && 'after' in props.customContentComponents ? contentComponentClickWrapper(props.customContentComponents.after) : null, allowScrollGutter && /*#__PURE__*/React.createElement("div", {
|
|
131
131
|
id: "editor-scroll-gutter",
|
|
132
132
|
style: {
|
|
133
133
|
paddingBottom: `${(_allowScrollGutter$gu = allowScrollGutter.gutterSize) !== null && _allowScrollGutter$gu !== void 0 ? _allowScrollGutter$gu : '120'}px`
|
|
134
134
|
},
|
|
135
135
|
"data-vc": "scroll-gutter",
|
|
136
136
|
"data-editor-scroll-gutter": "true"
|
|
137
|
-
})
|
|
138
|
-
id: "editor-scroll-gutter",
|
|
139
|
-
style: {
|
|
140
|
-
paddingBottom: `${(_allowScrollGutter$gu2 = allowScrollGutter.gutterSize) !== null && _allowScrollGutter$gu2 !== void 0 ? _allowScrollGutter$gu2 : '120'}px`
|
|
141
|
-
},
|
|
142
|
-
"data-vc": "scroll-gutter"
|
|
143
|
-
}))))));
|
|
137
|
+
})))));
|
|
144
138
|
return /*#__PURE__*/React.createElement("div", {
|
|
145
139
|
"data-testid": CONTENT_AREA_TEST_ID,
|
|
146
140
|
ref: containerRef,
|
|
@@ -182,6 +182,7 @@
|
|
|
182
182
|
.cc-eie91o .show-diff-deleted-inline-node[data-prosemirror-node-name=status]{position:relative}.cc-eie91o .show-diff-deleted-inline-node[data-prosemirror-node-name=status]:after{content:"";position:absolute;top:50%;inset-inline-start:0;inset-inline-end:0;border-top:var(--show-diff-deleted-inline-node-strike,var(--ds-border-width,1px) solid var(--ds-text-subtlest,#6b6e76));pointer-events:none}.cc-eie91o .show-diff-deleted-inline-node[data-prosemirror-node-name=emoji]{position:relative}.cc-eie91o .show-diff-deleted-inline-node[data-prosemirror-node-name=emoji]:after{content:"";position:absolute;top:50%;inset-inline-start:0;inset-inline-end:0;border-top:var(--show-diff-deleted-inline-node-strike,var(--ds-border-width,1px) solid var(--ds-text-subtlest,#6b6e76));pointer-events:none}
|
|
183
183
|
.cc-3nf4b .show-diff-atomic-inline-changed-date{outline-color:currentColor;outline-style:none;outline-width:medium}.cc-3nf4b .show-diff-atomic-inline-changed-date .date-lozenger-container>span{box-shadow:0 0 0 2px var(--show-diff-atomic-inline-changed-border-color,var(--ds-border-accent-purple,#af59e1))}.cc-3nf4b .show-diff-atomic-inline-changed-emoji :is(.emoji-common-emoji-sprite,.emoji-common-emoji-image,.emoji-common-emoji-unicode){outline-color:currentColor;outline-style:none;outline-width:medium;box-shadow:0 0 0 2px var(--show-diff-atomic-inline-changed-border-color,var(--ds-border-accent-purple,#af59e1))}
|
|
184
184
|
.cc-1szti83 [data-prosemirror-node-name=status] .lozenge-wrapper{padding-block-start:var(--ds-space-025,2px);padding-block-end:var(--ds-space-025,2px);padding-inline-start:var(--ds-space-050,4px);padding-inline-end:var(--ds-space-050,4px);align-items:center;border-radius:var(--ds-radius-small,4px);height:1.25rem;border:solid var(--ds-border-width,1px) transparent}.cc-1szti83 [data-prosemirror-node-name=status] .lozenge-text{text-transform:none;font:var(--ds-font-body-small,normal 400 9pt/1pc "Atlassian Sans",ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Ubuntu,"Helvetica Neue",sans-serif)}.cc-1szti83 [data-prosemirror-node-name=status]>[data-color=neutral]>.lozenge-wrapper{background-color:var(--ds-background-neutral,#0515240f);border-color:var(--ds-border,#0b120e24)}.cc-1szti83 [data-prosemirror-node-name=status]>[data-color=neutral] .lozenge-text{color:var(--ds-text,#292a2e)}.cc-1szti83 .statusView-content-wrap:not(.search-match-block).ak-editor-selected-node .status-lozenge-span>span{box-shadow:0 0 0 2px var(--ds-border-selected,#1868db)}.cc-1szti83 .danger .statusView-content-wrap:not(.search-match-block).ak-editor-selected-node .status-lozenge-span>span{box-shadow:0 0 0 2px var(--ds-border-danger,#e2483d)}
|
|
185
|
+
.cc-1wyoddi [data-prosemirror-node-name=status] .lozenge-text{text-box:trim-both cap alphabetic;overflow-x:clip;overflow-y:visible}
|
|
185
186
|
.cc-ba6gav [data-prosemirror-node-name=status]>[data-color=purple]>.lozenge-wrapper{background-color:var(--ds-background-discovery-subtler,#eed7fc);border-color:var(--ds-border-discovery-subtle,#d8a0f7)}.cc-ba6gav [data-prosemirror-node-name=status]>[data-color=purple] .lozenge-text{color:var(--ds-text-discovery-bolder,#48245d)}.cc-ba6gav [data-prosemirror-node-name=status]>[data-color=blue]>.lozenge-wrapper{background-color:var(--ds-background-information-subtler,#cfe1fd);border-color:var(--ds-border-information-subtle,#8fb8f6)}.cc-ba6gav [data-prosemirror-node-name=status]>[data-color=blue] .lozenge-text{color:var(--ds-text-information-bolder,#123263)}.cc-ba6gav [data-prosemirror-node-name=status]>[data-color=red]>.lozenge-wrapper{background-color:var(--ds-background-danger-subtler,#ffd5d2);border-color:var(--ds-border-danger-subtle,#fd9891)}.cc-ba6gav [data-prosemirror-node-name=status]>[data-color=red] .lozenge-text{color:var(--ds-text-danger-bolder,#5d1f1a)}.cc-ba6gav [data-prosemirror-node-name=status]>[data-color=yellow]>.lozenge-wrapper{background-color:var(--ds-background-warning-subtler,#fce4a6);border-color:var(--ds-border-warning-subtle,#fbc828)}.cc-ba6gav [data-prosemirror-node-name=status]>[data-color=yellow] .lozenge-text{color:var(--ds-text-warning-bolder,#693200)}.cc-ba6gav [data-prosemirror-node-name=status]>[data-color=green]>.lozenge-wrapper{background-color:var(--ds-background-success-subtler,#d3f1a7);border-color:var(--ds-border-success-subtle,#b3df72)}.cc-ba6gav [data-prosemirror-node-name=status]>[data-color=green] .lozenge-text{color:var(--ds-text-success-bolder,#37471f)}
|
|
186
187
|
.cc-1gvo00o [data-prosemirror-node-name=status]>[data-color=blue]>.lozenge-wrapper{background-color:var(--ds-background-accent-blue-subtler,#cfe1fd);border-color:var(--ds-border-accent-blue-subtle,#8fb8f6)}.cc-1gvo00o [data-prosemirror-node-name=status]>[data-color=blue] .lozenge-text{color:var(--ds-text-accent-blue-bolder,#123263)}.cc-1gvo00o [data-prosemirror-node-name=status]>[data-color=purple]>.lozenge-wrapper{background-color:var(--ds-background-accent-purple-subtler,#eed7fc);border-color:var(--ds-border-accent-purple-subtle,#d8a0f7)}.cc-1gvo00o [data-prosemirror-node-name=status]>[data-color=purple] .lozenge-text{color:var(--ds-text-accent-purple-bolder,#48245d)}.cc-1gvo00o [data-prosemirror-node-name=status]>[data-color=red]>.lozenge-wrapper{background-color:var(--ds-background-accent-red-subtler,#ffd5d2);border-color:var(--ds-border-accent-red-subtle,#fd9891)}.cc-1gvo00o [data-prosemirror-node-name=status]>[data-color=red] .lozenge-text{color:var(--ds-text-accent-red-bolder,#5d1f1a)}.cc-1gvo00o [data-prosemirror-node-name=status]>[data-color=yellow]>.lozenge-wrapper{background-color:var(--ds-background-accent-orange-subtler,#fce4a6);border-color:var(--ds-border-accent-orange-subtle,#fbc828)}.cc-1gvo00o [data-prosemirror-node-name=status]>[data-color=yellow] .lozenge-text{color:var(--ds-text-accent-orange-bolder,#693200)}.cc-1gvo00o [data-prosemirror-node-name=status]>[data-color=green]>.lozenge-wrapper{background-color:var(--ds-background-accent-lime-subtler,#d3f1a7);border-color:var(--ds-border-accent-lime-subtle,#b3df72)}.cc-1gvo00o [data-prosemirror-node-name=status]>[data-color=green] .lozenge-text{color:var(--ds-text-accent-lime-bolder,#37471f)}
|
|
187
188
|
.cc-1ky6mbc [data-prosemirror-node-name=status]>[data-color="#B3F5FF"]>.lozenge-wrapper{background-color:var(--ds-background-accent-teal-subtler,#c6edfb);border-color:var(--ds-border-accent-teal-subtle,#9dd9ee)}.cc-1ky6mbc [data-prosemirror-node-name=status]>[data-color="#B3F5FF"] .lozenge-text{color:var(--ds-text-accent-teal-bolder,#164555)}.cc-1ky6mbc [data-prosemirror-node-name=status]>[data-color="#ABF5D1"]>.lozenge-wrapper{background-color:var(--ds-background-accent-green-subtler,#baf3db);border-color:var(--ds-border-accent-green-subtle,#7ee2b8)}.cc-1ky6mbc [data-prosemirror-node-name=status]>[data-color="#ABF5D1"] .lozenge-text{color:var(--ds-text-accent-green-bolder,#164b35)}.cc-1ky6mbc [data-prosemirror-node-name=status]>[data-color="#D3F1A7"]>.lozenge-wrapper{background-color:var(--ds-background-accent-lime-subtler,#d3f1a7);border-color:var(--ds-border-accent-lime-subtle,#b3df72)}.cc-1ky6mbc [data-prosemirror-node-name=status]>[data-color="#D3F1A7"] .lozenge-text{color:var(--ds-text-accent-lime-bolder,#37471f)}.cc-1ky6mbc [data-prosemirror-node-name=status]>[data-color="#FFF0B3"]>.lozenge-wrapper{background-color:var(--ds-background-accent-yellow-subtler,#f5e989);border-color:var(--ds-border-accent-yellow-subtle,#eed12b)}.cc-1ky6mbc [data-prosemirror-node-name=status]>[data-color="#FFF0B3"] .lozenge-text{color:var(--ds-text-accent-yellow-bolder,#533f04)}.cc-1ky6mbc [data-prosemirror-node-name=status]>[data-color="#FCE4A6"]>.lozenge-wrapper{background-color:var(--ds-background-accent-orange-subtler,#fce4a6);border-color:var(--ds-border-accent-orange-subtle,#fbc828)}.cc-1ky6mbc [data-prosemirror-node-name=status]>[data-color="#FCE4A6"] .lozenge-text{color:var(--ds-text-accent-orange-bolder,#693200)}.cc-1ky6mbc [data-prosemirror-node-name=status]>[data-color="#FDD0EC"]>.lozenge-wrapper{background-color:var(--ds-background-accent-magenta-subtler,#fdd0ec);border-color:var(--ds-border-accent-magenta-subtle,#f797d2)}.cc-1ky6mbc [data-prosemirror-node-name=status]>[data-color="#FDD0EC"] .lozenge-text{color:var(--ds-text-accent-magenta-bolder,#50253f)}
|
|
@@ -382,6 +382,7 @@ const editorContentStyles = {
|
|
|
382
382
|
deletedStatusStrikeStyles: "cc-eie91o",
|
|
383
383
|
atomicInlineChangedBoxShadowStyles: "cc-3nf4b",
|
|
384
384
|
statusStylesTeam26: "cc-1szti83",
|
|
385
|
+
statusStylesTeam26TextTrim: "cc-1wyoddi",
|
|
385
386
|
statusStylesNamedSemantic: "cc-ba6gav",
|
|
386
387
|
statusStylesNamedAccent: "cc-1gvo00o",
|
|
387
388
|
statusStylesHexAccent: "cc-1ky6mbc",
|
|
@@ -456,7 +457,7 @@ export const EditorContentContainerCompiled = /*#__PURE__*/React.forwardRef((pro
|
|
|
456
457
|
className: ax([editorContentStyles.baseStyles, editorContentStyles.maxModeReizeFixStyles, editorContentStyles.baseStylesMaxContainerWidthFixes, editorContentStyles.editorGutterPaddingBaseStyles, editorExperiment('platform_editor_preview_panel_responsiveness', true, {
|
|
457
458
|
exposure: true
|
|
458
459
|
}) && editorContentStyles.editorLargeGutterPuddingReducedBaseStyles, editorContentStyles.whitespaceStyles, editorContentStyles.indentationStyles, editorContentStyles.fontSizeStyles, editorContentStyles.shadowStyles, isExperimentEnabled('platform_editor_reduce_forced_layout_2') && editorContentStyles.extensionScrollInlineShadowStyles, editorContentStyles.InlineNodeViewSharedStyles, editorContentStyles.hideSelectionStyles, editorContentStyles.hideCursorWhenHideSelectionStyles, editorContentStyles.selectedNodeStyles, editorContentStyles.cursorStyles, editorContentStyles.firstFloatingToolbarButtonStyles, editorContentStyles.placeholderTextStyles, editorContentStyles.placeholderStyles, editorExperiment('platform_editor_controls', 'variant1') && editorContentStyles.placeholderOverflowStyles, editorContentStyles.codeBlockStyles, contentMode === 'compact' && editorContentStyles.codeBlockStylesWithEmUnits, editorContentStyles.editorUGCTokensRefreshed, editorContentStyles.editorUGCSmallText, editorContentStyles.blocktypeStyles, editorContentStyles.blocktypeStylesRtlBlockquote, isFloatingTocEnabled && editorContentStyles.headingScrollMarginStyles, editorContentStyles.blockquoteSelectedNodeStyles, isSelectionHighlightInheritanceActive ? editorContentStyles.listSelectedNodeStylesWithHighlightInheritance : editorContentStyles.listSelectedNodeStyles, isSelectionHighlightInheritanceActive ? editorContentStyles.textSelectedNodeStylesWithHighlightInheritance : editorContentStyles.textSelectedNodeStyles, editorContentStyles.blocktypeStyles_fg_platform_editor_typography_ugc, editorContentStyles.blocktypeStylesNestedDnd, editorContentStyles.codeMarkStyles, editorContentStyles.textColorStyles, editorContentStyles.backgroundColorStyles, !expValEquals('platform_editor_lovability_text_bg_color', 'isEnabled', true) && editorContentStyles.highlightLinksUnsetStyles, editorContentStyles.textHighlightPaddingStyles, editorContentStyles.listsStyles, editorContentStyles.listItemHiddenMarkerStyles, editorContentStyles.diffListStyles, contentMode === 'compact' && isDense && editorContentStyles.listsDenseStyles, isFullPage && editorContentStyles.listsStylesMarginLayoutShiftFix, editorContentStyles.ruleStyles, isExperimentEnabled('platform_editor_lovability_dividers_attributes') && editorContentStyles.ruleWithAttrsStyles, isExperimentEnabled('platform_editor_numbered_headings') && editorContentStyles.numberedHeadingsStyles, editorContentStyles.smartCardDiffStyles, editorContentStyles.showDiffDeletedNodeStyles, editorContentStyles.mediaStyles, isExperimentEnabled('platform_editor_vanilla_node_views_phase1') && editorContentStyles.vanillaCaptionStyles, contentMode === 'compact' && editorContentStyles.mediaCaptionStyles, editorContentStyles.firstWrappedMediaStyles, editorContentStyles.telepointerStyle, /* This needs to be after telepointer styles as some overlapping rules have equal specificity, and so the order is significant */
|
|
459
|
-
editorContentStyles.telepointerColorAndCommonStyle, colorMode === 'dark' && editorContentStyles.telepointerColorAndCommonStyleDarkMode, expValEqualsNoExposure('platform_editor_agent_be_streaming', 'isEnabled', true) && editorContentStyles.agentShimmerStyles, editorContentStyles.gapCursorStyles, editorContentStyles.gapCursorStylesVisibilityFix, editorContentStyles.panelStyles, editorContentStyles.nestedPanelBorderStylesMixin, editorContentStyles.panelStylesMixinNestedDnd, editorContentStyles.panelStylesMixin, editorContentStyles.mentionsStyles, editorContentStyles.tasksAndDecisionsStyles, contentMode === 'compact' && isDense && editorContentStyles.tasksAndDecisionsDenseStyles, editorContentStyles.gridStyles, editorContentStyles.blockMarksStyles, editorContentStyles.dateStyles, editorContentStyles.extensionStyles, fg('platform_editor_lovability_resize_exts_gracefully') && editorContentStyles.extensionWithBreakoutStyles, contentMode === 'compact' && editorContentStyles.extensionStylesDense, editorContentStyles.bodiedExtensionLayoutShiftFix, editorContentStyles.extensionDiffStyles, editorContentStyles.expandStylesBase, !useStandardNodeWidth && editorContentStyles.expandStyles, contentMode === 'compact' && isDense && editorContentStyles.expandDenseStyles, editorContentStyles.expandStylesMixinNestedDnd, editorContentStyles.expandStylesMixin_fg_platform_visual_refresh_icons, isChromeless && editorContentStyles.expandStylesMixin_chromeless_expand_fix, editorContentStyles.findReplaceStyles, editorContentStyles.findReplaceStylesWithCodeblockColorContrastFix, editorContentStyles.findReplaceStylesWithRefSyncBlock, editorContentStyles.textHighlightStyle, editorContentStyles.decisionStyles, editorContentStyles.taskItemStylesWithBlockTaskItem, editorContentStyles.taskItemCheckboxStyles, editorContentStyles.decisionIconWithVisualRefresh, editorContentStyles.statusStyles, isStatusStylesTeam26 ? editorContentStyles.statusStylesTeam26 : fg('platform-component-visual-refresh') ? editorContentStyles.statusStylesMixin_fg_platform_component_visual_refresh_with_search_match : editorContentStyles.statusStylesMixin_without_fg_platform_component_visual_refresh_with_search_match, isStatusStylesTeam26 && isUpdateStatusColorsEnabled && editorContentStyles.statusStylesNamedAccent, isStatusStylesTeam26 && !isUpdateStatusColorsEnabled && editorContentStyles.statusStylesNamedSemantic, editorContentStyles.statusStylesHexAccent, fg('platform_editor_ai_show_diff_patch_2') && editorContentStyles.deletedStatusStrikeStyles, editorContentStyles.annotationStyles, editorContentStyles.smartCardStylesWithSearchMatchAndBlockMenuDangerStyles, editorExperiment('platform_editor_preview_panel_responsiveness', true) && editorContentStyles.smartCardStylesWithSearchMatchAndPreviewPanelResponsiveness, editorContentStyles.editorControlsSmartCardStyles, editorContentStyles.embedCardStyles, editorContentStyles.unsupportedStyles, editorContentStyles.vanillaTooltipDefaultStyles, fg('confluence_ncs_step_diffing_version_history') && editorContentStyles.contributorTagStyles, isExperimentEnabled('platform_editor_vanilla_node_views_phase1') && editorContentStyles.vanillaUnsupportedStyles, editorContentStyles.resizerStyles, expValEqualsNoExposure('cc-maui-experiment', 'isEnabled', true) && expValEquals('databases-native-embeds-v2', 'isEnabled', true) && editorContentStyles.resizerBottomHandleStyles, editorContentStyles.layoutBaseStyles, editorContentStyles.alignMultipleWrappedImageInLayoutStyles, editorContentStyles.syncBlockStylesBase, fg('platform-dst-tokens-finesse') && editorContentStyles.syncBlockSelectedStyles, !useStandardNodeWidth && editorContentStyles.syncBlockStyles, editorContentStyles.syncBlockOverflowStyles, editorContentStyles.syncBlockFirstNodeStyles, editorContentStyles.syncBlockTextSelectionStyles, editorContentStyles.syncBlockInteractiveCursorStyles, editorExperiment('advanced_layouts', true) && editorContentStyles.layoutBaseStylesAdvanced, editorExperiment('advanced_layouts', true) ? editorContentStyles.layoutSectionStylesAdvanced : editorContentStyles.layoutSectionStylesNotAdvanced, editorExperiment('advanced_layouts', true) && !fg('platform-dst-top-layer-tooltip') && editorContentStyles.layoutDragHandleWrapperStylesLegacy, editorExperiment('advanced_layouts', true) && fg('platform-dst-top-layer-tooltip') && editorContentStyles.layoutDragHandleWrapperStylesTopLayer, editorExperiment('advanced_layouts', true) && editorContentStyles.layoutColumnDividerStyles, editorExperiment('advanced_layouts', true) && editorContentStyles.layoutColumnDividerStylesNestedDnD, editorExperiment('advanced_layouts', true) ? editorContentStyles.layoutColumnStylesAdvanced : editorContentStyles.layoutColumnStylesNotAdvanced, editorExperiment('advanced_layouts', true) && editorContentStyles.layoutColumnResizeStyles, editorExperiment('advanced_layouts', true) ? editorContentStyles.layoutSelectedStylesAdvanced : editorContentStyles.layoutSelectedStylesNotAdvanced, editorContentStyles.layoutSelectedStylesAdvancedFix, editorExperiment('advanced_layouts', true) && editorContentStyles.layoutColumnResponsiveStyles, editorExperiment('advanced_layouts', true) && editorContentStyles.layoutResponsiveBaseStyles, editorContentStyles.layoutBaseStylesNestedDndExcludingBodiedSync, editorContentStyles.layoutColumnMartinTopFixes, editorContentStyles.smartLinksInLivePagesStyles, editorContentStyles.linkingVisualRefreshV1Styles, editorContentStyles.dateVanillaStyles, contentMode === 'compact' ? editorContentStyles.paragraphStylesWithScaledMargin : editorContentStyles.paragraphStylesUGCRefreshed, editorContentStyles.linkStyles, browser.safari && editorContentStyles.listsStylesSafariFix, editorContentStyles.pragmaticResizerStylesSyncedBlock, editorContentStyles.pragmaticResizerStyles, expValEqualsNoExposure('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true) && isExperimentEnabled('platform_editor_resizer_selector_jsdom_fix') && editorContentStyles.pragmaticResizerStylesPanelAndRuleJsdomFix, expValEqualsNoExposure('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true) && !isExperimentEnabled('platform_editor_resizer_selector_jsdom_fix') && editorContentStyles.pragmaticResizerStylesPanelAndRule, isExperimentEnabled('platform_editor_lovability_resize_extensions') && editorContentStyles.pragmaticResizerStylesExtensions, editorContentStyles.pragmaticResizerStylesCodeBlockSyncedBlockPatch, isExperimentEnabled('platform_editor_reduce_forced_layout') && !expValEqualsNoExposure('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true) && editorContentStyles.pragmaticResizerStylesHiddenForPanelAndRule, isExperimentEnabled('platform_editor_reduce_forced_layout') && !isExperimentEnabled('platform_editor_lovability_resize_extensions') && editorContentStyles.pragmaticResizerStylesHiddenForExtensions, editorExperiment('advanced_layouts', true) && editorContentStyles.pragmaticStylesLayoutFirstNodeResizeHandleFix, editorContentStyles.pragmaticResizerStylesForTooltip, editorExperiment('platform_editor_preview_panel_responsiveness', true) && editorContentStyles.pragmaticResizerStylesWithReducedEditorGutter, editorContentStyles.aiPanelBaseStyles, isFirefox && editorContentStyles.aiPanelBaseFirefoxStyles, colorMode === 'dark' && editorContentStyles.aiPanelDarkStyles, colorMode === 'dark' && isFirefox && editorContentStyles.aiPanelDarkFirefoxStyles, viewMode === 'view' && editorContentStyles.layoutStylesForView, viewMode === 'view' && editorExperiment('advanced_layouts', true) && editorContentStyles.layoutSelectedStylesForViewAdvanced, viewMode === 'view' && editorExperiment('advanced_layouts', false) && editorContentStyles.layoutSelectedStylesForViewNotAdvanced, viewMode === 'view' && editorExperiment('advanced_layouts', true) && editorContentStyles.layoutResponsiveStylesForView, isComment && editorContentStyles.commentEditorStyles, isComment && editorContentStyles.tableCommentEditorStyles, (isComment || isChromeless) && editorContentStyles.nonFullPageContainerTypeStyles, isFullPage && editorContentStyles.fullPageEditorStyles, isFullPage && editorContentStyles.scrollbarStyles, editorContentStyles.firstCodeBlockWithNoMargin, editorContentStyles.firstBlockNodeStyles, editorContentStyles.firstNodeWidgetFixStyles, editorContentStyles.mentionNodeStyles, isExperimentEnabled('platform_editor_mention_avatar_nowrap') && editorContentStyles.mentionAvatarNoWrapStyles, colorMode === 'dark' && editorContentStyles.agentMentionShimmerDarkMode, editorContentStyles.mentionsSelectionStyles, expValEquals('platform_editor_lovability_emoji_scaling', 'isEnabled', true) ? editorContentStyles.scaledEmojiStyles : editorContentStyles.emojiStyles, isFloatingTocEnabled ? editorContentStyles.directEmojiSelectionStyles : editorContentStyles.emojiSelectionStyles, contentMode === 'compact' && isDense && expValEquals('platform_editor_lovability_emoji_scaling', 'isEnabled', true) && editorContentStyles.scaledEmojiDenseStyles, contentMode === 'compact' && isDense && !expValEquals('platform_editor_lovability_emoji_scaling', 'isEnabled', true) && editorContentStyles.emojiDenseStyles, editorContentStyles.panelViewStyles, editorContentStyles.mediaGroupStyles, editorContentStyles.mediaAlignmentStyles, editorContentStyles.tableLayoutFixesWithFontSize, editorContentStyles.tableContainerStyles, editorContentStyles.tableSharedStyle, isExperimentEnabled('platform_editor_table_css_overflow_shadow') && editorContentStyles.tableScrollInlineShadowStyles, (browser.gecko || browser.ie || browser.mac && browser.chrome) && editorContentStyles.tableSharedStyleBackgroundClipFix, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? editorContentStyles.tableSharedStyle_with_platform_editor_table_q4_loveability : editorContentStyles.tableSharedStyle_without_platform_editor_table_q4_loveability, expValEquals('platform_editor_table_menu_updates', 'isEnabled', true) && editorContentStyles.tableSharedStyle_with_platform_editor_table_menu_updates, fg('platform_editor_bordered_panel_nested_in_table') && editorContentStyles.tableSharedStyle_with_platform_editor_bordered_panel_nested_in_table, editorContentStyles.tableEmptyRowStyles, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && editorContentStyles.tableRoundedCornerStyles, editorContentStyles.tableContentModeStyles, editorContentStyles.tableContentModeExtensionContainmentStyles, editorContentStyles.tableContentModeNestedTableStyles, editorContentStyles.tableCellBackgroundColorOverrides, editorContentStyles.hyperLinkFloatingToolbarStyles, editorContentStyles.selectionToolbarAnimationStyles, editorContentStyles.blockquoteDangerStyles, editorContentStyles.textDangerStyles, editorContentStyles.listDangerStyles, editorContentStyles.dangerDateStyles, editorContentStyles.emojiDangerStyles, editorContentStyles.mentionDangerStyles, editorContentStyles.decisionDangerStyles, editorContentStyles.statusDangerStyles, fg('platform_editor_ai_show_diff_patch_2') && editorContentStyles.atomicInlineChangedBoxShadowStyles, editorContentStyles.dangerRuleStyles, editorContentStyles.mediaDangerStyles, editorContentStyles.nestedPanelDangerStyles, className || undefined]),
|
|
460
|
+
editorContentStyles.telepointerColorAndCommonStyle, colorMode === 'dark' && editorContentStyles.telepointerColorAndCommonStyleDarkMode, expValEqualsNoExposure('platform_editor_agent_be_streaming', 'isEnabled', true) && editorContentStyles.agentShimmerStyles, editorContentStyles.gapCursorStyles, editorContentStyles.gapCursorStylesVisibilityFix, editorContentStyles.panelStyles, editorContentStyles.nestedPanelBorderStylesMixin, editorContentStyles.panelStylesMixinNestedDnd, editorContentStyles.panelStylesMixin, editorContentStyles.mentionsStyles, editorContentStyles.tasksAndDecisionsStyles, contentMode === 'compact' && isDense && editorContentStyles.tasksAndDecisionsDenseStyles, editorContentStyles.gridStyles, editorContentStyles.blockMarksStyles, editorContentStyles.dateStyles, editorContentStyles.extensionStyles, fg('platform_editor_lovability_resize_exts_gracefully') && editorContentStyles.extensionWithBreakoutStyles, contentMode === 'compact' && editorContentStyles.extensionStylesDense, editorContentStyles.bodiedExtensionLayoutShiftFix, editorContentStyles.extensionDiffStyles, editorContentStyles.expandStylesBase, !useStandardNodeWidth && editorContentStyles.expandStyles, contentMode === 'compact' && isDense && editorContentStyles.expandDenseStyles, editorContentStyles.expandStylesMixinNestedDnd, editorContentStyles.expandStylesMixin_fg_platform_visual_refresh_icons, isChromeless && editorContentStyles.expandStylesMixin_chromeless_expand_fix, editorContentStyles.findReplaceStyles, editorContentStyles.findReplaceStylesWithCodeblockColorContrastFix, editorContentStyles.findReplaceStylesWithRefSyncBlock, editorContentStyles.textHighlightStyle, editorContentStyles.decisionStyles, editorContentStyles.taskItemStylesWithBlockTaskItem, editorContentStyles.taskItemCheckboxStyles, editorContentStyles.decisionIconWithVisualRefresh, editorContentStyles.statusStyles, isStatusStylesTeam26 ? editorContentStyles.statusStylesTeam26 : fg('platform-component-visual-refresh') ? editorContentStyles.statusStylesMixin_fg_platform_component_visual_refresh_with_search_match : editorContentStyles.statusStylesMixin_without_fg_platform_component_visual_refresh_with_search_match, isStatusStylesTeam26 && isExperimentEnabled('platform_status_lozenge_fractional_zoom_fix') && editorContentStyles.statusStylesTeam26TextTrim, isStatusStylesTeam26 && isUpdateStatusColorsEnabled && editorContentStyles.statusStylesNamedAccent, isStatusStylesTeam26 && !isUpdateStatusColorsEnabled && editorContentStyles.statusStylesNamedSemantic, editorContentStyles.statusStylesHexAccent, fg('platform_editor_ai_show_diff_patch_2') && editorContentStyles.deletedStatusStrikeStyles, editorContentStyles.annotationStyles, editorContentStyles.smartCardStylesWithSearchMatchAndBlockMenuDangerStyles, editorExperiment('platform_editor_preview_panel_responsiveness', true) && editorContentStyles.smartCardStylesWithSearchMatchAndPreviewPanelResponsiveness, editorContentStyles.editorControlsSmartCardStyles, editorContentStyles.embedCardStyles, editorContentStyles.unsupportedStyles, editorContentStyles.vanillaTooltipDefaultStyles, fg('confluence_ncs_step_diffing_version_history') && editorContentStyles.contributorTagStyles, isExperimentEnabled('platform_editor_vanilla_node_views_phase1') && editorContentStyles.vanillaUnsupportedStyles, editorContentStyles.resizerStyles, expValEqualsNoExposure('cc-maui-experiment', 'isEnabled', true) && expValEquals('databases-native-embeds-v2', 'isEnabled', true) && editorContentStyles.resizerBottomHandleStyles, editorContentStyles.layoutBaseStyles, editorContentStyles.alignMultipleWrappedImageInLayoutStyles, editorContentStyles.syncBlockStylesBase, fg('platform-dst-tokens-finesse') && editorContentStyles.syncBlockSelectedStyles, !useStandardNodeWidth && editorContentStyles.syncBlockStyles, editorContentStyles.syncBlockOverflowStyles, editorContentStyles.syncBlockFirstNodeStyles, editorContentStyles.syncBlockTextSelectionStyles, editorContentStyles.syncBlockInteractiveCursorStyles, editorExperiment('advanced_layouts', true) && editorContentStyles.layoutBaseStylesAdvanced, editorExperiment('advanced_layouts', true) ? editorContentStyles.layoutSectionStylesAdvanced : editorContentStyles.layoutSectionStylesNotAdvanced, editorExperiment('advanced_layouts', true) && !fg('platform-dst-top-layer-tooltip') && editorContentStyles.layoutDragHandleWrapperStylesLegacy, editorExperiment('advanced_layouts', true) && fg('platform-dst-top-layer-tooltip') && editorContentStyles.layoutDragHandleWrapperStylesTopLayer, editorExperiment('advanced_layouts', true) && editorContentStyles.layoutColumnDividerStyles, editorExperiment('advanced_layouts', true) && editorContentStyles.layoutColumnDividerStylesNestedDnD, editorExperiment('advanced_layouts', true) ? editorContentStyles.layoutColumnStylesAdvanced : editorContentStyles.layoutColumnStylesNotAdvanced, editorExperiment('advanced_layouts', true) && editorContentStyles.layoutColumnResizeStyles, editorExperiment('advanced_layouts', true) ? editorContentStyles.layoutSelectedStylesAdvanced : editorContentStyles.layoutSelectedStylesNotAdvanced, editorContentStyles.layoutSelectedStylesAdvancedFix, editorExperiment('advanced_layouts', true) && editorContentStyles.layoutColumnResponsiveStyles, editorExperiment('advanced_layouts', true) && editorContentStyles.layoutResponsiveBaseStyles, editorContentStyles.layoutBaseStylesNestedDndExcludingBodiedSync, editorContentStyles.layoutColumnMartinTopFixes, editorContentStyles.smartLinksInLivePagesStyles, editorContentStyles.linkingVisualRefreshV1Styles, editorContentStyles.dateVanillaStyles, contentMode === 'compact' ? editorContentStyles.paragraphStylesWithScaledMargin : editorContentStyles.paragraphStylesUGCRefreshed, editorContentStyles.linkStyles, browser.safari && editorContentStyles.listsStylesSafariFix, editorContentStyles.pragmaticResizerStylesSyncedBlock, editorContentStyles.pragmaticResizerStyles, expValEqualsNoExposure('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true) && isExperimentEnabled('platform_editor_resizer_selector_jsdom_fix') && editorContentStyles.pragmaticResizerStylesPanelAndRuleJsdomFix, expValEqualsNoExposure('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true) && !isExperimentEnabled('platform_editor_resizer_selector_jsdom_fix') && editorContentStyles.pragmaticResizerStylesPanelAndRule, isExperimentEnabled('platform_editor_lovability_resize_extensions') && editorContentStyles.pragmaticResizerStylesExtensions, editorContentStyles.pragmaticResizerStylesCodeBlockSyncedBlockPatch, isExperimentEnabled('platform_editor_reduce_forced_layout') && !expValEqualsNoExposure('platform_editor_lovability_resize_dividers_panels', 'isEnabled', true) && editorContentStyles.pragmaticResizerStylesHiddenForPanelAndRule, isExperimentEnabled('platform_editor_reduce_forced_layout') && !isExperimentEnabled('platform_editor_lovability_resize_extensions') && editorContentStyles.pragmaticResizerStylesHiddenForExtensions, editorExperiment('advanced_layouts', true) && editorContentStyles.pragmaticStylesLayoutFirstNodeResizeHandleFix, editorContentStyles.pragmaticResizerStylesForTooltip, editorExperiment('platform_editor_preview_panel_responsiveness', true) && editorContentStyles.pragmaticResizerStylesWithReducedEditorGutter, editorContentStyles.aiPanelBaseStyles, isFirefox && editorContentStyles.aiPanelBaseFirefoxStyles, colorMode === 'dark' && editorContentStyles.aiPanelDarkStyles, colorMode === 'dark' && isFirefox && editorContentStyles.aiPanelDarkFirefoxStyles, viewMode === 'view' && editorContentStyles.layoutStylesForView, viewMode === 'view' && editorExperiment('advanced_layouts', true) && editorContentStyles.layoutSelectedStylesForViewAdvanced, viewMode === 'view' && editorExperiment('advanced_layouts', false) && editorContentStyles.layoutSelectedStylesForViewNotAdvanced, viewMode === 'view' && editorExperiment('advanced_layouts', true) && editorContentStyles.layoutResponsiveStylesForView, isComment && editorContentStyles.commentEditorStyles, isComment && editorContentStyles.tableCommentEditorStyles, (isComment || isChromeless) && editorContentStyles.nonFullPageContainerTypeStyles, isFullPage && editorContentStyles.fullPageEditorStyles, isFullPage && editorContentStyles.scrollbarStyles, editorContentStyles.firstCodeBlockWithNoMargin, editorContentStyles.firstBlockNodeStyles, editorContentStyles.firstNodeWidgetFixStyles, editorContentStyles.mentionNodeStyles, isExperimentEnabled('platform_editor_mention_avatar_nowrap') && editorContentStyles.mentionAvatarNoWrapStyles, colorMode === 'dark' && editorContentStyles.agentMentionShimmerDarkMode, editorContentStyles.mentionsSelectionStyles, expValEquals('platform_editor_lovability_emoji_scaling', 'isEnabled', true) ? editorContentStyles.scaledEmojiStyles : editorContentStyles.emojiStyles, isFloatingTocEnabled ? editorContentStyles.directEmojiSelectionStyles : editorContentStyles.emojiSelectionStyles, contentMode === 'compact' && isDense && expValEquals('platform_editor_lovability_emoji_scaling', 'isEnabled', true) && editorContentStyles.scaledEmojiDenseStyles, contentMode === 'compact' && isDense && !expValEquals('platform_editor_lovability_emoji_scaling', 'isEnabled', true) && editorContentStyles.emojiDenseStyles, editorContentStyles.panelViewStyles, editorContentStyles.mediaGroupStyles, editorContentStyles.mediaAlignmentStyles, editorContentStyles.tableLayoutFixesWithFontSize, editorContentStyles.tableContainerStyles, editorContentStyles.tableSharedStyle, isExperimentEnabled('platform_editor_table_css_overflow_shadow') && editorContentStyles.tableScrollInlineShadowStyles, (browser.gecko || browser.ie || browser.mac && browser.chrome) && editorContentStyles.tableSharedStyleBackgroundClipFix, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) ? editorContentStyles.tableSharedStyle_with_platform_editor_table_q4_loveability : editorContentStyles.tableSharedStyle_without_platform_editor_table_q4_loveability, expValEquals('platform_editor_table_menu_updates', 'isEnabled', true) && editorContentStyles.tableSharedStyle_with_platform_editor_table_menu_updates, fg('platform_editor_bordered_panel_nested_in_table') && editorContentStyles.tableSharedStyle_with_platform_editor_bordered_panel_nested_in_table, editorContentStyles.tableEmptyRowStyles, expValEquals('platform_editor_table_q4_loveability', 'isEnabled', true) && editorContentStyles.tableRoundedCornerStyles, editorContentStyles.tableContentModeStyles, editorContentStyles.tableContentModeExtensionContainmentStyles, editorContentStyles.tableContentModeNestedTableStyles, editorContentStyles.tableCellBackgroundColorOverrides, editorContentStyles.hyperLinkFloatingToolbarStyles, editorContentStyles.selectionToolbarAnimationStyles, editorContentStyles.blockquoteDangerStyles, editorContentStyles.textDangerStyles, editorContentStyles.listDangerStyles, editorContentStyles.dangerDateStyles, editorContentStyles.emojiDangerStyles, editorContentStyles.mentionDangerStyles, editorContentStyles.decisionDangerStyles, editorContentStyles.statusDangerStyles, fg('platform_editor_ai_show_diff_patch_2') && editorContentStyles.atomicInlineChangedBoxShadowStyles, editorContentStyles.dangerRuleStyles, editorContentStyles.mediaDangerStyles, editorContentStyles.nestedPanelDangerStyles, className || undefined]),
|
|
460
461
|
ref: ref,
|
|
461
462
|
"data-editor-scroll-container": isScrollable ? 'true' : undefined,
|
|
462
463
|
"data-testid": "editor-content-container"
|
|
@@ -3,7 +3,7 @@ import { EditorToolbarProvider } from '@atlaskit/editor-common/toolbar/context';
|
|
|
3
3
|
import { EditorToolbarUIProvider } from '@atlaskit/editor-common/toolbar/EditorToolbarUIProvider';
|
|
4
4
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
5
5
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
|
|
6
|
-
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
6
|
+
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity/connectivityPluginType';
|
|
7
7
|
import { ToolbarModelRenderer } from '@atlaskit/editor-toolbar-model/toolbar-model-renderer';
|
|
8
8
|
import { ToolbarButtonGroup } from '@atlaskit/editor-toolbar/toolbar-button-group';
|
|
9
9
|
import { ToolbarDropdownItemSection } from '@atlaskit/editor-toolbar/toolbar-dropdown-item-section';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
1
|
+
import React, { useCallback, useEffect, useMemo } from 'react';
|
|
2
2
|
import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
|
|
3
3
|
import { useQuickInsertContext } from '@atlaskit/editor-common/quick-insert/use-quick-insert-context';
|
|
4
|
+
import { getAppVendorLookup } from './app-vendor/getAppVendorLookup';
|
|
5
|
+
import { useAppVendorName } from './app-vendor/useAppVendorName';
|
|
4
6
|
import { executeExtensionQuickInsertItem } from './executeExtensionQuickInsertItem';
|
|
5
7
|
import { ExtensionQuickInsertIcon } from './ExtensionQuickInsertIcon';
|
|
6
8
|
export const ExtensionQuickInsertMenuItem = ({
|
|
@@ -8,12 +10,27 @@ export const ExtensionQuickInsertMenuItem = ({
|
|
|
8
10
|
createAnalyticsEvent,
|
|
9
11
|
editorActions,
|
|
10
12
|
item,
|
|
11
|
-
onInsert
|
|
13
|
+
onInsert,
|
|
14
|
+
prefetchVendors
|
|
12
15
|
}) => {
|
|
16
|
+
var _getAppVendorLookup;
|
|
13
17
|
const {
|
|
14
18
|
editorView,
|
|
15
19
|
isOffline
|
|
16
20
|
} = useQuickInsertContext();
|
|
21
|
+
const vendorName = useAppVendorName((_getAppVendorLookup = getAppVendorLookup(item)) === null || _getAppVendorLookup === void 0 ? void 0 : _getAppVendorLookup.id);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
prefetchVendors === null || prefetchVendors === void 0 ? void 0 : prefetchVendors();
|
|
24
|
+
}, [prefetchVendors]);
|
|
25
|
+
const preview = useMemo(() => {
|
|
26
|
+
var _item$preview;
|
|
27
|
+
return vendorName && !((_item$preview = item.preview) !== null && _item$preview !== void 0 && _item$preview.attribution) ? {
|
|
28
|
+
...item.preview,
|
|
29
|
+
attribution: {
|
|
30
|
+
name: vendorName
|
|
31
|
+
}
|
|
32
|
+
} : item.preview;
|
|
33
|
+
}, [item.preview, vendorName]);
|
|
17
34
|
const onSelect = useCallback(({
|
|
18
35
|
insert,
|
|
19
36
|
source
|
|
@@ -41,7 +58,7 @@ export const ExtensionQuickInsertMenuItem = ({
|
|
|
41
58
|
isDisabled: isOffline,
|
|
42
59
|
lozenge: item.lozenge,
|
|
43
60
|
onSelect: onSelect,
|
|
44
|
-
preview:
|
|
61
|
+
preview: preview,
|
|
45
62
|
description: item.description,
|
|
46
63
|
title: item.title
|
|
47
64
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Statuses where retrying cannot succeed, or would add load to a throttled gateway. */
|
|
2
|
+
const BLOCKING_STATUSES = new Set([401, 403, 429]);
|
|
3
|
+
export class AppVendorRequestError extends Error {
|
|
4
|
+
/** Whether every remaining lookup should stop rather than retry. */
|
|
5
|
+
|
|
6
|
+
constructor(message, status) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.name = 'AppVendorRequestError';
|
|
9
|
+
this.isBlocking = status !== undefined && BLOCKING_STATUSES.has(status);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vendor names keyed by lookup id, plus the subscribers to notify when they change.
|
|
3
|
+
* Module scope so names survive editor and provider rebuilds for the rest of the page load.
|
|
4
|
+
*/
|
|
5
|
+
export const appVendorCache = {
|
|
6
|
+
entries: new Map(),
|
|
7
|
+
listeners: new Set()
|
|
8
|
+
};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { AppVendorRequestError } from './AppVendorRequestError';
|
|
2
|
+
const AGG_PATH = '/gateway/api/graphql';
|
|
3
|
+
const OPERATION_NAME = 'QuickInsertAppVendorsQuery';
|
|
4
|
+
const getField = ({
|
|
5
|
+
kind
|
|
6
|
+
}, variable) => kind === 'forge' ? `marketplaceAppByCloudAppId(cloudAppId: $${variable})` : `marketplaceAppByKey(appKey: $${variable})`;
|
|
7
|
+
const getVariableType = ({
|
|
8
|
+
kind
|
|
9
|
+
}) => kind === 'forge' ? 'ID!' : 'String!';
|
|
10
|
+
const buildQuery = lookups => {
|
|
11
|
+
const variables = lookups.map((lookup, index) => `$a${index}: ${getVariableType(lookup)}`);
|
|
12
|
+
const fields = lookups.map((lookup, index) => `a${index}: ${getField(lookup, `a${index}`)} { partner { name } }`);
|
|
13
|
+
return `query ${OPERATION_NAME}(${variables.join(', ')}) { ${fields.join(' ')} }`;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/** A request that never settles would otherwise leave its lookups pending for the page load. */
|
|
17
|
+
const REQUEST_TIMEOUT_MS = 10_000;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Fetches Marketplace partner names for at most one batch of lookups.
|
|
21
|
+
* Resolves `null` for apps without a listed partner and omits lookups whose field errored, so they
|
|
22
|
+
* can be retried; rejects with `AppVendorRequestError` when the request itself fails, or with an
|
|
23
|
+
* `AbortError` when it takes longer than `REQUEST_TIMEOUT_MS`.
|
|
24
|
+
*/
|
|
25
|
+
export const fetchAppVendors = async lookups => {
|
|
26
|
+
const controller = new AbortController();
|
|
27
|
+
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
|
|
28
|
+
try {
|
|
29
|
+
const response = await fetch(AGG_PATH, {
|
|
30
|
+
method: 'POST',
|
|
31
|
+
headers: {
|
|
32
|
+
'Content-Type': 'application/json'
|
|
33
|
+
},
|
|
34
|
+
body: JSON.stringify({
|
|
35
|
+
operationName: OPERATION_NAME,
|
|
36
|
+
query: buildQuery(lookups),
|
|
37
|
+
variables: Object.fromEntries(lookups.map(({
|
|
38
|
+
value
|
|
39
|
+
}, index) => [`a${index}`, value]))
|
|
40
|
+
}),
|
|
41
|
+
// Also aborts reading the body, so a slow response cannot hang either.
|
|
42
|
+
signal: controller.signal
|
|
43
|
+
});
|
|
44
|
+
if (!response.ok) {
|
|
45
|
+
throw new AppVendorRequestError(`App vendor request failed: ${response.status}`, response.status);
|
|
46
|
+
}
|
|
47
|
+
const {
|
|
48
|
+
data,
|
|
49
|
+
errors
|
|
50
|
+
} = await response.json();
|
|
51
|
+
if (!data) {
|
|
52
|
+
throw new AppVendorRequestError('App vendor request returned no data');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// A field that errored or timed out also returns null, which must not be cached as unlisted.
|
|
56
|
+
const erroredAliases = new Set(errors === null || errors === void 0 ? void 0 : errors.map(({
|
|
57
|
+
path
|
|
58
|
+
}) => path === null || path === void 0 ? void 0 : path[0]));
|
|
59
|
+
return new Map(lookups.flatMap(({
|
|
60
|
+
id
|
|
61
|
+
}, index) => {
|
|
62
|
+
var _data$alias, _data$alias$partner;
|
|
63
|
+
const alias = `a${index}`;
|
|
64
|
+
return erroredAliases.has(alias) ? [] : [[id, ((_data$alias = data[alias]) === null || _data$alias === void 0 ? void 0 : (_data$alias$partner = _data$alias.partner) === null || _data$alias$partner === void 0 ? void 0 : _data$alias$partner.name) || null]];
|
|
65
|
+
}));
|
|
66
|
+
} finally {
|
|
67
|
+
clearTimeout(timeout);
|
|
68
|
+
}
|
|
69
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { AppVendorRequestError } from './AppVendorRequestError';
|
|
2
|
+
import { fetchAppVendors } from './fetchAppVendors';
|
|
3
|
+
/** Marketplace has no bulk lookup; larger aliased requests time out. */
|
|
4
|
+
const BATCH_SIZE = 15;
|
|
5
|
+
const MAX_CONCURRENT_BATCHES = 3;
|
|
6
|
+
/**
|
|
7
|
+
* Fetches lookups in batches, at most `MAX_CONCURRENT_BATCHES` at a time, reporting each batch as it
|
|
8
|
+
* settles. Batches that have not started when `shouldContinue` returns false are reported as skipped.
|
|
9
|
+
* Loaded on demand so editors without ecosystem apps never download the fetching code.
|
|
10
|
+
*/
|
|
11
|
+
export const fetchAppVendorsInBatches = async (lookups, {
|
|
12
|
+
onBatch,
|
|
13
|
+
shouldContinue
|
|
14
|
+
}) => {
|
|
15
|
+
const batches = [];
|
|
16
|
+
for (let start = 0; start < lookups.length; start += BATCH_SIZE) {
|
|
17
|
+
batches.push(lookups.slice(start, start + BATCH_SIZE));
|
|
18
|
+
}
|
|
19
|
+
let nextBatch = 0;
|
|
20
|
+
const runWorker = async () => {
|
|
21
|
+
while (nextBatch < batches.length) {
|
|
22
|
+
const batch = batches[nextBatch++];
|
|
23
|
+
if (!shouldContinue()) {
|
|
24
|
+
onBatch(batch, {
|
|
25
|
+
status: 'skipped'
|
|
26
|
+
});
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
// Only the request is caught, so a batch is never reported twice.
|
|
30
|
+
let names;
|
|
31
|
+
try {
|
|
32
|
+
names = await fetchAppVendors(batch);
|
|
33
|
+
} catch (error) {
|
|
34
|
+
const isBlocking = error instanceof AppVendorRequestError && error.isBlocking;
|
|
35
|
+
onBatch(batch, {
|
|
36
|
+
error,
|
|
37
|
+
isBlocking,
|
|
38
|
+
status: 'rejected'
|
|
39
|
+
});
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
onBatch(batch, {
|
|
43
|
+
names,
|
|
44
|
+
status: 'fulfilled'
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
await Promise.all(Array.from({
|
|
49
|
+
length: Math.min(MAX_CONCURRENT_BATCHES, batches.length)
|
|
50
|
+
}, runWorker));
|
|
51
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { FORGE_EXTENSION_TYPE } from '@atlaskit/editor-common/extensions/manifest-helpers';
|
|
2
|
+
const FORGE_APP_ARI_PREFIX = 'ari:cloud:ecosystem::app/';
|
|
3
|
+
|
|
4
|
+
/** How to look up the Marketplace partner of the app that contributes an extension item. */
|
|
5
|
+
|
|
6
|
+
/** Returns a lookup only for ecosystem apps; Atlassian-owned items have no Marketplace partner. */
|
|
7
|
+
export const getAppVendorLookup = ({
|
|
8
|
+
app,
|
|
9
|
+
extensionType
|
|
10
|
+
}) => {
|
|
11
|
+
if ((app === null || app === void 0 ? void 0 : app.source) !== 'ecosystem' || !app.key) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
if (extensionType === FORGE_EXTENSION_TYPE) {
|
|
15
|
+
// Marketplace returns null for a bare Forge app UUID, so always send the full ARI.
|
|
16
|
+
const value = app.key.startsWith(FORGE_APP_ARI_PREFIX) ? app.key : `${FORGE_APP_ARI_PREFIX}${app.key}`;
|
|
17
|
+
return {
|
|
18
|
+
id: `forge:${value}`,
|
|
19
|
+
kind: 'forge',
|
|
20
|
+
value
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
id: `connect:${app.key}`,
|
|
25
|
+
kind: 'connect',
|
|
26
|
+
value: app.key
|
|
27
|
+
};
|
|
28
|
+
};
|