@atlaskit/editor-plugin-mentions 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/cjs/nodeviews/mention.js +19 -26
- package/dist/cjs/type-ahead/index.js +4 -2
- package/dist/cjs/ui/Mention/index.js +59 -69
- package/dist/es2019/nodeviews/mention.js +20 -30
- package/dist/es2019/type-ahead/index.js +4 -2
- package/dist/es2019/ui/Mention/index.js +53 -46
- package/dist/esm/nodeviews/mention.js +20 -27
- package/dist/esm/type-ahead/index.js +4 -2
- package/dist/esm/ui/Mention/index.js +61 -72
- package/dist/types/nodeviews/mention.d.ts +1 -1
- package/dist/types/pm-plugins/main.d.ts +2 -1
- package/dist/types/types.d.ts +2 -0
- package/dist/types/ui/Mention/index.d.ts +11 -12
- package/dist/types-ts4.5/nodeviews/mention.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/main.d.ts +2 -1
- package/dist/types-ts4.5/types.d.ts +2 -0
- package/dist/types-ts4.5/ui/Mention/index.d.ts +11 -12
- package/package.json +12 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-mentions
|
|
2
2
|
|
|
3
|
+
## 1.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#98647](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/98647)
|
|
8
|
+
[`19eb20751225`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/19eb20751225) -
|
|
9
|
+
[ux] [ED-23248] -
|
|
10
|
+
|
|
11
|
+
**@atlaskit/editor-core**: Added optional profilecardProvider to Mention plugin in universal
|
|
12
|
+
composable editor **@atlaskit/editor-plugin-mentions**: Made mentions render with profile cards
|
|
13
|
+
on click if the feature flag: `platform.editor.mentions-in-editor-popup-on-click` is turned on
|
|
14
|
+
|
|
15
|
+
## 1.2.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#101524](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/101524)
|
|
20
|
+
[`4821570088e6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4821570088e6) -
|
|
21
|
+
ED-23362 Bump ADF schema to version 36.8.1 and add support for adf validation and transformation
|
|
22
|
+
|
|
3
23
|
## 1.2.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
|
@@ -17,11 +17,9 @@ var _Mention = _interopRequireDefault(require("../ui/Mention"));
|
|
|
17
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
18
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
19
19
|
var UNKNOWN_USER_ID = '_|unknown|_';
|
|
20
|
-
var
|
|
20
|
+
var useResolvedName = function useResolvedName(_ref) {
|
|
21
21
|
var id = _ref.id,
|
|
22
22
|
text = _ref.text,
|
|
23
|
-
providers = _ref.providers,
|
|
24
|
-
accessLevel = _ref.accessLevel,
|
|
25
23
|
mentionProvider = _ref.mentionProvider;
|
|
26
24
|
var _useState = (0, _react.useState)(text),
|
|
27
25
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -78,33 +76,28 @@ var MentionAssistiveTextComponent = function MentionAssistiveTextComponent(_ref)
|
|
|
78
76
|
});
|
|
79
77
|
}
|
|
80
78
|
}, [id, text, mentionProvider]);
|
|
81
|
-
return
|
|
82
|
-
id: id,
|
|
83
|
-
text: resolvedName,
|
|
84
|
-
accessLevel: accessLevel,
|
|
85
|
-
providers: providers
|
|
86
|
-
})));
|
|
79
|
+
return resolvedName;
|
|
87
80
|
};
|
|
88
81
|
var MentionNodeView = exports.MentionNodeView = function MentionNodeView(props) {
|
|
89
|
-
var
|
|
82
|
+
var _props$options;
|
|
90
83
|
var _props$node$attrs = props.node.attrs,
|
|
91
84
|
id = _props$node$attrs.id,
|
|
92
85
|
text = _props$node$attrs.text,
|
|
93
|
-
accessLevel = _props$node$attrs.accessLevel
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
providers: providerFactory,
|
|
102
|
-
accessLevel: accessLevel
|
|
103
|
-
});
|
|
104
|
-
};
|
|
105
|
-
return /*#__PURE__*/_react.default.createElement(_providerFactory.WithProviders, {
|
|
106
|
-
providers: ['mentionProvider', 'profilecardProvider'],
|
|
107
|
-
providerFactory: providerFactory,
|
|
108
|
-
renderNode: renderAssistiveTextWithProviders
|
|
86
|
+
accessLevel = _props$node$attrs.accessLevel,
|
|
87
|
+
localId = _props$node$attrs.localId;
|
|
88
|
+
var mentionProvider = (0, _providerFactory.useProvider)('mentionProvider');
|
|
89
|
+
var profilecardProvider = (_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.profilecardProvider;
|
|
90
|
+
var resolvedName = useResolvedName({
|
|
91
|
+
id: id,
|
|
92
|
+
text: text,
|
|
93
|
+
mentionProvider: mentionProvider
|
|
109
94
|
});
|
|
95
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement(_Mention.default, {
|
|
96
|
+
id: id,
|
|
97
|
+
text: resolvedName,
|
|
98
|
+
accessLevel: accessLevel,
|
|
99
|
+
mentionProvider: mentionProvider,
|
|
100
|
+
profilecardProvider: profilecardProvider,
|
|
101
|
+
localId: localId
|
|
102
|
+
})));
|
|
110
103
|
};
|
|
@@ -178,7 +178,8 @@ var buildNodesForTeamMention = function buildNodesForTeamMention(schema, selecte
|
|
|
178
178
|
text: text,
|
|
179
179
|
id: member.id,
|
|
180
180
|
accessLevel: accessLevel,
|
|
181
|
-
userType: 'DEFAULT'
|
|
181
|
+
userType: 'DEFAULT',
|
|
182
|
+
localId: (0, _uuid.default)()
|
|
182
183
|
});
|
|
183
184
|
inlineNodes.push(userMentionNode);
|
|
184
185
|
// should not add empty space after the last user mention.
|
|
@@ -332,7 +333,8 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
332
333
|
text: text,
|
|
333
334
|
id: id,
|
|
334
335
|
accessLevel: accessLevel,
|
|
335
|
-
userType: userType === 'DEFAULT' ? null : userType
|
|
336
|
+
userType: userType === 'DEFAULT' ? null : userType,
|
|
337
|
+
localId: (0, _uuid.default)()
|
|
336
338
|
});
|
|
337
339
|
var space = schema.text(' ');
|
|
338
340
|
return insert(_model.Fragment.from([mentionNode, space]));
|
|
@@ -7,21 +7,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
-
var
|
|
11
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
12
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
13
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
14
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
15
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
16
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
18
|
-
var
|
|
12
|
+
var _mention = require("@atlaskit/editor-common/mention");
|
|
19
13
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
20
14
|
var _element = require("@atlaskit/mention/element");
|
|
15
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
21
16
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
22
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
23
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
24
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
25
18
|
// Workaround for a firefox issue where dom selection is off sync
|
|
26
19
|
// https://product-fabric.atlassian.net/browse/ED-12442
|
|
27
20
|
var refreshBrowserSelection = function refreshBrowserSelection() {
|
|
@@ -34,65 +27,62 @@ var refreshBrowserSelection = function refreshBrowserSelection() {
|
|
|
34
27
|
}
|
|
35
28
|
}
|
|
36
29
|
};
|
|
37
|
-
var Mention =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
30
|
+
var Mention = function Mention(props) {
|
|
31
|
+
var accessLevel = props.accessLevel,
|
|
32
|
+
eventHandlers = props.eventHandlers,
|
|
33
|
+
id = props.id,
|
|
34
|
+
text = props.text,
|
|
35
|
+
localId = props.localId,
|
|
36
|
+
mentionProvider = props.mentionProvider,
|
|
37
|
+
profilecardProviderPromise = props.profilecardProvider;
|
|
38
|
+
var _useState = (0, _react.useState)(null),
|
|
39
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
40
|
+
profilecardProvider = _useState2[0],
|
|
41
|
+
setProfilecardProvider = _useState2[1];
|
|
42
|
+
|
|
43
|
+
// Resolve the profilecard provider
|
|
44
|
+
(0, _react.useEffect)(function () {
|
|
45
|
+
if (profilecardProviderPromise) {
|
|
46
|
+
profilecardProviderPromise.then(function (profilecardProvider) {
|
|
47
|
+
setProfilecardProvider(profilecardProvider);
|
|
48
|
+
}).catch(function () {
|
|
49
|
+
setProfilecardProvider(null);
|
|
55
50
|
});
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
text: text,
|
|
59
|
-
accessLevel: accessLevel,
|
|
60
|
-
mentionProvider: mentionProvider
|
|
61
|
-
}, actionHandlers));
|
|
62
|
-
});
|
|
63
|
-
_this.providerFactory = props.providers || new _providerFactory.ProviderFactory();
|
|
64
|
-
return _this;
|
|
65
|
-
}
|
|
66
|
-
(0, _createClass2.default)(Mention, [{
|
|
67
|
-
key: "componentDidMount",
|
|
68
|
-
value: function componentDidMount() {
|
|
69
|
-
// Workaround an issue where the selection is not updated immediately after adding
|
|
70
|
-
// a mention when "sanitizePrivateContent" is enabled in the editor on safari.
|
|
71
|
-
// This affects both insertion and paste behaviour it is applied to the component.
|
|
72
|
-
// https://product-fabric.atlassian.net/browse/ED-14859
|
|
73
|
-
if (_utils.browser.safari) {
|
|
74
|
-
setTimeout(refreshBrowserSelection, 0);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}, {
|
|
78
|
-
key: "componentWillUnmount",
|
|
79
|
-
value: function componentWillUnmount() {
|
|
80
|
-
if (!this.props.providers) {
|
|
81
|
-
// new ProviderFactory is created if no `providers` has been set
|
|
82
|
-
// in this case when component is unmounted it's safe to destroy this providerFactory
|
|
83
|
-
this.providerFactory.destroy();
|
|
84
|
-
}
|
|
51
|
+
} else {
|
|
52
|
+
setProfilecardProvider(null);
|
|
85
53
|
}
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
54
|
+
}, [profilecardProviderPromise]);
|
|
55
|
+
(0, _react.useEffect)(function () {
|
|
56
|
+
// Workaround an issue where the selection is not updated immediately after adding
|
|
57
|
+
// a mention when "sanitizePrivateContent" is enabled in the editor on safari.
|
|
58
|
+
// This affects both insertion and paste behaviour it is applied to the component.
|
|
59
|
+
// https://product-fabric.atlassian.net/browse/ED-14859
|
|
60
|
+
if (_utils.browser.safari) {
|
|
61
|
+
setTimeout(refreshBrowserSelection, 0);
|
|
94
62
|
}
|
|
95
|
-
}]);
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
63
|
+
}, []);
|
|
64
|
+
var actionHandlers = {};
|
|
65
|
+
['onClick', 'onMouseEnter', 'onMouseLeave'].forEach(function (handler) {
|
|
66
|
+
actionHandlers[handler] = eventHandlers && eventHandlers[handler] || function () {};
|
|
67
|
+
});
|
|
68
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.mentions-in-editor-popup-on-click') && profilecardProvider) {
|
|
69
|
+
return /*#__PURE__*/_react.default.createElement(_mention.MentionWithProfileCard, (0, _extends2.default)({
|
|
70
|
+
id: id,
|
|
71
|
+
text: text,
|
|
72
|
+
accessLevel: accessLevel,
|
|
73
|
+
mentionProvider: mentionProvider,
|
|
74
|
+
profilecardProvider: profilecardProvider,
|
|
75
|
+
localId: localId
|
|
76
|
+
}, actionHandlers));
|
|
77
|
+
} else {
|
|
78
|
+
return /*#__PURE__*/_react.default.createElement(_element.ResourcedMention, (0, _extends2.default)({
|
|
79
|
+
id: id,
|
|
80
|
+
text: text,
|
|
81
|
+
accessLevel: accessLevel,
|
|
82
|
+
mentionProvider: mentionProvider,
|
|
83
|
+
localId: localId
|
|
84
|
+
}, actionHandlers));
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
Mention.displayName = 'Mention';
|
|
88
|
+
var _default = exports.default = Mention;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { useProvider } from '@atlaskit/editor-common/provider-factory';
|
|
3
3
|
import { isResolvingMentionProvider, MentionNameStatus } from '@atlaskit/mention';
|
|
4
4
|
import { isPromise } from '@atlaskit/mention/types';
|
|
5
5
|
import Mention from '../ui/Mention';
|
|
6
6
|
const UNKNOWN_USER_ID = '_|unknown|_';
|
|
7
|
-
const
|
|
7
|
+
const useResolvedName = ({
|
|
8
8
|
id,
|
|
9
9
|
text,
|
|
10
|
-
providers,
|
|
11
|
-
accessLevel,
|
|
12
10
|
mentionProvider
|
|
13
11
|
}) => {
|
|
14
12
|
const [resolvedName, setResolvedName] = useState(text);
|
|
@@ -37,37 +35,29 @@ const MentionAssistiveTextComponent = ({
|
|
|
37
35
|
});
|
|
38
36
|
}
|
|
39
37
|
}, [id, text, mentionProvider]);
|
|
40
|
-
return
|
|
41
|
-
id: id,
|
|
42
|
-
text: resolvedName,
|
|
43
|
-
accessLevel: accessLevel,
|
|
44
|
-
providers: providers
|
|
45
|
-
})));
|
|
38
|
+
return resolvedName;
|
|
46
39
|
};
|
|
47
40
|
export const MentionNodeView = props => {
|
|
48
|
-
|
|
49
|
-
providerFactory
|
|
50
|
-
} = props;
|
|
41
|
+
var _props$options;
|
|
51
42
|
const {
|
|
52
43
|
id,
|
|
53
44
|
text,
|
|
54
|
-
accessLevel
|
|
45
|
+
accessLevel,
|
|
46
|
+
localId
|
|
55
47
|
} = props.node.attrs;
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
id: id,
|
|
63
|
-
text: text,
|
|
64
|
-
providers: providerFactory,
|
|
65
|
-
accessLevel: accessLevel
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
return /*#__PURE__*/React.createElement(WithProviders, {
|
|
69
|
-
providers: ['mentionProvider', 'profilecardProvider'],
|
|
70
|
-
providerFactory: providerFactory,
|
|
71
|
-
renderNode: renderAssistiveTextWithProviders
|
|
48
|
+
const mentionProvider = useProvider('mentionProvider');
|
|
49
|
+
const profilecardProvider = (_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.profilecardProvider;
|
|
50
|
+
const resolvedName = useResolvedName({
|
|
51
|
+
id,
|
|
52
|
+
text,
|
|
53
|
+
mentionProvider
|
|
72
54
|
});
|
|
55
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Mention, {
|
|
56
|
+
id: id,
|
|
57
|
+
text: resolvedName,
|
|
58
|
+
accessLevel: accessLevel,
|
|
59
|
+
mentionProvider: mentionProvider,
|
|
60
|
+
profilecardProvider: profilecardProvider,
|
|
61
|
+
localId: localId
|
|
62
|
+
})));
|
|
73
63
|
};
|
|
@@ -154,7 +154,8 @@ const buildNodesForTeamMention = (schema, selectedMention, mentionProvider, sani
|
|
|
154
154
|
text,
|
|
155
155
|
id: member.id,
|
|
156
156
|
accessLevel,
|
|
157
|
-
userType: 'DEFAULT'
|
|
157
|
+
userType: 'DEFAULT',
|
|
158
|
+
localId: uuid()
|
|
158
159
|
});
|
|
159
160
|
inlineNodes.push(userMentionNode);
|
|
160
161
|
// should not add empty space after the last user mention.
|
|
@@ -316,7 +317,8 @@ export const createTypeAheadConfig = ({
|
|
|
316
317
|
text,
|
|
317
318
|
id,
|
|
318
319
|
accessLevel,
|
|
319
|
-
userType: userType === 'DEFAULT' ? null : userType
|
|
320
|
+
userType: userType === 'DEFAULT' ? null : userType,
|
|
321
|
+
localId: uuid()
|
|
320
322
|
});
|
|
321
323
|
const space = schema.text(' ');
|
|
322
324
|
return insert(Fragment.from([mentionNode, space]));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { PureComponent } from 'react';
|
|
5
|
-
import { ProviderFactory, WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import { MentionWithProfileCard } from '@atlaskit/editor-common/mention';
|
|
6
4
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
7
5
|
import { ResourcedMention } from '@atlaskit/mention/element';
|
|
6
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
7
|
+
|
|
8
8
|
// Workaround for a firefox issue where dom selection is off sync
|
|
9
9
|
// https://product-fabric.atlassian.net/browse/ED-12442
|
|
10
10
|
const refreshBrowserSelection = () => {
|
|
@@ -17,33 +17,31 @@ const refreshBrowserSelection = () => {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
20
|
+
const Mention = props => {
|
|
21
|
+
const {
|
|
22
|
+
accessLevel,
|
|
23
|
+
eventHandlers,
|
|
24
|
+
id,
|
|
25
|
+
text,
|
|
26
|
+
localId,
|
|
27
|
+
mentionProvider,
|
|
28
|
+
profilecardProvider: profilecardProviderPromise
|
|
29
|
+
} = props;
|
|
30
|
+
const [profilecardProvider, setProfilecardProvider] = useState(null);
|
|
31
|
+
|
|
32
|
+
// Resolve the profilecard provider
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (profilecardProviderPromise) {
|
|
35
|
+
profilecardProviderPromise.then(profilecardProvider => {
|
|
36
|
+
setProfilecardProvider(profilecardProvider);
|
|
37
|
+
}).catch(() => {
|
|
38
|
+
setProfilecardProvider(null);
|
|
36
39
|
});
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}, actionHandlers));
|
|
43
|
-
});
|
|
44
|
-
this.providerFactory = props.providers || new ProviderFactory();
|
|
45
|
-
}
|
|
46
|
-
componentDidMount() {
|
|
40
|
+
} else {
|
|
41
|
+
setProfilecardProvider(null);
|
|
42
|
+
}
|
|
43
|
+
}, [profilecardProviderPromise]);
|
|
44
|
+
useEffect(() => {
|
|
47
45
|
// Workaround an issue where the selection is not updated immediately after adding
|
|
48
46
|
// a mention when "sanitizePrivateContent" is enabled in the editor on safari.
|
|
49
47
|
// This affects both insertion and paste behaviour it is applied to the component.
|
|
@@ -51,20 +49,29 @@ export default class Mention extends PureComponent {
|
|
|
51
49
|
if (browser.safari) {
|
|
52
50
|
setTimeout(refreshBrowserSelection, 0);
|
|
53
51
|
}
|
|
52
|
+
}, []);
|
|
53
|
+
const actionHandlers = {};
|
|
54
|
+
['onClick', 'onMouseEnter', 'onMouseLeave'].forEach(handler => {
|
|
55
|
+
actionHandlers[handler] = eventHandlers && eventHandlers[handler] || (() => {});
|
|
56
|
+
});
|
|
57
|
+
if (getBooleanFF('platform.editor.mentions-in-editor-popup-on-click') && profilecardProvider) {
|
|
58
|
+
return /*#__PURE__*/React.createElement(MentionWithProfileCard, _extends({
|
|
59
|
+
id: id,
|
|
60
|
+
text: text,
|
|
61
|
+
accessLevel: accessLevel,
|
|
62
|
+
mentionProvider: mentionProvider,
|
|
63
|
+
profilecardProvider: profilecardProvider,
|
|
64
|
+
localId: localId
|
|
65
|
+
}, actionHandlers));
|
|
66
|
+
} else {
|
|
67
|
+
return /*#__PURE__*/React.createElement(ResourcedMention, _extends({
|
|
68
|
+
id: id,
|
|
69
|
+
text: text,
|
|
70
|
+
accessLevel: accessLevel,
|
|
71
|
+
mentionProvider: mentionProvider,
|
|
72
|
+
localId: localId
|
|
73
|
+
}, actionHandlers));
|
|
54
74
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
// in this case when component is unmounted it's safe to destroy this providerFactory
|
|
59
|
-
this.providerFactory.destroy();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
render() {
|
|
63
|
-
return /*#__PURE__*/React.createElement(WithProviders, {
|
|
64
|
-
providers: ['mentionProvider', 'profilecardProvider'],
|
|
65
|
-
providerFactory: this.providerFactory,
|
|
66
|
-
renderNode: this.renderWithProvider
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
_defineProperty(Mention, "displayName", 'Mention');
|
|
75
|
+
};
|
|
76
|
+
Mention.displayName = 'Mention';
|
|
77
|
+
export default Mention;
|
|
@@ -2,16 +2,14 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
4
|
import React, { useEffect, useState } from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { useProvider } from '@atlaskit/editor-common/provider-factory';
|
|
6
6
|
import { isResolvingMentionProvider, MentionNameStatus } from '@atlaskit/mention';
|
|
7
7
|
import { isPromise } from '@atlaskit/mention/types';
|
|
8
8
|
import Mention from '../ui/Mention';
|
|
9
9
|
var UNKNOWN_USER_ID = '_|unknown|_';
|
|
10
|
-
var
|
|
10
|
+
var useResolvedName = function useResolvedName(_ref) {
|
|
11
11
|
var id = _ref.id,
|
|
12
12
|
text = _ref.text,
|
|
13
|
-
providers = _ref.providers,
|
|
14
|
-
accessLevel = _ref.accessLevel,
|
|
15
13
|
mentionProvider = _ref.mentionProvider;
|
|
16
14
|
var _useState = useState(text),
|
|
17
15
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -68,33 +66,28 @@ var MentionAssistiveTextComponent = function MentionAssistiveTextComponent(_ref)
|
|
|
68
66
|
});
|
|
69
67
|
}
|
|
70
68
|
}, [id, text, mentionProvider]);
|
|
71
|
-
return
|
|
72
|
-
id: id,
|
|
73
|
-
text: resolvedName,
|
|
74
|
-
accessLevel: accessLevel,
|
|
75
|
-
providers: providers
|
|
76
|
-
})));
|
|
69
|
+
return resolvedName;
|
|
77
70
|
};
|
|
78
71
|
export var MentionNodeView = function MentionNodeView(props) {
|
|
79
|
-
var
|
|
72
|
+
var _props$options;
|
|
80
73
|
var _props$node$attrs = props.node.attrs,
|
|
81
74
|
id = _props$node$attrs.id,
|
|
82
75
|
text = _props$node$attrs.text,
|
|
83
|
-
accessLevel = _props$node$attrs.accessLevel
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
providers: providerFactory,
|
|
92
|
-
accessLevel: accessLevel
|
|
93
|
-
});
|
|
94
|
-
};
|
|
95
|
-
return /*#__PURE__*/React.createElement(WithProviders, {
|
|
96
|
-
providers: ['mentionProvider', 'profilecardProvider'],
|
|
97
|
-
providerFactory: providerFactory,
|
|
98
|
-
renderNode: renderAssistiveTextWithProviders
|
|
76
|
+
accessLevel = _props$node$attrs.accessLevel,
|
|
77
|
+
localId = _props$node$attrs.localId;
|
|
78
|
+
var mentionProvider = useProvider('mentionProvider');
|
|
79
|
+
var profilecardProvider = (_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.profilecardProvider;
|
|
80
|
+
var resolvedName = useResolvedName({
|
|
81
|
+
id: id,
|
|
82
|
+
text: text,
|
|
83
|
+
mentionProvider: mentionProvider
|
|
99
84
|
});
|
|
85
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(Mention, {
|
|
86
|
+
id: id,
|
|
87
|
+
text: resolvedName,
|
|
88
|
+
accessLevel: accessLevel,
|
|
89
|
+
mentionProvider: mentionProvider,
|
|
90
|
+
profilecardProvider: profilecardProvider,
|
|
91
|
+
localId: localId
|
|
92
|
+
})));
|
|
100
93
|
};
|
|
@@ -166,7 +166,8 @@ var buildNodesForTeamMention = function buildNodesForTeamMention(schema, selecte
|
|
|
166
166
|
text: text,
|
|
167
167
|
id: member.id,
|
|
168
168
|
accessLevel: accessLevel,
|
|
169
|
-
userType: 'DEFAULT'
|
|
169
|
+
userType: 'DEFAULT',
|
|
170
|
+
localId: uuid()
|
|
170
171
|
});
|
|
171
172
|
inlineNodes.push(userMentionNode);
|
|
172
173
|
// should not add empty space after the last user mention.
|
|
@@ -320,7 +321,8 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
320
321
|
text: text,
|
|
321
322
|
id: id,
|
|
322
323
|
accessLevel: accessLevel,
|
|
323
|
-
userType: userType === 'DEFAULT' ? null : userType
|
|
324
|
+
userType: userType === 'DEFAULT' ? null : userType,
|
|
325
|
+
localId: uuid()
|
|
324
326
|
});
|
|
325
327
|
var space = schema.text(' ');
|
|
326
328
|
return insert(Fragment.from([mentionNode, space]));
|
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
8
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
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 from 'react';
|
|
12
|
-
import { PureComponent } from 'react';
|
|
13
|
-
import { ProviderFactory, WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import React, { useEffect, useState } from 'react';
|
|
4
|
+
import { MentionWithProfileCard } from '@atlaskit/editor-common/mention';
|
|
14
5
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
15
6
|
import { ResourcedMention } from '@atlaskit/mention/element';
|
|
7
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
8
|
+
|
|
16
9
|
// Workaround for a firefox issue where dom selection is off sync
|
|
17
10
|
// https://product-fabric.atlassian.net/browse/ED-12442
|
|
18
11
|
var refreshBrowserSelection = function refreshBrowserSelection() {
|
|
@@ -25,66 +18,62 @@ var refreshBrowserSelection = function refreshBrowserSelection() {
|
|
|
25
18
|
}
|
|
26
19
|
}
|
|
27
20
|
};
|
|
28
|
-
var Mention =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
21
|
+
var Mention = function Mention(props) {
|
|
22
|
+
var accessLevel = props.accessLevel,
|
|
23
|
+
eventHandlers = props.eventHandlers,
|
|
24
|
+
id = props.id,
|
|
25
|
+
text = props.text,
|
|
26
|
+
localId = props.localId,
|
|
27
|
+
mentionProvider = props.mentionProvider,
|
|
28
|
+
profilecardProviderPromise = props.profilecardProvider;
|
|
29
|
+
var _useState = useState(null),
|
|
30
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
31
|
+
profilecardProvider = _useState2[0],
|
|
32
|
+
setProfilecardProvider = _useState2[1];
|
|
33
|
+
|
|
34
|
+
// Resolve the profilecard provider
|
|
35
|
+
useEffect(function () {
|
|
36
|
+
if (profilecardProviderPromise) {
|
|
37
|
+
profilecardProviderPromise.then(function (profilecardProvider) {
|
|
38
|
+
setProfilecardProvider(profilecardProvider);
|
|
39
|
+
}).catch(function () {
|
|
40
|
+
setProfilecardProvider(null);
|
|
46
41
|
});
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
text: text,
|
|
50
|
-
accessLevel: accessLevel,
|
|
51
|
-
mentionProvider: mentionProvider
|
|
52
|
-
}, actionHandlers));
|
|
53
|
-
});
|
|
54
|
-
_this.providerFactory = props.providers || new ProviderFactory();
|
|
55
|
-
return _this;
|
|
56
|
-
}
|
|
57
|
-
_createClass(Mention, [{
|
|
58
|
-
key: "componentDidMount",
|
|
59
|
-
value: function componentDidMount() {
|
|
60
|
-
// Workaround an issue where the selection is not updated immediately after adding
|
|
61
|
-
// a mention when "sanitizePrivateContent" is enabled in the editor on safari.
|
|
62
|
-
// This affects both insertion and paste behaviour it is applied to the component.
|
|
63
|
-
// https://product-fabric.atlassian.net/browse/ED-14859
|
|
64
|
-
if (browser.safari) {
|
|
65
|
-
setTimeout(refreshBrowserSelection, 0);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}, {
|
|
69
|
-
key: "componentWillUnmount",
|
|
70
|
-
value: function componentWillUnmount() {
|
|
71
|
-
if (!this.props.providers) {
|
|
72
|
-
// new ProviderFactory is created if no `providers` has been set
|
|
73
|
-
// in this case when component is unmounted it's safe to destroy this providerFactory
|
|
74
|
-
this.providerFactory.destroy();
|
|
75
|
-
}
|
|
42
|
+
} else {
|
|
43
|
+
setProfilecardProvider(null);
|
|
76
44
|
}
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
45
|
+
}, [profilecardProviderPromise]);
|
|
46
|
+
useEffect(function () {
|
|
47
|
+
// Workaround an issue where the selection is not updated immediately after adding
|
|
48
|
+
// a mention when "sanitizePrivateContent" is enabled in the editor on safari.
|
|
49
|
+
// This affects both insertion and paste behaviour it is applied to the component.
|
|
50
|
+
// https://product-fabric.atlassian.net/browse/ED-14859
|
|
51
|
+
if (browser.safari) {
|
|
52
|
+
setTimeout(refreshBrowserSelection, 0);
|
|
85
53
|
}
|
|
86
|
-
}]);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
54
|
+
}, []);
|
|
55
|
+
var actionHandlers = {};
|
|
56
|
+
['onClick', 'onMouseEnter', 'onMouseLeave'].forEach(function (handler) {
|
|
57
|
+
actionHandlers[handler] = eventHandlers && eventHandlers[handler] || function () {};
|
|
58
|
+
});
|
|
59
|
+
if (getBooleanFF('platform.editor.mentions-in-editor-popup-on-click') && profilecardProvider) {
|
|
60
|
+
return /*#__PURE__*/React.createElement(MentionWithProfileCard, _extends({
|
|
61
|
+
id: id,
|
|
62
|
+
text: text,
|
|
63
|
+
accessLevel: accessLevel,
|
|
64
|
+
mentionProvider: mentionProvider,
|
|
65
|
+
profilecardProvider: profilecardProvider,
|
|
66
|
+
localId: localId
|
|
67
|
+
}, actionHandlers));
|
|
68
|
+
} else {
|
|
69
|
+
return /*#__PURE__*/React.createElement(ResourcedMention, _extends({
|
|
70
|
+
id: id,
|
|
71
|
+
text: text,
|
|
72
|
+
accessLevel: accessLevel,
|
|
73
|
+
mentionProvider: mentionProvider,
|
|
74
|
+
localId: localId
|
|
75
|
+
}, actionHandlers));
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
Mention.displayName = 'Mention';
|
|
79
|
+
export default Mention;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type
|
|
2
|
+
import { type ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
3
|
import type { InlineNodeViewComponentProps } from '@atlaskit/editor-common/react-node-view';
|
|
4
4
|
import type { MentionPluginOptions } from '../types';
|
|
5
5
|
export type Props = InlineNodeViewComponentProps & {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import type { GasPayload } from '@atlaskit/analytics-gas-types';
|
|
1
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
3
|
import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
|
|
3
4
|
import type { MentionPluginOptions, MentionPluginState } from '../types';
|
|
4
|
-
export declare function createMentionPlugin(pmPluginFactoryParams: PMPluginFactoryParams, fireEvent: (payload:
|
|
5
|
+
export declare function createMentionPlugin(pmPluginFactoryParams: PMPluginFactoryParams, fireEvent: (payload: GasPayload) => void, options?: MentionPluginOptions): SafePlugin<MentionPluginState>;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { AnalyticsEventPayload } from '@atlaskit/analytics-next';
|
|
3
|
+
import { type ProfilecardProvider } from '@atlaskit/editor-common/src/provider-factory/profile-card-provider';
|
|
3
4
|
import type { NextEditorPlugin, OptionalPlugin, TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
4
5
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
5
6
|
import type { ContextIdentifierPlugin } from '@atlaskit/editor-plugin-context-identifier';
|
|
@@ -13,6 +14,7 @@ export interface TeamInfoAttrAnalytics {
|
|
|
13
14
|
export interface MentionPluginConfig {
|
|
14
15
|
HighlightComponent?: React.ComponentType<React.PropsWithChildren<unknown>>;
|
|
15
16
|
insertDisplayName?: boolean;
|
|
17
|
+
profilecardProvider?: Promise<ProfilecardProvider>;
|
|
16
18
|
}
|
|
17
19
|
export interface MentionPluginOptions extends MentionPluginConfig {
|
|
18
20
|
sanitizePrivateContent?: boolean;
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type ProfilecardProvider } from '@atlaskit/editor-common/src/provider-factory/profile-card-provider';
|
|
3
3
|
import type { MentionEventHandlers } from '@atlaskit/editor-common/ui';
|
|
4
|
+
import type { MentionProvider } from '@atlaskit/mention/resource';
|
|
4
5
|
export interface MentionProps {
|
|
5
6
|
id: string;
|
|
6
|
-
providers?: ProviderFactory;
|
|
7
7
|
eventHandlers?: MentionEventHandlers;
|
|
8
8
|
text: string;
|
|
9
9
|
accessLevel?: string;
|
|
10
|
+
localId?: string;
|
|
11
|
+
mentionProvider?: Promise<MentionProvider>;
|
|
12
|
+
profilecardProvider?: Promise<ProfilecardProvider>;
|
|
10
13
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
componentWillUnmount(): void;
|
|
17
|
-
private renderWithProvider;
|
|
18
|
-
render(): JSX.Element;
|
|
19
|
-
}
|
|
14
|
+
declare const Mention: {
|
|
15
|
+
(props: MentionProps): JSX.Element;
|
|
16
|
+
displayName: string;
|
|
17
|
+
};
|
|
18
|
+
export default Mention;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type
|
|
2
|
+
import { type ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
3
|
import type { InlineNodeViewComponentProps } from '@atlaskit/editor-common/react-node-view';
|
|
4
4
|
import type { MentionPluginOptions } from '../types';
|
|
5
5
|
export type Props = InlineNodeViewComponentProps & {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import type { GasPayload } from '@atlaskit/analytics-gas-types';
|
|
1
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
3
|
import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
|
|
3
4
|
import type { MentionPluginOptions, MentionPluginState } from '../types';
|
|
4
|
-
export declare function createMentionPlugin(pmPluginFactoryParams: PMPluginFactoryParams, fireEvent: (payload:
|
|
5
|
+
export declare function createMentionPlugin(pmPluginFactoryParams: PMPluginFactoryParams, fireEvent: (payload: GasPayload) => void, options?: MentionPluginOptions): SafePlugin<MentionPluginState>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { AnalyticsEventPayload } from '@atlaskit/analytics-next';
|
|
3
|
+
import { type ProfilecardProvider } from '@atlaskit/editor-common/src/provider-factory/profile-card-provider';
|
|
3
4
|
import type { NextEditorPlugin, OptionalPlugin, TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
4
5
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
5
6
|
import type { ContextIdentifierPlugin } from '@atlaskit/editor-plugin-context-identifier';
|
|
@@ -13,6 +14,7 @@ export interface TeamInfoAttrAnalytics {
|
|
|
13
14
|
export interface MentionPluginConfig {
|
|
14
15
|
HighlightComponent?: React.ComponentType<React.PropsWithChildren<unknown>>;
|
|
15
16
|
insertDisplayName?: boolean;
|
|
17
|
+
profilecardProvider?: Promise<ProfilecardProvider>;
|
|
16
18
|
}
|
|
17
19
|
export interface MentionPluginOptions extends MentionPluginConfig {
|
|
18
20
|
sanitizePrivateContent?: boolean;
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type ProfilecardProvider } from '@atlaskit/editor-common/src/provider-factory/profile-card-provider';
|
|
3
3
|
import type { MentionEventHandlers } from '@atlaskit/editor-common/ui';
|
|
4
|
+
import type { MentionProvider } from '@atlaskit/mention/resource';
|
|
4
5
|
export interface MentionProps {
|
|
5
6
|
id: string;
|
|
6
|
-
providers?: ProviderFactory;
|
|
7
7
|
eventHandlers?: MentionEventHandlers;
|
|
8
8
|
text: string;
|
|
9
9
|
accessLevel?: string;
|
|
10
|
+
localId?: string;
|
|
11
|
+
mentionProvider?: Promise<MentionProvider>;
|
|
12
|
+
profilecardProvider?: Promise<ProfilecardProvider>;
|
|
10
13
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
componentWillUnmount(): void;
|
|
17
|
-
private renderWithProvider;
|
|
18
|
-
render(): JSX.Element;
|
|
19
|
-
}
|
|
14
|
+
declare const Mention: {
|
|
15
|
+
(props: MentionProps): JSX.Element;
|
|
16
|
+
displayName: string;
|
|
17
|
+
};
|
|
18
|
+
export default Mention;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-mentions",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Mentions plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,17 +33,18 @@
|
|
|
33
33
|
".": "./src/index.ts"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@atlaskit/adf-schema": "^36.
|
|
36
|
+
"@atlaskit/adf-schema": "^36.8.0",
|
|
37
37
|
"@atlaskit/analytics-gas-types": "^5.1.0",
|
|
38
|
-
"@atlaskit/editor-common": "^80.
|
|
38
|
+
"@atlaskit/editor-common": "^80.4.0",
|
|
39
39
|
"@atlaskit/editor-plugin-analytics": "^1.2.0",
|
|
40
40
|
"@atlaskit/editor-plugin-context-identifier": "^1.1.0",
|
|
41
41
|
"@atlaskit/editor-plugin-type-ahead": "^1.2.0",
|
|
42
42
|
"@atlaskit/editor-prosemirror": "4.0.1",
|
|
43
|
-
"@atlaskit/icon": "^22.
|
|
43
|
+
"@atlaskit/icon": "^22.3.0",
|
|
44
44
|
"@atlaskit/mention": "^23.0.0",
|
|
45
|
+
"@atlaskit/platform-feature-flags": "^0.2.5",
|
|
45
46
|
"@atlaskit/theme": "^12.8.0",
|
|
46
|
-
"@atlaskit/tokens": "^1.
|
|
47
|
+
"@atlaskit/tokens": "^1.49.0",
|
|
47
48
|
"@babel/runtime": "^7.0.0",
|
|
48
49
|
"@emotion/react": "^11.7.1",
|
|
49
50
|
"uuid": "^3.1.0"
|
|
@@ -104,5 +105,10 @@
|
|
|
104
105
|
"@atlassian/tangerine/project-structure"
|
|
105
106
|
]
|
|
106
107
|
},
|
|
107
|
-
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0"
|
|
108
|
+
"prettier": "@atlassian/atlassian-frontend-prettier-config-1.0.0",
|
|
109
|
+
"platform-feature-flags": {
|
|
110
|
+
"platform.editor.mentions-in-editor-popup-on-click": {
|
|
111
|
+
"type": "boolean"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
108
114
|
}
|