@atlaskit/editor-common 102.2.1 → 102.3.1
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 +25 -0
- package/dist/cjs/analytics/types/enums.js +1 -0
- package/dist/cjs/extensibility/Extension/Extension/index.js +26 -0
- package/dist/cjs/extensions/module-helpers.js +31 -14
- package/dist/cjs/keymaps/index.js +3 -2
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/Mention/index.js +13 -1
- package/dist/cjs/ui/Mention/mention-with-providers.js +105 -2
- package/dist/es2019/analytics/types/enums.js +1 -0
- package/dist/es2019/extensibility/Extension/Extension/index.js +27 -1
- package/dist/es2019/extensions/module-helpers.js +24 -5
- package/dist/es2019/keymaps/index.js +1 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/Mention/index.js +14 -2
- package/dist/es2019/ui/Mention/mention-with-providers.js +83 -2
- package/dist/esm/analytics/types/enums.js +1 -0
- package/dist/esm/extensibility/Extension/Extension/index.js +27 -1
- package/dist/esm/extensions/module-helpers.js +31 -14
- package/dist/esm/keymaps/index.js +1 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/Mention/index.js +14 -2
- package/dist/esm/ui/Mention/mention-with-providers.js +105 -2
- package/dist/types/analytics/types/enums.d.ts +1 -0
- package/dist/types/analytics/types/selection-events.d.ts +5 -1
- package/dist/types/extensions/module-helpers.d.ts +2 -2
- package/dist/types/extensions/types/extension-manifest-toolbar-item.d.ts +3 -1
- package/dist/types/extensions/types/extension-manifest.d.ts +1 -1
- package/dist/types/keymaps/index.d.ts +1 -0
- package/dist/types/types/floating-toolbar.d.ts +2 -1
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/ui/Mention/mention-with-providers.d.ts +8 -1
- package/dist/types/ui-menu/ColorPickerButton/index.d.ts +1 -1
- package/dist/types-ts4.5/analytics/types/enums.d.ts +1 -0
- package/dist/types-ts4.5/analytics/types/selection-events.d.ts +5 -1
- package/dist/types-ts4.5/extensions/module-helpers.d.ts +2 -2
- package/dist/types-ts4.5/extensions/types/extension-manifest-toolbar-item.d.ts +3 -1
- package/dist/types-ts4.5/extensions/types/extension-manifest.d.ts +1 -1
- package/dist/types-ts4.5/keymaps/index.d.ts +1 -0
- package/dist/types-ts4.5/types/floating-toolbar.d.ts +2 -1
- package/dist/types-ts4.5/types/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/Mention/mention-with-providers.d.ts +8 -1
- package/dist/types-ts4.5/ui-menu/ColorPickerButton/index.d.ts +1 -1
- package/package.json +9 -3
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
|
+
import React, { PureComponent, useLayoutEffect, useRef, useState } from 'react';
|
|
2
4
|
import { ResourcedMention } from '@atlaskit/mention/element';
|
|
3
5
|
import ResourcedMentionWithProfilecard from './mention-with-profilecard';
|
|
4
6
|
const GENERIC_USER_IDS = ['HipChat', 'all', 'here'];
|
|
7
|
+
const noop = () => {};
|
|
5
8
|
export const MentionWithProviders = ({
|
|
6
9
|
accessLevel,
|
|
7
10
|
eventHandlers,
|
|
@@ -49,4 +52,82 @@ export const MentionWithProviders = ({
|
|
|
49
52
|
onMouseEnter: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseEnter,
|
|
50
53
|
onMouseLeave: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseLeave
|
|
51
54
|
});
|
|
52
|
-
};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
58
|
+
export class MentionWithProvidersOld extends PureComponent {
|
|
59
|
+
constructor(...args) {
|
|
60
|
+
super(...args);
|
|
61
|
+
_defineProperty(this, "state", {
|
|
62
|
+
profilecardProvider: null
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
// Ignored via go/ees005
|
|
66
|
+
// eslint-disable-next-line react/no-unsafe
|
|
67
|
+
UNSAFE_componentWillMount() {
|
|
68
|
+
this.updateProfilecardProvider(this.props);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Ignored via go/ees005
|
|
72
|
+
// eslint-disable-next-line react/no-unsafe
|
|
73
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
74
|
+
if (nextProps.profilecardProvider !== this.props.profilecardProvider) {
|
|
75
|
+
this.updateProfilecardProvider(nextProps);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
updateProfilecardProvider(props) {
|
|
79
|
+
// We are not using async/await here to avoid having an intermediate Promise
|
|
80
|
+
// introduced by the transpiler.
|
|
81
|
+
// This will allow consumer to use a SynchronousPromise.resolve and avoid useless
|
|
82
|
+
// rerendering
|
|
83
|
+
if (props.profilecardProvider) {
|
|
84
|
+
props.profilecardProvider.then(profilecardProvider => {
|
|
85
|
+
this.setState({
|
|
86
|
+
profilecardProvider
|
|
87
|
+
});
|
|
88
|
+
}).catch(() => {
|
|
89
|
+
this.setState({
|
|
90
|
+
profilecardProvider: null
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
} else {
|
|
94
|
+
this.setState({
|
|
95
|
+
profilecardProvider: null
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
render() {
|
|
100
|
+
const {
|
|
101
|
+
accessLevel,
|
|
102
|
+
eventHandlers,
|
|
103
|
+
id,
|
|
104
|
+
mentionProvider,
|
|
105
|
+
text,
|
|
106
|
+
localId
|
|
107
|
+
} = this.props;
|
|
108
|
+
const {
|
|
109
|
+
profilecardProvider
|
|
110
|
+
} = this.state;
|
|
111
|
+
|
|
112
|
+
// Ignored via go/ees005
|
|
113
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
114
|
+
const actionHandlers = {};
|
|
115
|
+
['onClick', 'onMouseEnter', 'onMouseLeave'].forEach(handler => {
|
|
116
|
+
actionHandlers[handler] = eventHandlers && eventHandlers[handler] || noop;
|
|
117
|
+
});
|
|
118
|
+
const MentionComponent = profilecardProvider && GENERIC_USER_IDS.indexOf(id) === -1 ? ResourcedMentionWithProfilecard : ResourcedMention;
|
|
119
|
+
return /*#__PURE__*/React.createElement(MentionComponent, _extends({
|
|
120
|
+
id: id,
|
|
121
|
+
text: text,
|
|
122
|
+
accessLevel: accessLevel,
|
|
123
|
+
localId: localId,
|
|
124
|
+
mentionProvider: mentionProvider
|
|
125
|
+
// Ignored via go/ees005
|
|
126
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
127
|
+
,
|
|
128
|
+
profilecardProvider: profilecardProvider
|
|
129
|
+
// Ignored via go/ees005
|
|
130
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
131
|
+
}, actionHandlers));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -94,6 +94,7 @@ export var ACTION = /*#__PURE__*/function (ACTION) {
|
|
|
94
94
|
ACTION["RESOLVED"] = "resolved";
|
|
95
95
|
ACTION["REQUEST_TO_EDIT"] = "requestToEdit";
|
|
96
96
|
ACTION["SELECTED"] = "selected";
|
|
97
|
+
ACTION["SELECT_ALL"] = "selectAll";
|
|
97
98
|
ACTION["SHOWN"] = "shown";
|
|
98
99
|
ACTION["SLOW_INPUT"] = "slowInput";
|
|
99
100
|
ACTION["STARTED"] = "started";
|
|
@@ -9,12 +9,13 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
9
9
|
* @jsx jsx
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import React, { Fragment } from 'react';
|
|
12
|
+
import React, { Fragment, useEffect } from 'react';
|
|
13
13
|
|
|
14
14
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
15
15
|
import { jsx } from '@emotion/react';
|
|
16
16
|
import classnames from 'classnames';
|
|
17
17
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
18
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
18
19
|
import { useSharedPluginState } from '../../../hooks';
|
|
19
20
|
import { overflowShadow } from '../../../ui';
|
|
20
21
|
import { calculateBreakoutStyles } from '../../../utils';
|
|
@@ -117,6 +118,30 @@ function ExtensionWithPluginState(props) {
|
|
|
117
118
|
setIsNodeHovered(didHover);
|
|
118
119
|
}
|
|
119
120
|
};
|
|
121
|
+
var shouldFireNbmExperimentExposure = React.useMemo(function () {
|
|
122
|
+
if (node.type.name === 'extension' && typeof getPos === 'function') {
|
|
123
|
+
var pos = getPos();
|
|
124
|
+
if (!isNaN(pos)) {
|
|
125
|
+
var _view$state$doc$resol;
|
|
126
|
+
var parentNameType = (_view$state$doc$resol = view.state.doc.resolve(pos).parent) === null || _view$state$doc$resol === void 0 || (_view$state$doc$resol = _view$state$doc$resol.type) === null || _view$state$doc$resol === void 0 ? void 0 : _view$state$doc$resol.name;
|
|
127
|
+
if (['listItem', 'nestedExpand', 'blockquote', 'panel'].includes(parentNameType)) {
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return false;
|
|
133
|
+
}, [node, getPos, view]);
|
|
134
|
+
useEffect(function () {
|
|
135
|
+
if (shouldFireNbmExperimentExposure) {
|
|
136
|
+
// No-op editorExperiment evaluation to track usage of nested non-bodied macros
|
|
137
|
+
// these can't be tracked at the point of diversion of the experience because that is a toggle of the
|
|
138
|
+
// ProseMirror schema nodes for listItems, nestedExpand, blockquote, and panel. At that point the customer
|
|
139
|
+
// has not yet been exposed
|
|
140
|
+
editorExperiment('platform_editor_nested_non_bodied_macros', 'test', {
|
|
141
|
+
exposure: true
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}, [shouldFireNbmExperimentExposure]);
|
|
120
145
|
return jsx(Fragment, null, showMacroInteractionDesignUpdates && !isLivePageViewMode && jsx(ExtensionLozenge, {
|
|
121
146
|
isNodeSelected: isNodeSelected,
|
|
122
147
|
isNodeHovered: isNodeHovered,
|
|
@@ -199,6 +224,7 @@ var Extension = function Extension(props) {
|
|
|
199
224
|
var pluginInjectionApi = props.pluginInjectionApi;
|
|
200
225
|
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['width']),
|
|
201
226
|
widthState = _useSharedPluginState.widthState;
|
|
227
|
+
|
|
202
228
|
// Ignored via go/ees005
|
|
203
229
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
204
230
|
return jsx(ExtensionWithPluginState, _extends({
|
|
@@ -7,6 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
7
7
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
8
8
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
9
9
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
11
|
import { buildAction } from './manifest-helpers';
|
|
11
12
|
export var groupBy = function groupBy(arr, attr, keyRenamer) {
|
|
12
13
|
return (
|
|
@@ -154,21 +155,21 @@ var logError = function logError(msg) {
|
|
|
154
155
|
// eslint-disable-next-line no-console
|
|
155
156
|
(_console = console).error.apply(_console, [msg].concat(args));
|
|
156
157
|
};
|
|
157
|
-
var toolbarItemToButtonConfig = function toolbarItemToButtonConfig(
|
|
158
|
-
var tooltip =
|
|
159
|
-
tooltipStyle =
|
|
160
|
-
key =
|
|
161
|
-
label =
|
|
162
|
-
ariaLabel =
|
|
163
|
-
icon =
|
|
164
|
-
action =
|
|
165
|
-
disabled =
|
|
158
|
+
var toolbarItemToButtonConfig = function toolbarItemToButtonConfig(toolbarButton, parentKey) {
|
|
159
|
+
var tooltip = toolbarButton.tooltip,
|
|
160
|
+
tooltipStyle = toolbarButton.tooltipStyle,
|
|
161
|
+
key = toolbarButton.key,
|
|
162
|
+
label = toolbarButton.label,
|
|
163
|
+
ariaLabel = toolbarButton.ariaLabel,
|
|
164
|
+
icon = toolbarButton.icon,
|
|
165
|
+
action = toolbarButton.action,
|
|
166
|
+
disabled = toolbarButton.disabled;
|
|
166
167
|
var itemKey = [parentKey, key].join(':');
|
|
167
168
|
if (typeof action !== 'function') {
|
|
168
169
|
logError("Provided action is not a function for extension toolbar button: ".concat(label, " (").concat(itemKey, ")"));
|
|
169
170
|
}
|
|
170
171
|
var labelAndIcon = {};
|
|
171
|
-
switch (
|
|
172
|
+
switch (toolbarButton.display) {
|
|
172
173
|
case 'icon':
|
|
173
174
|
if (!icon) {
|
|
174
175
|
logError("icon should be provided for extension toolbar button (".concat(itemKey, "), when display is set to 'icon'"));
|
|
@@ -244,9 +245,16 @@ export var getContextualToolbarItemsFromModule = function getContextualToolbarIt
|
|
|
244
245
|
return toolbarItems;
|
|
245
246
|
}
|
|
246
247
|
return [];
|
|
247
|
-
}).flatMap(function (
|
|
248
|
-
return
|
|
249
|
-
|
|
248
|
+
}).flatMap(function (toolbarItems) {
|
|
249
|
+
return toolbarItems.map(function (toolbarItem) {
|
|
250
|
+
if (fg('forge_macro_autoconvert')) {
|
|
251
|
+
if (isToolbarButton(toolbarItem)) {
|
|
252
|
+
return toolbarItemToButtonConfig(toolbarItem, extension.key);
|
|
253
|
+
}
|
|
254
|
+
return toolbarItem;
|
|
255
|
+
} else {
|
|
256
|
+
return toolbarItemToButtonConfig(toolbarItem, extension.key);
|
|
257
|
+
}
|
|
250
258
|
});
|
|
251
259
|
});
|
|
252
260
|
}
|
|
@@ -255,6 +263,12 @@ export var getContextualToolbarItemsFromModule = function getContextualToolbarIt
|
|
|
255
263
|
return extensionToolbarButtons;
|
|
256
264
|
});
|
|
257
265
|
};
|
|
266
|
+
var isToolbarButton = function isToolbarButton(toolbarItem) {
|
|
267
|
+
if ('type' in toolbarItem) {
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
270
|
+
return true;
|
|
271
|
+
};
|
|
258
272
|
|
|
259
273
|
// defines whether to add toolbar item for the given node
|
|
260
274
|
function shouldAddExtensionItemForNode(item, node) {
|
|
@@ -270,11 +284,14 @@ function shouldAddExtensionItemForNode(item, node) {
|
|
|
270
284
|
|
|
271
285
|
// in cases where we need custom exclusion depending on the node
|
|
272
286
|
if (item.context.shouldExclude) {
|
|
273
|
-
|
|
287
|
+
if (item.context.shouldExclude(node)) {
|
|
288
|
+
return false;
|
|
289
|
+
}
|
|
274
290
|
}
|
|
275
291
|
var _item$context = item.context,
|
|
276
292
|
extensionType = _item$context.extensionType,
|
|
277
293
|
extensionKey = _item$context.extensionKey;
|
|
294
|
+
|
|
278
295
|
// if extension type is given - should match extension type
|
|
279
296
|
if (extensionType && extensionType !== ((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.extensionType)) {
|
|
280
297
|
return false;
|
|
@@ -94,6 +94,7 @@ export var toggleTaskItemCheckbox = makeKeyMapWithCommon('Toggles task item', 'M
|
|
|
94
94
|
export var selectRow = makeKeyMapArrayWithCommon('Select row', ['Mod-Alt-Shift-ArrowLeft', 'Mod-Alt-Shift-ArrowRight']);
|
|
95
95
|
export var selectColumn = makeKeyMapArrayWithCommon('Select column', ['Mod-Alt-Shift-ArrowDown', 'Mod-Alt-Shift-ArrowUp']);
|
|
96
96
|
export var selectTable = makeKeyMapWithCommon('Select table', 'Mod-a');
|
|
97
|
+
export var selectNode = makeKeyMapWithCommon('Select node', 'Mod-a');
|
|
97
98
|
export var increaseMediaSize = makeKeyMapWithCommon('increase image size', 'Mod-Alt-]');
|
|
98
99
|
export var decreaseMediaSize = makeKeyMapWithCommon('increase image size', 'Mod-Alt-[');
|
|
99
100
|
export var activateVideoControls = makeKeyMapWithCommon('Activate controls panel on video', 'Shift-F10');
|
|
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
7
7
|
import { isFedRamp } from './environment';
|
|
8
8
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
9
9
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
10
|
-
var packageVersion = "102.
|
|
10
|
+
var packageVersion = "102.3.1";
|
|
11
11
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
12
12
|
// Remove URL as it has UGC
|
|
13
13
|
// Ignored via go/ees007
|
|
@@ -20,7 +20,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
20
20
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
21
21
|
import Layer from '../Layer';
|
|
22
22
|
var packageName = "@atlaskit/editor-common";
|
|
23
|
-
var packageVersion = "102.
|
|
23
|
+
var packageVersion = "102.3.1";
|
|
24
24
|
var halfFocusRing = 1;
|
|
25
25
|
var dropOffset = '0, 8';
|
|
26
26
|
// Ignored via go/ees005
|
|
@@ -8,8 +8,9 @@ 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 { fg } from '@atlaskit/platform-feature-flags';
|
|
11
12
|
import { ProviderFactory, WithProviders } from '../../provider-factory';
|
|
12
|
-
import { MentionWithProviders } from './mention-with-providers';
|
|
13
|
+
import { MentionWithProviders, MentionWithProvidersOld } from './mention-with-providers';
|
|
13
14
|
var Mention = /*#__PURE__*/function (_PureComponent) {
|
|
14
15
|
function Mention(props) {
|
|
15
16
|
var _this;
|
|
@@ -24,7 +25,18 @@ var Mention = /*#__PURE__*/function (_PureComponent) {
|
|
|
24
25
|
localId = _this$props.localId;
|
|
25
26
|
var mentionProvider = providers.mentionProvider,
|
|
26
27
|
profilecardProvider = providers.profilecardProvider;
|
|
27
|
-
|
|
28
|
+
if (fg('platform_editor_react18_mention_with_provider_fix')) {
|
|
29
|
+
return /*#__PURE__*/React.createElement(MentionWithProviders, {
|
|
30
|
+
id: id,
|
|
31
|
+
text: text,
|
|
32
|
+
accessLevel: accessLevel,
|
|
33
|
+
localId: localId,
|
|
34
|
+
eventHandlers: eventHandlers,
|
|
35
|
+
mentionProvider: mentionProvider,
|
|
36
|
+
profilecardProvider: profilecardProvider
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return /*#__PURE__*/React.createElement(MentionWithProvidersOld, {
|
|
28
40
|
id: id,
|
|
29
41
|
text: text,
|
|
30
42
|
accessLevel: accessLevel,
|
|
@@ -1,8 +1,18 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
1
8
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
|
|
9
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
10
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
|
+
import React, { PureComponent, useLayoutEffect, useRef, useState } from 'react';
|
|
3
12
|
import { ResourcedMention } from '@atlaskit/mention/element';
|
|
4
13
|
import ResourcedMentionWithProfilecard from './mention-with-profilecard';
|
|
5
14
|
var GENERIC_USER_IDS = ['HipChat', 'all', 'here'];
|
|
15
|
+
var noop = function noop() {};
|
|
6
16
|
export var MentionWithProviders = function MentionWithProviders(_ref) {
|
|
7
17
|
var accessLevel = _ref.accessLevel,
|
|
8
18
|
eventHandlers = _ref.eventHandlers,
|
|
@@ -52,4 +62,97 @@ export var MentionWithProviders = function MentionWithProviders(_ref) {
|
|
|
52
62
|
onMouseEnter: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseEnter,
|
|
53
63
|
onMouseLeave: eventHandlers === null || eventHandlers === void 0 ? void 0 : eventHandlers.onMouseLeave
|
|
54
64
|
});
|
|
55
|
-
};
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// eslint-disable-next-line @repo/internal/react/no-class-components
|
|
68
|
+
export var MentionWithProvidersOld = /*#__PURE__*/function (_PureComponent) {
|
|
69
|
+
function MentionWithProvidersOld() {
|
|
70
|
+
var _this;
|
|
71
|
+
_classCallCheck(this, MentionWithProvidersOld);
|
|
72
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
73
|
+
args[_key] = arguments[_key];
|
|
74
|
+
}
|
|
75
|
+
_this = _callSuper(this, MentionWithProvidersOld, [].concat(args));
|
|
76
|
+
_defineProperty(_this, "state", {
|
|
77
|
+
profilecardProvider: null
|
|
78
|
+
});
|
|
79
|
+
return _this;
|
|
80
|
+
}
|
|
81
|
+
_inherits(MentionWithProvidersOld, _PureComponent);
|
|
82
|
+
return _createClass(MentionWithProvidersOld, [{
|
|
83
|
+
key: "UNSAFE_componentWillMount",
|
|
84
|
+
value:
|
|
85
|
+
// Ignored via go/ees005
|
|
86
|
+
// eslint-disable-next-line react/no-unsafe
|
|
87
|
+
function UNSAFE_componentWillMount() {
|
|
88
|
+
this.updateProfilecardProvider(this.props);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// Ignored via go/ees005
|
|
92
|
+
// eslint-disable-next-line react/no-unsafe
|
|
93
|
+
}, {
|
|
94
|
+
key: "UNSAFE_componentWillReceiveProps",
|
|
95
|
+
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
96
|
+
if (nextProps.profilecardProvider !== this.props.profilecardProvider) {
|
|
97
|
+
this.updateProfilecardProvider(nextProps);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}, {
|
|
101
|
+
key: "updateProfilecardProvider",
|
|
102
|
+
value: function updateProfilecardProvider(props) {
|
|
103
|
+
var _this2 = this;
|
|
104
|
+
// We are not using async/await here to avoid having an intermediate Promise
|
|
105
|
+
// introduced by the transpiler.
|
|
106
|
+
// This will allow consumer to use a SynchronousPromise.resolve and avoid useless
|
|
107
|
+
// rerendering
|
|
108
|
+
if (props.profilecardProvider) {
|
|
109
|
+
props.profilecardProvider.then(function (profilecardProvider) {
|
|
110
|
+
_this2.setState({
|
|
111
|
+
profilecardProvider: profilecardProvider
|
|
112
|
+
});
|
|
113
|
+
}).catch(function () {
|
|
114
|
+
_this2.setState({
|
|
115
|
+
profilecardProvider: null
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
} else {
|
|
119
|
+
this.setState({
|
|
120
|
+
profilecardProvider: null
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}, {
|
|
125
|
+
key: "render",
|
|
126
|
+
value: function render() {
|
|
127
|
+
var _this$props = this.props,
|
|
128
|
+
accessLevel = _this$props.accessLevel,
|
|
129
|
+
eventHandlers = _this$props.eventHandlers,
|
|
130
|
+
id = _this$props.id,
|
|
131
|
+
mentionProvider = _this$props.mentionProvider,
|
|
132
|
+
text = _this$props.text,
|
|
133
|
+
localId = _this$props.localId;
|
|
134
|
+
var profilecardProvider = this.state.profilecardProvider;
|
|
135
|
+
|
|
136
|
+
// Ignored via go/ees005
|
|
137
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
138
|
+
var actionHandlers = {};
|
|
139
|
+
['onClick', 'onMouseEnter', 'onMouseLeave'].forEach(function (handler) {
|
|
140
|
+
actionHandlers[handler] = eventHandlers && eventHandlers[handler] || noop;
|
|
141
|
+
});
|
|
142
|
+
var MentionComponent = profilecardProvider && GENERIC_USER_IDS.indexOf(id) === -1 ? ResourcedMentionWithProfilecard : ResourcedMention;
|
|
143
|
+
return /*#__PURE__*/React.createElement(MentionComponent, _extends({
|
|
144
|
+
id: id,
|
|
145
|
+
text: text,
|
|
146
|
+
accessLevel: accessLevel,
|
|
147
|
+
localId: localId,
|
|
148
|
+
mentionProvider: mentionProvider
|
|
149
|
+
// Ignored via go/ees005
|
|
150
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
151
|
+
,
|
|
152
|
+
profilecardProvider: profilecardProvider
|
|
153
|
+
// Ignored via go/ees005
|
|
154
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
155
|
+
}, actionHandlers));
|
|
156
|
+
}
|
|
157
|
+
}]);
|
|
158
|
+
}(PureComponent);
|
|
@@ -17,5 +17,9 @@ export type SelectCellAEP = SelectAEP<ACTION_SUBJECT_ID.CELL, {
|
|
|
17
17
|
export type SelectTableAEP = SelectAEP<ACTION_SUBJECT_ID.TABLE, {
|
|
18
18
|
localId: string;
|
|
19
19
|
}>;
|
|
20
|
-
export type
|
|
20
|
+
export type SelectAllNodeAEP = TrackAEP<ACTION.SELECT_ALL, ACTION_SUBJECT.DOCUMENT, ACTION_SUBJECT_ID.ALL, {
|
|
21
|
+
followedBy?: string;
|
|
22
|
+
fromDepth?: number;
|
|
23
|
+
}, undefined>;
|
|
24
|
+
export type SelectionEventPayload = SelectNodeAEP | SelectRangeAEP | SelectAllAEP | SelectAllNodeAEP | SelectCellAEP | SelectTableAEP;
|
|
21
25
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ADFEntity } from '@atlaskit/adf-utils/types';
|
|
2
2
|
import type { ExtensionAPI } from './types/extension-handler';
|
|
3
3
|
import type { ExtensionAutoConvertHandler, ExtensionManifest, ExtensionModule } from './types/extension-manifest';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ExtensionToolbarItem } from './types/extension-manifest-toolbar-item';
|
|
5
5
|
import type { Parameters } from './types/extension-parameters';
|
|
6
6
|
import type { ExtensionProvider } from './types/extension-provider';
|
|
7
7
|
import type { MenuItem } from './types/utils';
|
|
@@ -13,4 +13,4 @@ export declare const getQuickInsertItemsFromModule: <T extends Parameters>(exten
|
|
|
13
13
|
export declare function getAutoConvertPatternsFromModule<T extends Parameters>(extensions: ExtensionManifest<T>[]): Promise<ExtensionAutoConvertHandler[]>;
|
|
14
14
|
export declare const createAutoConverterRunner: (autoConvertHandlers: ExtensionAutoConvertHandler[]) => ExtensionAutoConvertHandler;
|
|
15
15
|
export declare function getExtensionAutoConvertersFromProvider(extensionProviderPromise: Promise<ExtensionProvider>): Promise<ExtensionAutoConvertHandler>;
|
|
16
|
-
export declare const getContextualToolbarItemsFromModule: (extensions: ExtensionManifest[], node: ADFEntity, api: ExtensionAPI) =>
|
|
16
|
+
export declare const getContextualToolbarItemsFromModule: (extensions: ExtensionManifest[], node: ADFEntity, api: ExtensionAPI) => ExtensionToolbarItem[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ADFEntity } from '@atlaskit/adf-utils/types';
|
|
3
|
+
import type { Command, FloatingToolbarDropdown, FloatingToolbarItem } from '../../types';
|
|
3
4
|
import type { ExtensionAPI } from './extension-handler';
|
|
4
5
|
import type { ExtensionIconModule } from './extension-manifest-common';
|
|
5
6
|
export type ToolbarButtonAction = (contextNode: ADFEntity, api: ExtensionAPI) => Promise<void>;
|
|
@@ -19,7 +20,7 @@ export type ToolbarButton = ExtensionModuleToolbarButtonLabelOrIcon & {
|
|
|
19
20
|
display?: 'icon' | 'label' | 'icon-and-label';
|
|
20
21
|
disabled?: boolean;
|
|
21
22
|
};
|
|
22
|
-
export type ToolbarItem = ToolbarButton
|
|
23
|
+
export type ToolbarItem = ToolbarButton | FloatingToolbarItem<Command>;
|
|
23
24
|
export type ToolbarContext = ExtensionNodeContext | StandardNodeContext;
|
|
24
25
|
export type ContextualToolbar = {
|
|
25
26
|
context: ToolbarContext;
|
|
@@ -44,6 +45,7 @@ export type StandardNodeContext = {
|
|
|
44
45
|
type: 'node';
|
|
45
46
|
nodeType: 'table';
|
|
46
47
|
};
|
|
48
|
+
export type ExtensionToolbarItem = ExtensionToolbarButton | FloatingToolbarDropdown<Command>;
|
|
47
49
|
export type ExtensionToolbarButton = {
|
|
48
50
|
key: string;
|
|
49
51
|
label?: string;
|
|
@@ -101,7 +101,7 @@ export type ExtensionManifest<T extends Parameters = Parameters> = {
|
|
|
101
101
|
};
|
|
102
102
|
modules: ExtensionModules<T>;
|
|
103
103
|
autoConvert?: {
|
|
104
|
-
|
|
104
|
+
matchers: Array<AutoConvertMatches>;
|
|
105
105
|
};
|
|
106
106
|
};
|
|
107
107
|
export type Icon = () => ExtensionIconModule;
|
|
@@ -89,6 +89,7 @@ export declare const toggleTaskItemCheckbox: Keymap;
|
|
|
89
89
|
export declare const selectRow: Keymap[];
|
|
90
90
|
export declare const selectColumn: Keymap[];
|
|
91
91
|
export declare const selectTable: Keymap;
|
|
92
|
+
export declare const selectNode: Keymap;
|
|
92
93
|
export declare const increaseMediaSize: Keymap;
|
|
93
94
|
export declare const decreaseMediaSize: Keymap;
|
|
94
95
|
export declare const activateVideoControls: Keymap;
|
|
@@ -240,6 +240,7 @@ export type FloatingToolbarSeparator = {
|
|
|
240
240
|
fullHeight?: boolean;
|
|
241
241
|
supportsViewMode?: boolean;
|
|
242
242
|
};
|
|
243
|
+
export type ExtensionDropdownOptions = () => DropdownOptions<Function>;
|
|
243
244
|
export type FloatingToolbarDropdown<T extends Object> = {
|
|
244
245
|
testId?: string;
|
|
245
246
|
id?: string;
|
|
@@ -250,7 +251,7 @@ export type FloatingToolbarDropdown<T extends Object> = {
|
|
|
250
251
|
* Places an icon before the title as a representation
|
|
251
252
|
*/
|
|
252
253
|
iconBefore?: Icon;
|
|
253
|
-
options: DropdownOptions<T
|
|
254
|
+
options: DropdownOptions<T> | ExtensionDropdownOptions;
|
|
254
255
|
hidden?: boolean;
|
|
255
256
|
hideExpandIcon?: boolean;
|
|
256
257
|
disabled?: boolean;
|
|
@@ -13,7 +13,7 @@ export type { FeatureFlags, FeatureFlagKey, GetEditorFeatureFlags } from './feat
|
|
|
13
13
|
export type { Browsers, Range, DisableSpellcheckByBrowser } from './supported-browsers';
|
|
14
14
|
export type { EditorContainerWidth, GetEditorContainerWidth } from './editor-container-width';
|
|
15
15
|
export type { EmptyStateHandler, EmptyStateHandlerParams } from './empty-state-handler';
|
|
16
|
-
export type { RenderOptionsPropsT, DropdownOptionT, DropdownOptions, SelectOption, ButtonAppearance, Icon, RenderOptionsProps, AlignType, ConfirmDialogChildInfo, ConfirmDialogOptions, ConfirmationDialogProps, FloatingToolbarButton, FloatingToolbarCopyButton, FloatingToolbarInput, FloatingToolbarCustom, FloatingToolbarListPicker, FloatingToolbarColorPicker, FloatingToolbarEmojiPicker, FloatingToolbarDatePicker, FloatingToolbarSelect, FloatingToolbarSeparator, FloatingToolbarDropdown, FloatingToolbarFallbackItem, FloatingToolbarItem, FloatingToolbarConfig, FloatingToolbarHandler, FloatingToolbarButtonSpotlightConfig, typeOption, FloatingToolbarOverflowDropdownOptions, } from './floating-toolbar';
|
|
16
|
+
export type { RenderOptionsPropsT, DropdownOptionT, DropdownOptions, ExtensionDropdownOptions, SelectOption, ButtonAppearance, Icon, RenderOptionsProps, AlignType, ConfirmDialogChildInfo, ConfirmDialogOptions, ConfirmationDialogProps, FloatingToolbarButton, FloatingToolbarCopyButton, FloatingToolbarInput, FloatingToolbarCustom, FloatingToolbarListPicker, FloatingToolbarColorPicker, FloatingToolbarEmojiPicker, FloatingToolbarDatePicker, FloatingToolbarSelect, FloatingToolbarSeparator, FloatingToolbarDropdown, FloatingToolbarFallbackItem, FloatingToolbarItem, FloatingToolbarConfig, FloatingToolbarHandler, FloatingToolbarButtonSpotlightConfig, typeOption, FloatingToolbarOverflowDropdownOptions, } from './floating-toolbar';
|
|
17
17
|
export type { MarkOptions, NodeOptions } from './copy-button';
|
|
18
18
|
export type { ContextPanelHandler } from './context-panel';
|
|
19
19
|
export type { EditorAppearance } from './editor-appearance';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { PureComponent } from 'react';
|
|
2
2
|
import type { MentionProvider } from '@atlaskit/mention/resource';
|
|
3
3
|
import type { ProfilecardProvider } from '../../provider-factory/profile-card-provider';
|
|
4
4
|
import type { MentionEventHandlers } from '../EventHandlers';
|
|
@@ -15,3 +15,10 @@ export interface State {
|
|
|
15
15
|
profilecardProvider: ProfilecardProvider | null;
|
|
16
16
|
}
|
|
17
17
|
export declare const MentionWithProviders: ({ accessLevel, eventHandlers, id, mentionProvider, profilecardProvider: profilecardProviderResolver, text, localId, }: Props) => React.JSX.Element;
|
|
18
|
+
export declare class MentionWithProvidersOld extends PureComponent<Props, State> {
|
|
19
|
+
state: State;
|
|
20
|
+
UNSAFE_componentWillMount(): void;
|
|
21
|
+
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
22
|
+
private updateProfilecardProvider;
|
|
23
|
+
render(): React.JSX.Element;
|
|
24
|
+
}
|
|
@@ -14,7 +14,7 @@ declare const _default: React.ForwardRefExoticComponent<Omit<Omit<{
|
|
|
14
14
|
colorPalette: PaletteColor[];
|
|
15
15
|
placement: string;
|
|
16
16
|
cols?: number | undefined;
|
|
17
|
-
alignX?: "
|
|
17
|
+
alignX?: "end" | "left" | "right" | "center" | undefined;
|
|
18
18
|
size?: {
|
|
19
19
|
width: string;
|
|
20
20
|
height: string;
|
|
@@ -17,5 +17,9 @@ export type SelectCellAEP = SelectAEP<ACTION_SUBJECT_ID.CELL, {
|
|
|
17
17
|
export type SelectTableAEP = SelectAEP<ACTION_SUBJECT_ID.TABLE, {
|
|
18
18
|
localId: string;
|
|
19
19
|
}>;
|
|
20
|
-
export type
|
|
20
|
+
export type SelectAllNodeAEP = TrackAEP<ACTION.SELECT_ALL, ACTION_SUBJECT.DOCUMENT, ACTION_SUBJECT_ID.ALL, {
|
|
21
|
+
followedBy?: string;
|
|
22
|
+
fromDepth?: number;
|
|
23
|
+
}, undefined>;
|
|
24
|
+
export type SelectionEventPayload = SelectNodeAEP | SelectRangeAEP | SelectAllAEP | SelectAllNodeAEP | SelectCellAEP | SelectTableAEP;
|
|
21
25
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ADFEntity } from '@atlaskit/adf-utils/types';
|
|
2
2
|
import type { ExtensionAPI } from './types/extension-handler';
|
|
3
3
|
import type { ExtensionAutoConvertHandler, ExtensionManifest, ExtensionModule } from './types/extension-manifest';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ExtensionToolbarItem } from './types/extension-manifest-toolbar-item';
|
|
5
5
|
import type { Parameters } from './types/extension-parameters';
|
|
6
6
|
import type { ExtensionProvider } from './types/extension-provider';
|
|
7
7
|
import type { MenuItem } from './types/utils';
|
|
@@ -13,4 +13,4 @@ export declare const getQuickInsertItemsFromModule: <T extends Parameters>(exten
|
|
|
13
13
|
export declare function getAutoConvertPatternsFromModule<T extends Parameters>(extensions: ExtensionManifest<T>[]): Promise<ExtensionAutoConvertHandler[]>;
|
|
14
14
|
export declare const createAutoConverterRunner: (autoConvertHandlers: ExtensionAutoConvertHandler[]) => ExtensionAutoConvertHandler;
|
|
15
15
|
export declare function getExtensionAutoConvertersFromProvider(extensionProviderPromise: Promise<ExtensionProvider>): Promise<ExtensionAutoConvertHandler>;
|
|
16
|
-
export declare const getContextualToolbarItemsFromModule: (extensions: ExtensionManifest[], node: ADFEntity, api: ExtensionAPI) =>
|
|
16
|
+
export declare const getContextualToolbarItemsFromModule: (extensions: ExtensionManifest[], node: ADFEntity, api: ExtensionAPI) => ExtensionToolbarItem[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ADFEntity } from '@atlaskit/adf-utils/types';
|
|
3
|
+
import type { Command, FloatingToolbarDropdown, FloatingToolbarItem } from '../../types';
|
|
3
4
|
import type { ExtensionAPI } from './extension-handler';
|
|
4
5
|
import type { ExtensionIconModule } from './extension-manifest-common';
|
|
5
6
|
export type ToolbarButtonAction = (contextNode: ADFEntity, api: ExtensionAPI) => Promise<void>;
|
|
@@ -19,7 +20,7 @@ export type ToolbarButton = ExtensionModuleToolbarButtonLabelOrIcon & {
|
|
|
19
20
|
display?: 'icon' | 'label' | 'icon-and-label';
|
|
20
21
|
disabled?: boolean;
|
|
21
22
|
};
|
|
22
|
-
export type ToolbarItem = ToolbarButton
|
|
23
|
+
export type ToolbarItem = ToolbarButton | FloatingToolbarItem<Command>;
|
|
23
24
|
export type ToolbarContext = ExtensionNodeContext | StandardNodeContext;
|
|
24
25
|
export type ContextualToolbar = {
|
|
25
26
|
context: ToolbarContext;
|
|
@@ -44,6 +45,7 @@ export type StandardNodeContext = {
|
|
|
44
45
|
type: 'node';
|
|
45
46
|
nodeType: 'table';
|
|
46
47
|
};
|
|
48
|
+
export type ExtensionToolbarItem = ExtensionToolbarButton | FloatingToolbarDropdown<Command>;
|
|
47
49
|
export type ExtensionToolbarButton = {
|
|
48
50
|
key: string;
|
|
49
51
|
label?: string;
|
|
@@ -101,7 +101,7 @@ export type ExtensionManifest<T extends Parameters = Parameters> = {
|
|
|
101
101
|
};
|
|
102
102
|
modules: ExtensionModules<T>;
|
|
103
103
|
autoConvert?: {
|
|
104
|
-
|
|
104
|
+
matchers: Array<AutoConvertMatches>;
|
|
105
105
|
};
|
|
106
106
|
};
|
|
107
107
|
export type Icon = () => ExtensionIconModule;
|