@atlaskit/editor-common 118.11.0 → 119.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 +50 -0
- package/compass.yml +2 -2
- package/dist/cjs/core-utils/index.js +1 -8
- package/dist/cjs/extensibility/ExtensionSSRReactContextsProvider.js +1 -2
- package/dist/cjs/extensions/buildMenuItem.js +7 -1
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/portal/common.js +2 -3
- package/dist/cjs/react-node-view/NodeViewContentHole.js +1 -2
- package/dist/cjs/react-node-view/index.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/Mention/index.js +20 -1
- package/dist/cjs/ui/Mention/mention-node-data-provider.js +5 -0
- package/dist/cjs/ui/Mention/mention-with-profilecard.js +8 -0
- package/dist/cjs/ui/Mention/mention-with-providers.js +92 -15
- package/dist/es2019/core-utils/index.js +1 -2
- package/dist/es2019/extensibility/ExtensionSSRReactContextsProvider.js +1 -2
- package/dist/es2019/extensions/buildMenuItem.js +7 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/portal/common.js +2 -3
- package/dist/es2019/react-node-view/NodeViewContentHole.js +1 -2
- package/dist/es2019/react-node-view/index.js +2 -2
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/Mention/index.js +21 -2
- package/dist/es2019/ui/Mention/mention-node-data-provider.js +1 -0
- package/dist/es2019/ui/Mention/mention-with-profilecard.js +8 -0
- package/dist/es2019/ui/Mention/mention-with-providers.js +69 -2
- package/dist/esm/core-utils/index.js +1 -2
- package/dist/esm/extensibility/ExtensionSSRReactContextsProvider.js +1 -2
- package/dist/esm/extensions/buildMenuItem.js +7 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/portal/common.js +2 -3
- package/dist/esm/react-node-view/NodeViewContentHole.js +1 -2
- package/dist/esm/react-node-view/index.js +2 -2
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/Mention/index.js +21 -2
- package/dist/esm/ui/Mention/mention-node-data-provider.js +1 -0
- package/dist/esm/ui/Mention/mention-with-profilecard.js +8 -0
- package/dist/esm/ui/Mention/mention-with-providers.js +92 -15
- package/dist/types/analytics/types/quick-insert-events.d.ts +15 -34
- package/dist/types/collab/agent-remote-edit-review.d.ts +14 -0
- package/dist/types/core-utils/index.d.ts +0 -1
- package/dist/types/extensions/types/extension-manifest.d.ts +9 -0
- package/dist/types/extensions/types/utils.d.ts +2 -1
- package/dist/types/mention.d.ts +1 -0
- package/dist/types/provider-factory/quick-insert-provider.d.ts +3 -0
- package/dist/types/ui/Mention/index.d.ts +2 -0
- package/dist/types/ui/Mention/mention-node-data-provider.d.ts +32 -0
- package/dist/types/ui/Mention/mention-with-profilecard.d.ts +5 -1
- package/dist/types/ui/Mention/mention-with-providers.d.ts +11 -1
- package/package.json +9 -3
- package/dist/cjs/core-utils/is-ssr-streaming.js +0 -22
- package/dist/es2019/core-utils/is-ssr-streaming.js +0 -16
- package/dist/esm/core-utils/is-ssr-streaming.js +0 -16
- package/dist/types/core-utils/is-ssr-streaming.d.ts +0 -10
|
@@ -1,15 +1,54 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
2
3
|
import { ResourcedMention } from '@atlaskit/mention/element';
|
|
3
4
|
import ResourcedMentionWithProfilecard from './mention-with-profilecard';
|
|
4
5
|
const GENERIC_USER_IDS = ['HipChat', 'all', 'here'];
|
|
6
|
+
const useMentionNodeData = ({
|
|
7
|
+
id,
|
|
8
|
+
mentionNodeDataProvider,
|
|
9
|
+
userType
|
|
10
|
+
}) => {
|
|
11
|
+
var _state$data;
|
|
12
|
+
const mention = useMemo(() => ({
|
|
13
|
+
id,
|
|
14
|
+
userType
|
|
15
|
+
}), [id, userType]);
|
|
16
|
+
const mentionKey = `${userType !== null && userType !== void 0 ? userType : 'DEFAULT'}:${id}`;
|
|
17
|
+
const synchronousData = useMemo(() => mentionNodeDataProvider.getMentionDataFromCache(mention), [mention, mentionNodeDataProvider]);
|
|
18
|
+
const [state, setState] = useState(() => ({
|
|
19
|
+
data: synchronousData,
|
|
20
|
+
key: mentionKey
|
|
21
|
+
}));
|
|
22
|
+
const data = state.key === mentionKey ? (_state$data = state.data) !== null && _state$data !== void 0 ? _state$data : synchronousData : synchronousData;
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (synchronousData) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
let isActive = true;
|
|
28
|
+
mentionNodeDataProvider.getMentionData(mention, payload => {
|
|
29
|
+
if (isActive && payload.data) {
|
|
30
|
+
setState({
|
|
31
|
+
data: payload.data,
|
|
32
|
+
key: mentionKey
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
return () => {
|
|
37
|
+
isActive = false;
|
|
38
|
+
};
|
|
39
|
+
}, [mention, mentionKey, mentionNodeDataProvider, synchronousData]);
|
|
40
|
+
return data;
|
|
41
|
+
};
|
|
5
42
|
export const MentionWithProviders = /*#__PURE__*/React.memo(({
|
|
6
43
|
accessLevel,
|
|
7
44
|
disabledTooltip,
|
|
8
45
|
eventHandlers,
|
|
9
46
|
id,
|
|
10
47
|
isDisabled,
|
|
48
|
+
mentionNodeData,
|
|
11
49
|
mentionProvider,
|
|
12
50
|
profilecardProvider: profilecardProviderResolver,
|
|
51
|
+
renderAvatarSlot = false,
|
|
13
52
|
text,
|
|
14
53
|
localId,
|
|
15
54
|
userType
|
|
@@ -49,11 +88,15 @@ export const MentionWithProviders = /*#__PURE__*/React.memo(({
|
|
|
49
88
|
accessLevel: accessLevel,
|
|
50
89
|
localId: localId,
|
|
51
90
|
mentionProvider: mentionProvider,
|
|
91
|
+
appType: mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.appType,
|
|
92
|
+
avatarUrl: mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.avatarUrl,
|
|
93
|
+
isAvatarImagePreShaped: mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.isAvatarImagePreShaped,
|
|
52
94
|
isDisabled: true,
|
|
53
95
|
disabledTooltip: disabledTooltip,
|
|
54
96
|
onClick: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onClick,
|
|
55
97
|
onMouseEnter: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseEnter,
|
|
56
98
|
onMouseLeave: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseLeave,
|
|
99
|
+
renderAvatarSlot: renderAvatarSlot,
|
|
57
100
|
ssrPlaceholderId: ssrPlaceholderId
|
|
58
101
|
});
|
|
59
102
|
}
|
|
@@ -63,7 +106,10 @@ export const MentionWithProviders = /*#__PURE__*/React.memo(({
|
|
|
63
106
|
accessLevel: accessLevel,
|
|
64
107
|
localId: localId,
|
|
65
108
|
userType: userType,
|
|
66
|
-
mentionProvider: mentionProvider
|
|
109
|
+
mentionProvider: mentionProvider,
|
|
110
|
+
appType: mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.appType,
|
|
111
|
+
avatarUrl: mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.avatarUrl,
|
|
112
|
+
isAvatarImagePreShaped: mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.isAvatarImagePreShaped
|
|
67
113
|
// Ignored via go/ees005
|
|
68
114
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
69
115
|
,
|
|
@@ -71,6 +117,27 @@ export const MentionWithProviders = /*#__PURE__*/React.memo(({
|
|
|
71
117
|
onClick: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onClick,
|
|
72
118
|
onMouseEnter: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseEnter,
|
|
73
119
|
onMouseLeave: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseLeave,
|
|
120
|
+
renderAvatarSlot: renderAvatarSlot,
|
|
74
121
|
ssrPlaceholderId: ssrPlaceholderId
|
|
75
122
|
});
|
|
123
|
+
});
|
|
124
|
+
export const MentionWithAvatarProviders = /*#__PURE__*/React.memo(({
|
|
125
|
+
id,
|
|
126
|
+
mentionNodeDataProvider,
|
|
127
|
+
userType,
|
|
128
|
+
...props
|
|
129
|
+
}) => {
|
|
130
|
+
const mentionNodeData = useMentionNodeData({
|
|
131
|
+
id,
|
|
132
|
+
mentionNodeDataProvider,
|
|
133
|
+
userType
|
|
134
|
+
});
|
|
135
|
+
return /*#__PURE__*/React.createElement(MentionWithProviders
|
|
136
|
+
// eslint-disable-next-line react/jsx-props-no-spreading -- The treatment adds only resolved avatar data to the existing mention props.
|
|
137
|
+
, _extends({}, props, {
|
|
138
|
+
id: id,
|
|
139
|
+
mentionNodeData: mentionNodeData,
|
|
140
|
+
renderAvatarSlot: true,
|
|
141
|
+
userType: userType
|
|
142
|
+
}));
|
|
76
143
|
});
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { RawIntlProvider } from 'react-intl';
|
|
3
3
|
import { isSSR } from '../core-utils/is-ssr';
|
|
4
|
-
import { isSSRStreaming } from '../core-utils/is-ssr-streaming';
|
|
5
4
|
export function ExtensionSSRReactContextsProvider(_ref) {
|
|
6
5
|
var children = _ref.children,
|
|
7
6
|
intl = _ref.intl;
|
|
8
|
-
if (!isSSR()
|
|
7
|
+
if (!isSSR()) {
|
|
9
8
|
return children;
|
|
10
9
|
}
|
|
11
10
|
if (!intl) {
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
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; }
|
|
3
3
|
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) { _defineProperty(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; }
|
|
4
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
4
5
|
import { buildAction } from './manifest-helpers';
|
|
5
6
|
export function buildMenuItem(manifest, extensionModule) {
|
|
7
|
+
var _ref, _extensionModule$app;
|
|
6
8
|
var title = extensionModule.title || manifest.title;
|
|
7
9
|
var key = "".concat(manifest.key, ":").concat(extensionModule.key);
|
|
8
10
|
var node = buildAction(extensionModule.action, manifest);
|
|
9
11
|
if (!node) {
|
|
10
12
|
throw new Error("Couldn't find any action for ".concat(title, " (").concat(key, ")"));
|
|
11
13
|
}
|
|
12
|
-
return _objectSpread(_objectSpread({
|
|
14
|
+
return _objectSpread(_objectSpread(_objectSpread({}, isExperimentEnabled('platform_editor_slash_app_category_analytics') ? {
|
|
15
|
+
app: (_ref = (_extensionModule$app = extensionModule.app) !== null && _extensionModule$app !== void 0 ? _extensionModule$app : manifest.app) !== null && _ref !== void 0 ? _ref : {
|
|
16
|
+
key: manifest.key
|
|
17
|
+
}
|
|
18
|
+
} : {}), {}, {
|
|
13
19
|
key: key,
|
|
14
20
|
title: title,
|
|
15
21
|
extensionType: manifest.type,
|
|
@@ -20,7 +20,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
|
|
|
20
20
|
var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
|
|
21
21
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
22
22
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
23
|
-
var packageVersion = "118.
|
|
23
|
+
var packageVersion = "118.12.0";
|
|
24
24
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
25
25
|
// Remove URL as it has UGC
|
|
26
26
|
// Ignored via go/ees007
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { memo } from 'react';
|
|
2
2
|
import { createPortal } from 'react-dom';
|
|
3
3
|
import { isSSR } from '../core-utils/is-ssr';
|
|
4
|
-
import { isSSRStreaming } from '../core-utils/is-ssr-streaming';
|
|
5
4
|
import { PortalRenderWrapperInner } from './PortalRenderWrapperInner';
|
|
6
5
|
var PortalRenderWrapper = /*#__PURE__*/memo(PortalRenderWrapperInner);
|
|
7
6
|
PortalRenderWrapper.displayName = 'PortalRenderWrapper';
|
|
@@ -39,7 +38,7 @@ export var getPortalProviderAPI = function getPortalProviderAPI(portalManager) {
|
|
|
39
38
|
return {
|
|
40
39
|
render: function render(children, container, key, onBeforeReactDomRender) {
|
|
41
40
|
var immediate = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
42
|
-
if (isSSR()
|
|
41
|
+
if (isSSR()) {
|
|
43
42
|
var html = '';
|
|
44
43
|
try {
|
|
45
44
|
var renderToStaticMarkup = getRenderToStaticMarkup();
|
|
@@ -72,7 +71,7 @@ export var getPortalProviderAPI = function getPortalProviderAPI(portalManager) {
|
|
|
72
71
|
},
|
|
73
72
|
remove: function remove(key) {
|
|
74
73
|
var _portalsMap$get;
|
|
75
|
-
if (isSSR()
|
|
74
|
+
if (isSSR()) {
|
|
76
75
|
return;
|
|
77
76
|
}
|
|
78
77
|
(_portalsMap$get = portalsMap.get(key)) === null || _portalsMap$get === void 0 || _portalsMap$get();
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
3
|
import { isSSR } from '../core-utils/is-ssr';
|
|
4
|
-
import { isSSRStreaming } from '../core-utils/is-ssr-streaming';
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* A component that serves as a placeholder for the content DOM of a ProseMirror NodeView.
|
|
@@ -10,6 +9,6 @@ import { isSSRStreaming } from '../core-utils/is-ssr-streaming';
|
|
|
10
9
|
export var NodeViewContentHole = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
11
10
|
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
12
11
|
ref: ref,
|
|
13
|
-
"data-ssr-content-dom-ref": isSSR()
|
|
12
|
+
"data-ssr-content-dom-ref": isSSR() ? '' : undefined
|
|
14
13
|
}));
|
|
15
14
|
});
|
|
@@ -7,7 +7,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../analytics';
|
|
10
|
-
import { isSSR
|
|
10
|
+
import { isSSR } from '../core-utils';
|
|
11
11
|
import { createDispatch } from '../event-dispatcher';
|
|
12
12
|
import { ErrorBoundary } from '../ui/ErrorBoundary';
|
|
13
13
|
import { getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered } from '../utils';
|
|
@@ -99,7 +99,7 @@ var ReactNodeView = /*#__PURE__*/function () {
|
|
|
99
99
|
// contentDOMWrapper that was appended above. The React ref callback
|
|
100
100
|
// (forwardRef) never fires in renderToStaticMarkup, so contentDOM is
|
|
101
101
|
// left detached. Re-attach it by finding the marked SSR ref target.
|
|
102
|
-
if (isSSR() &&
|
|
102
|
+
if (isSSR() && this.domRef) {
|
|
103
103
|
var refTarget = this.domRef.querySelector('[data-ssr-content-dom-ref]');
|
|
104
104
|
if (refTarget) {
|
|
105
105
|
this.handleRef(refTarget);
|
|
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
21
21
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
22
22
|
import Layer from '../Layer';
|
|
23
23
|
var packageName = "@atlaskit/editor-common";
|
|
24
|
-
var packageVersion = "118.
|
|
24
|
+
var packageVersion = "118.12.0";
|
|
25
25
|
var halfFocusRing = 1;
|
|
26
26
|
var dropOffset = '0, 8';
|
|
27
27
|
var fadeIn = keyframes({
|
|
@@ -8,10 +8,12 @@ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstruct
|
|
|
8
8
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
9
|
/* eslint-disable @repo/internal/react/no-class-components */
|
|
10
10
|
import React, { PureComponent } from 'react';
|
|
11
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
11
12
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
13
|
import { ProviderFactory, WithProviders } from '../../provider-factory';
|
|
13
|
-
import { MentionWithProviders } from './mention-with-providers';
|
|
14
|
+
import { MentionWithAvatarProviders, MentionWithProviders } from './mention-with-providers';
|
|
14
15
|
var MENTION_PROVIDERS = ['mentionProvider', 'profilecardProvider'];
|
|
16
|
+
var GENERIC_MENTION_IDS = ['HipChat', 'all', 'here'];
|
|
15
17
|
var Mention = /*#__PURE__*/function (_PureComponent) {
|
|
16
18
|
function Mention(props) {
|
|
17
19
|
var _this;
|
|
@@ -26,9 +28,26 @@ var Mention = /*#__PURE__*/function (_PureComponent) {
|
|
|
26
28
|
localId = _this$props.localId,
|
|
27
29
|
userType = _this$props.userType,
|
|
28
30
|
isDisabled = _this$props.isDisabled,
|
|
29
|
-
disabledTooltip = _this$props.disabledTooltip
|
|
31
|
+
disabledTooltip = _this$props.disabledTooltip,
|
|
32
|
+
mentionNodeDataProvider = _this$props.mentionNodeDataProvider;
|
|
30
33
|
var mentionProvider = providers.mentionProvider,
|
|
31
34
|
profilecardProvider = providers.profilecardProvider;
|
|
35
|
+
var isAvatarEnabled = Boolean(mentionNodeDataProvider) && userType !== 'SPECIAL' && !GENERIC_MENTION_IDS.includes(id) && isExperimentEnabled('platform_editor_mention_node_avatar');
|
|
36
|
+
if (isAvatarEnabled && mentionNodeDataProvider) {
|
|
37
|
+
return /*#__PURE__*/React.createElement(MentionWithAvatarProviders, {
|
|
38
|
+
id: id,
|
|
39
|
+
text: text,
|
|
40
|
+
accessLevel: accessLevel,
|
|
41
|
+
localId: localId,
|
|
42
|
+
userType: userType,
|
|
43
|
+
isDisabled: isDisabled,
|
|
44
|
+
disabledTooltip: disabledTooltip,
|
|
45
|
+
eventHandlers: eventHandlers,
|
|
46
|
+
mentionProvider: mentionProvider,
|
|
47
|
+
mentionNodeDataProvider: mentionNodeDataProvider,
|
|
48
|
+
profilecardProvider: profilecardProvider
|
|
49
|
+
});
|
|
50
|
+
}
|
|
32
51
|
return /*#__PURE__*/React.createElement(MentionWithProviders, {
|
|
33
52
|
id: id,
|
|
34
53
|
text: text,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -37,11 +37,15 @@ export default function MentionWithProfileCard(_ref) {
|
|
|
37
37
|
id = _ref.id,
|
|
38
38
|
text = _ref.text,
|
|
39
39
|
accessLevel = _ref.accessLevel,
|
|
40
|
+
appType = _ref.appType,
|
|
41
|
+
avatarUrl = _ref.avatarUrl,
|
|
42
|
+
isAvatarImagePreShaped = _ref.isAvatarImagePreShaped,
|
|
40
43
|
mentionProvider = _ref.mentionProvider,
|
|
41
44
|
profilecardProvider = _ref.profilecardProvider,
|
|
42
45
|
onClick = _ref.onClick,
|
|
43
46
|
onMouseEnter = _ref.onMouseEnter,
|
|
44
47
|
onMouseLeave = _ref.onMouseLeave,
|
|
48
|
+
renderAvatarSlot = _ref.renderAvatarSlot,
|
|
45
49
|
localId = _ref.localId,
|
|
46
50
|
ssrPlaceholderId = _ref.ssrPlaceholderId,
|
|
47
51
|
userType = _ref.userType;
|
|
@@ -55,11 +59,15 @@ export default function MentionWithProfileCard(_ref) {
|
|
|
55
59
|
id: id,
|
|
56
60
|
text: text,
|
|
57
61
|
accessLevel: accessLevel,
|
|
62
|
+
appType: appType,
|
|
63
|
+
avatarUrl: avatarUrl,
|
|
64
|
+
isAvatarImagePreShaped: isAvatarImagePreShaped,
|
|
58
65
|
localId: localId,
|
|
59
66
|
mentionProvider: mentionProvider,
|
|
60
67
|
onClick: onClick,
|
|
61
68
|
onMouseEnter: onMouseEnter,
|
|
62
69
|
onMouseLeave: onMouseLeave,
|
|
70
|
+
renderAvatarSlot: renderAvatarSlot,
|
|
63
71
|
ssrPlaceholderId: ssrPlaceholderId
|
|
64
72
|
});
|
|
65
73
|
|
|
@@ -1,23 +1,73 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
1
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
|
|
4
|
+
var _excluded = ["id", "mentionNodeDataProvider", "userType"];
|
|
5
|
+
import React, { useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
3
6
|
import { ResourcedMention } from '@atlaskit/mention/element';
|
|
4
7
|
import ResourcedMentionWithProfilecard from './mention-with-profilecard';
|
|
5
8
|
var GENERIC_USER_IDS = ['HipChat', 'all', 'here'];
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
id = _ref.id,
|
|
11
|
-
isDisabled = _ref.isDisabled,
|
|
12
|
-
mentionProvider = _ref.mentionProvider,
|
|
13
|
-
profilecardProviderResolver = _ref.profilecardProvider,
|
|
14
|
-
text = _ref.text,
|
|
15
|
-
localId = _ref.localId,
|
|
9
|
+
var useMentionNodeData = function useMentionNodeData(_ref) {
|
|
10
|
+
var _state$data;
|
|
11
|
+
var id = _ref.id,
|
|
12
|
+
mentionNodeDataProvider = _ref.mentionNodeDataProvider,
|
|
16
13
|
userType = _ref.userType;
|
|
17
|
-
var
|
|
14
|
+
var mention = useMemo(function () {
|
|
15
|
+
return {
|
|
16
|
+
id: id,
|
|
17
|
+
userType: userType
|
|
18
|
+
};
|
|
19
|
+
}, [id, userType]);
|
|
20
|
+
var mentionKey = "".concat(userType !== null && userType !== void 0 ? userType : 'DEFAULT', ":").concat(id);
|
|
21
|
+
var synchronousData = useMemo(function () {
|
|
22
|
+
return mentionNodeDataProvider.getMentionDataFromCache(mention);
|
|
23
|
+
}, [mention, mentionNodeDataProvider]);
|
|
24
|
+
var _useState = useState(function () {
|
|
25
|
+
return {
|
|
26
|
+
data: synchronousData,
|
|
27
|
+
key: mentionKey
|
|
28
|
+
};
|
|
29
|
+
}),
|
|
18
30
|
_useState2 = _slicedToArray(_useState, 2),
|
|
19
|
-
|
|
20
|
-
|
|
31
|
+
state = _useState2[0],
|
|
32
|
+
setState = _useState2[1];
|
|
33
|
+
var data = state.key === mentionKey ? (_state$data = state.data) !== null && _state$data !== void 0 ? _state$data : synchronousData : synchronousData;
|
|
34
|
+
useEffect(function () {
|
|
35
|
+
if (synchronousData) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
var isActive = true;
|
|
39
|
+
mentionNodeDataProvider.getMentionData(mention, function (payload) {
|
|
40
|
+
if (isActive && payload.data) {
|
|
41
|
+
setState({
|
|
42
|
+
data: payload.data,
|
|
43
|
+
key: mentionKey
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
return function () {
|
|
48
|
+
isActive = false;
|
|
49
|
+
};
|
|
50
|
+
}, [mention, mentionKey, mentionNodeDataProvider, synchronousData]);
|
|
51
|
+
return data;
|
|
52
|
+
};
|
|
53
|
+
export var MentionWithProviders = /*#__PURE__*/React.memo(function (_ref2) {
|
|
54
|
+
var accessLevel = _ref2.accessLevel,
|
|
55
|
+
disabledTooltip = _ref2.disabledTooltip,
|
|
56
|
+
eventHandlers = _ref2.eventHandlers,
|
|
57
|
+
id = _ref2.id,
|
|
58
|
+
isDisabled = _ref2.isDisabled,
|
|
59
|
+
mentionNodeData = _ref2.mentionNodeData,
|
|
60
|
+
mentionProvider = _ref2.mentionProvider,
|
|
61
|
+
profilecardProviderResolver = _ref2.profilecardProvider,
|
|
62
|
+
_ref2$renderAvatarSlo = _ref2.renderAvatarSlot,
|
|
63
|
+
renderAvatarSlot = _ref2$renderAvatarSlo === void 0 ? false : _ref2$renderAvatarSlo,
|
|
64
|
+
text = _ref2.text,
|
|
65
|
+
localId = _ref2.localId,
|
|
66
|
+
userType = _ref2.userType;
|
|
67
|
+
var _useState3 = useState(null),
|
|
68
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
69
|
+
profilecardProvider = _useState4[0],
|
|
70
|
+
setProfilecardProvider = _useState4[1];
|
|
21
71
|
var mountedRef = useRef(true);
|
|
22
72
|
useLayoutEffect(function () {
|
|
23
73
|
mountedRef.current = true;
|
|
@@ -52,11 +102,15 @@ export var MentionWithProviders = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
52
102
|
accessLevel: accessLevel,
|
|
53
103
|
localId: localId,
|
|
54
104
|
mentionProvider: mentionProvider,
|
|
105
|
+
appType: mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.appType,
|
|
106
|
+
avatarUrl: mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.avatarUrl,
|
|
107
|
+
isAvatarImagePreShaped: mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.isAvatarImagePreShaped,
|
|
55
108
|
isDisabled: true,
|
|
56
109
|
disabledTooltip: disabledTooltip,
|
|
57
110
|
onClick: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onClick,
|
|
58
111
|
onMouseEnter: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseEnter,
|
|
59
112
|
onMouseLeave: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseLeave,
|
|
113
|
+
renderAvatarSlot: renderAvatarSlot,
|
|
60
114
|
ssrPlaceholderId: ssrPlaceholderId
|
|
61
115
|
});
|
|
62
116
|
}
|
|
@@ -66,7 +120,10 @@ export var MentionWithProviders = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
66
120
|
accessLevel: accessLevel,
|
|
67
121
|
localId: localId,
|
|
68
122
|
userType: userType,
|
|
69
|
-
mentionProvider: mentionProvider
|
|
123
|
+
mentionProvider: mentionProvider,
|
|
124
|
+
appType: mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.appType,
|
|
125
|
+
avatarUrl: mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.avatarUrl,
|
|
126
|
+
isAvatarImagePreShaped: mentionNodeData === null || mentionNodeData === void 0 ? void 0 : mentionNodeData.isAvatarImagePreShaped
|
|
70
127
|
// Ignored via go/ees005
|
|
71
128
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
72
129
|
,
|
|
@@ -74,6 +131,26 @@ export var MentionWithProviders = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
74
131
|
onClick: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onClick,
|
|
75
132
|
onMouseEnter: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseEnter,
|
|
76
133
|
onMouseLeave: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseLeave,
|
|
134
|
+
renderAvatarSlot: renderAvatarSlot,
|
|
77
135
|
ssrPlaceholderId: ssrPlaceholderId
|
|
78
136
|
});
|
|
137
|
+
});
|
|
138
|
+
export var MentionWithAvatarProviders = /*#__PURE__*/React.memo(function (_ref3) {
|
|
139
|
+
var id = _ref3.id,
|
|
140
|
+
mentionNodeDataProvider = _ref3.mentionNodeDataProvider,
|
|
141
|
+
userType = _ref3.userType,
|
|
142
|
+
props = _objectWithoutProperties(_ref3, _excluded);
|
|
143
|
+
var mentionNodeData = useMentionNodeData({
|
|
144
|
+
id: id,
|
|
145
|
+
mentionNodeDataProvider: mentionNodeDataProvider,
|
|
146
|
+
userType: userType
|
|
147
|
+
});
|
|
148
|
+
return /*#__PURE__*/React.createElement(MentionWithProviders
|
|
149
|
+
// eslint-disable-next-line react/jsx-props-no-spreading -- The treatment adds only resolved avatar data to the existing mention props.
|
|
150
|
+
, _extends({}, props, {
|
|
151
|
+
id: id,
|
|
152
|
+
mentionNodeData: mentionNodeData,
|
|
153
|
+
renderAvatarSlot: true,
|
|
154
|
+
userType: userType
|
|
155
|
+
}));
|
|
79
156
|
});
|
|
@@ -1,41 +1,22 @@
|
|
|
1
1
|
import type { ACTION, ACTION_SUBJECT } from './enums';
|
|
2
2
|
import type { OperationalAEP } from './utils';
|
|
3
|
-
type CategoryInformation = {
|
|
4
|
-
|
|
3
|
+
export type CategoryInformation = {
|
|
4
|
+
internalMacroCount: number;
|
|
5
|
+
internalAppCount: number;
|
|
6
|
+
internalAppMacroMax: number;
|
|
7
|
+
ecosystemMacroCount: number;
|
|
8
|
+
ecosystemAppCount: number;
|
|
9
|
+
ecosystemAppMacroMax: number;
|
|
10
|
+
allMacroCount: number;
|
|
11
|
+
allAppCount: number;
|
|
12
|
+
allAppMacroMax: number;
|
|
5
13
|
};
|
|
14
|
+
export type CategoryKey = 'blockTemplates' | 'dataAndCharts' | 'embed' | 'media' | 'other' | 'rovo' | 'structure' | 'textFormatting';
|
|
15
|
+
export type LegacyCategoryKey = 'admin' | 'ai' | 'block-templates' | 'communication' | 'confluence-content' | 'data-and-charts' | 'development' | 'embed' | 'external-content' | 'formatting' | 'media' | 'navigation' | 'other' | 'reporting' | 'skills' | 'structure' | 'text-formatting' | 'uncategorized' | 'visuals';
|
|
6
16
|
export type QuickInsertInformationAttributes = {
|
|
7
|
-
category:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
embed: CategoryInformation;
|
|
11
|
-
media: CategoryInformation;
|
|
12
|
-
other: CategoryInformation;
|
|
13
|
-
rovo: CategoryInformation;
|
|
14
|
-
structure: CategoryInformation;
|
|
15
|
-
textFormatting: CategoryInformation;
|
|
16
|
-
};
|
|
17
|
-
legacyCategory: {
|
|
18
|
-
admin: CategoryInformation;
|
|
19
|
-
ai: CategoryInformation;
|
|
20
|
-
'block-templates': CategoryInformation;
|
|
21
|
-
communication: CategoryInformation;
|
|
22
|
-
'confluence-content': CategoryInformation;
|
|
23
|
-
'data-and-charts': CategoryInformation;
|
|
24
|
-
development: CategoryInformation;
|
|
25
|
-
embed: CategoryInformation;
|
|
26
|
-
'external-content': CategoryInformation;
|
|
27
|
-
formatting: CategoryInformation;
|
|
28
|
-
media: CategoryInformation;
|
|
29
|
-
navigation: CategoryInformation;
|
|
30
|
-
other: CategoryInformation;
|
|
31
|
-
reporting: CategoryInformation;
|
|
32
|
-
skills: CategoryInformation;
|
|
33
|
-
structure: CategoryInformation;
|
|
34
|
-
'text-formatting': CategoryInformation;
|
|
35
|
-
uncategorized: CategoryInformation;
|
|
36
|
-
visuals: CategoryInformation;
|
|
37
|
-
};
|
|
17
|
+
category: Record<CategoryKey, CategoryInformation>;
|
|
18
|
+
legacyCategory: Record<LegacyCategoryKey, CategoryInformation>;
|
|
19
|
+
allCategories: CategoryInformation;
|
|
38
20
|
};
|
|
39
21
|
export type QuickInsertInformationAEP = OperationalAEP<ACTION.QUICK_INSERT_INFORMATION, ACTION_SUBJECT.QUICK_INSERT, undefined, QuickInsertInformationAttributes>;
|
|
40
22
|
export type QuickInsertInformationEventPayload = QuickInsertInformationAEP;
|
|
41
|
-
export {};
|
|
@@ -67,6 +67,20 @@ export interface AgentRemoteEditReviewData {
|
|
|
67
67
|
* waiting for the idle debounce. `false`/absent ⇒ rely on the debounce.
|
|
68
68
|
*/
|
|
69
69
|
complete?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Whether the local client is the one that requested this agent edit, resolved by
|
|
72
|
+
* matching `actorUserId` against the local collab participant's AAID.
|
|
73
|
+
*
|
|
74
|
+
* Agent steps are broadcast to every collaborator, so anything that must happen
|
|
75
|
+
* exactly once per edit (notably acceptance-rate analytics) has to run on a single
|
|
76
|
+
* client. `false` when the local user is not the requester, and also when either AAID
|
|
77
|
+
* is unavailable: an unattributable batch would otherwise emit one event per connected
|
|
78
|
+
* client, and silently inflating a metric is worse than a known gap.
|
|
79
|
+
*
|
|
80
|
+
* Optional so producers predating this field stay valid; `undefined` is treated as
|
|
81
|
+
* "not the requester", keeping the fail-closed behaviour.
|
|
82
|
+
*/
|
|
83
|
+
isLocalUserRequester?: boolean;
|
|
70
84
|
/**
|
|
71
85
|
* The coarse reviewable segments derived from the batch — one per edited
|
|
72
86
|
* top-level region, with closed whole-node slices. Appended verbatim to
|
|
@@ -26,8 +26,16 @@ export type ExtensionModuleActionObject<T extends Parameters = Parameters> = {
|
|
|
26
26
|
export type MaybeADFEntity = MaybeESModule<ADFEntity | Array<ADFEntity> | void>;
|
|
27
27
|
export type ExtensionModuleActionHandler = (extensionAPI: ExtensionAPI) => Promise<MaybeADFEntity>;
|
|
28
28
|
export type ExtensionModuleAction<T extends Parameters = Parameters> = ExtensionModuleActionObject<T> | ExtensionModuleActionHandler;
|
|
29
|
+
/** Identifies the app contributing an extension manifest or module. */
|
|
30
|
+
export type ExtensionApp = {
|
|
31
|
+
/** Stable, non-localized key shared by every extension contributed by the app. */
|
|
32
|
+
key: string;
|
|
33
|
+
/** Provenance of the extension contribution. Omit when provenance cannot be determined. */
|
|
34
|
+
source?: 'internal' | 'ecosystem';
|
|
35
|
+
};
|
|
29
36
|
export type ExtensionModule<T extends Parameters = Parameters> = {
|
|
30
37
|
action: ExtensionModuleAction<T>;
|
|
38
|
+
app?: ExtensionApp;
|
|
31
39
|
categories?: string[];
|
|
32
40
|
description?: string;
|
|
33
41
|
featured?: boolean;
|
|
@@ -103,6 +111,7 @@ export type ExtensionDeprecationStatus = {
|
|
|
103
111
|
message?: string | React.ReactNode;
|
|
104
112
|
};
|
|
105
113
|
export type ExtensionManifest<T extends Parameters = Parameters> = {
|
|
114
|
+
app?: ExtensionApp;
|
|
106
115
|
autoConvert?: {
|
|
107
116
|
matchers: Array<AutoConvertMatches>;
|
|
108
117
|
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { ADFEntity } from '@atlaskit/adf-utils/types';
|
|
3
|
-
import type { ExtensionKey, ExtensionModuleActionHandler, ExtensionType, Icon } from './extension-manifest';
|
|
3
|
+
import type { ExtensionApp, ExtensionKey, ExtensionModuleActionHandler, ExtensionType, Icon } from './extension-manifest';
|
|
4
4
|
export type MenuItem = {
|
|
5
|
+
app?: ExtensionApp;
|
|
5
6
|
categories: string[];
|
|
6
7
|
description?: string;
|
|
7
8
|
documentationUrl?: string;
|
package/dist/types/mention.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { default as Mention } from './ui/Mention';
|
|
2
|
+
export type { MentionNodeDataCallback, MentionNodeDataIdentifier, MentionNodeDataProvider, MentionNodeDataUserType, } from './ui/Mention/mention-node-data-provider';
|
|
2
3
|
export { MentionSharedCssClassName } from './styles/shared/mention';
|
|
3
4
|
export { default as MentionWithProfileCard } from './ui/Mention/mention-with-profilecard';
|
|
@@ -2,6 +2,7 @@ import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
|
2
2
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { RegisterMenuItem } from '@atlaskit/editor-ui-control-model/types';
|
|
4
4
|
import type { INPUT_METHOD } from '../analytics/types/enums';
|
|
5
|
+
import type { ExtensionApp } from '../extensions/types/extension-manifest';
|
|
5
6
|
import type { TypeAheadItem } from '../types/type-ahead';
|
|
6
7
|
export type QuickInsertActionInsert = (node?: Node | Record<string, any> | string, opts?: {
|
|
7
8
|
selectInlineNode?: boolean;
|
|
@@ -16,6 +17,8 @@ export type QuickInsertItem = TypeAheadItem & {
|
|
|
16
17
|
* @see packages/editor/editor-core/src/plugins/insert-block/ui/ToolbarInsertBlock/index.tsx for details
|
|
17
18
|
*/
|
|
18
19
|
action: (insert: QuickInsertActionInsert, state: EditorState, source?: INPUT_METHOD.TOOLBAR | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.ELEMENT_BROWSER) => Transaction | false;
|
|
20
|
+
/** App contributing this item. */
|
|
21
|
+
app?: ExtensionApp;
|
|
19
22
|
/** categories where to find the item */
|
|
20
23
|
categories?: Array<string>;
|
|
21
24
|
/** indicates if the item will be highlighted where appropriate (plus menu for now) */
|
|
@@ -3,6 +3,7 @@ import type { MentionUserType } from '@atlaskit/adf-schema';
|
|
|
3
3
|
import { ProviderFactory } from '../../provider-factory';
|
|
4
4
|
import type { ProfilecardProvider } from '../../provider-factory/profile-card-provider';
|
|
5
5
|
import type { MentionEventHandlers } from '../EventHandlers';
|
|
6
|
+
import type { MentionNodeDataProvider } from './mention-node-data-provider';
|
|
6
7
|
export interface MentionProps {
|
|
7
8
|
accessLevel?: string;
|
|
8
9
|
disabledTooltip?: string;
|
|
@@ -10,6 +11,7 @@ export interface MentionProps {
|
|
|
10
11
|
id: string;
|
|
11
12
|
isDisabled?: boolean;
|
|
12
13
|
localId?: string;
|
|
14
|
+
mentionNodeDataProvider?: MentionNodeDataProvider;
|
|
13
15
|
providers?: ProviderFactory;
|
|
14
16
|
text: string;
|
|
15
17
|
userType?: MentionUserType;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { MentionUserType } from '@atlaskit/adf-schema/mention';
|
|
2
|
+
import type { MentionNodeData } from '@atlaskit/mention/types';
|
|
3
|
+
export type MentionNodeDataCallback = (payload: {
|
|
4
|
+
data: MentionNodeData;
|
|
5
|
+
error?: undefined;
|
|
6
|
+
} | {
|
|
7
|
+
data?: undefined;
|
|
8
|
+
error: Error;
|
|
9
|
+
}) => void;
|
|
10
|
+
/** `AGENT` is emitted by editor agent sources at runtime but is not serialized as an ADF user type. */
|
|
11
|
+
export type MentionNodeDataUserType = MentionUserType | 'AGENT';
|
|
12
|
+
export interface MentionNodeDataIdentifier {
|
|
13
|
+
id: string;
|
|
14
|
+
userType?: MentionNodeDataUserType;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Product-facing bridge between mention data resolution and mention UI.
|
|
18
|
+
*
|
|
19
|
+
* Create one provider per renderer or editor instance and pass it through the
|
|
20
|
+
* renderer props or mentions plugin options. `getMentionDataFromCache` is used
|
|
21
|
+
* during render, including SSR, so it must never start a network request.
|
|
22
|
+
* Deterministic products may return data from it synchronously; network-backed
|
|
23
|
+
* products should return cached data or `undefined`, then resolve through
|
|
24
|
+
* `getMentionData` on the client.
|
|
25
|
+
*
|
|
26
|
+
* The UI depends only on these mention-specific methods to avoid a package
|
|
27
|
+
* cycle with the reusable implementation in editor-plugin-mentions.
|
|
28
|
+
*/
|
|
29
|
+
export interface MentionNodeDataProvider {
|
|
30
|
+
getMentionData: (mention: MentionNodeDataIdentifier, callback: MentionNodeDataCallback) => void;
|
|
31
|
+
getMentionDataFromCache: (mention: MentionNodeDataIdentifier) => MentionNodeData | undefined;
|
|
32
|
+
}
|