@atlaskit/editor-plugin-mentions 9.2.9 → 9.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 +22 -0
- package/README.md +11 -1
- package/dist/cjs/mentionsPlugin.js +11 -1
- package/dist/cjs/nodeviews/mentionNodeView.js +22 -6
- package/dist/cjs/pm-plugins/main.js +1 -1
- package/dist/cjs/pm-plugins/mentionPlaceholder.js +52 -0
- package/dist/cjs/ui/InlineInviteRecaptchaContainer.js +22 -4
- package/dist/cjs/ui/type-ahead/analytics.js +10 -6
- package/dist/cjs/ui/type-ahead/index.js +16 -4
- package/dist/es2019/mentionsPlugin.js +9 -1
- package/dist/es2019/nodeviews/mentionNodeView.js +21 -6
- package/dist/es2019/pm-plugins/main.js +1 -1
- package/dist/es2019/pm-plugins/mentionPlaceholder.js +44 -0
- package/dist/es2019/ui/InlineInviteRecaptchaContainer.js +24 -4
- package/dist/es2019/ui/type-ahead/analytics.js +6 -4
- package/dist/es2019/ui/type-ahead/index.js +18 -4
- package/dist/esm/mentionsPlugin.js +11 -1
- package/dist/esm/nodeviews/mentionNodeView.js +22 -6
- package/dist/esm/pm-plugins/main.js +1 -1
- package/dist/esm/pm-plugins/mentionPlaceholder.js +44 -0
- package/dist/esm/ui/InlineInviteRecaptchaContainer.js +22 -4
- package/dist/esm/ui/type-ahead/analytics.js +9 -6
- package/dist/esm/ui/type-ahead/index.js +16 -4
- package/dist/types/nodeviews/mentionNodeView.d.ts +1 -0
- package/dist/types/pm-plugins/mentionPlaceholder.d.ts +11 -0
- package/dist/types/types/index.d.ts +8 -0
- package/dist/types/ui/type-ahead/analytics.d.ts +2 -2
- package/dist/types-ts4.5/nodeviews/mentionNodeView.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/mentionPlaceholder.d.ts +11 -0
- package/dist/types-ts4.5/types/index.d.ts +8 -0
- package/dist/types-ts4.5/ui/type-ahead/analytics.d.ts +2 -2
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-mentions
|
|
2
2
|
|
|
3
|
+
## 9.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`0e055e3f3f4e9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0e055e3f3f4e9) -
|
|
8
|
+
[ux] Mentionplaceholder plugin to display placeholder for inline invite
|
|
9
|
+
- [`0942e8da58d56`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0942e8da58d56) -
|
|
10
|
+
Add currentUserId option to support immediate self-mention highlighting without waiting for
|
|
11
|
+
provider
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
17
|
+
## 9.2.10
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [`0e487e05b9e61`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0e487e05b9e61) -
|
|
22
|
+
additional analytics attributes
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
|
|
3
25
|
## 9.2.9
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
# Editor
|
|
1
|
+
# Editor Plugin Mentions
|
|
2
2
|
|
|
3
3
|
Mentions plugin for @atlaskit/editor-core
|
|
4
4
|
|
|
5
5
|
**Note:** This component is designed for internal Atlassian development.
|
|
6
6
|
External contributors will be able to use this component but will not be able to submit issues.
|
|
7
7
|
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
The Mentions plugin provides the ability to mention users and other entities within the Atlassian Editor. It integrates with @atlaskit/editor-core to enable mention functionality for editor users.
|
|
11
|
+
|
|
12
|
+
## Key features
|
|
13
|
+
|
|
14
|
+
- **User mentions** - Mention users within editor content
|
|
15
|
+
- **Entity resolution** - Resolve mentions to user profiles and data
|
|
16
|
+
- **Mention rendering** - Display mentions with appropriate styling and information
|
|
17
|
+
|
|
8
18
|
## Install
|
|
9
19
|
---
|
|
10
20
|
- **Install** - *yarn add @atlaskit/editor-plugin-mentions*
|
|
@@ -23,6 +23,7 @@ var _editorCommands = require("./editor-commands");
|
|
|
23
23
|
var _mentionNodeSpec = require("./nodeviews/mentionNodeSpec");
|
|
24
24
|
var _key = require("./pm-plugins/key");
|
|
25
25
|
var _main = require("./pm-plugins/main");
|
|
26
|
+
var _mentionPlaceholder = require("./pm-plugins/mentionPlaceholder");
|
|
26
27
|
var _InlineInviteRecaptchaContainer = require("./ui/InlineInviteRecaptchaContainer");
|
|
27
28
|
var _SecondaryToolbarComponent = require("./ui/SecondaryToolbarComponent");
|
|
28
29
|
var _typeAhead = require("./ui/type-ahead");
|
|
@@ -115,7 +116,7 @@ var mentionsPlugin = exports.mentionsPlugin = function mentionsPlugin(_ref3) {
|
|
|
115
116
|
}];
|
|
116
117
|
},
|
|
117
118
|
pmPlugins: function pmPlugins() {
|
|
118
|
-
|
|
119
|
+
var plugins = [{
|
|
119
120
|
name: 'mention',
|
|
120
121
|
plugin: function plugin(pmPluginFactoryParams) {
|
|
121
122
|
return (0, _main.createMentionPlugin)({
|
|
@@ -126,6 +127,15 @@ var mentionsPlugin = exports.mentionsPlugin = function mentionsPlugin(_ref3) {
|
|
|
126
127
|
});
|
|
127
128
|
}
|
|
128
129
|
}];
|
|
130
|
+
if ((0, _platformFeatureFlags.fg)('jira_invites_auto_tag_new_user_in_mentions_fg')) {
|
|
131
|
+
plugins.push({
|
|
132
|
+
name: 'mentionPlaceholder',
|
|
133
|
+
plugin: function plugin() {
|
|
134
|
+
return (0, _mentionPlaceholder.createMentionPlaceholderPlugin)();
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return plugins;
|
|
129
139
|
},
|
|
130
140
|
contentComponent: function contentComponent(_ref4) {
|
|
131
141
|
var editorView = _ref4.editorView,
|
|
@@ -159,18 +159,34 @@ var MentionNodeView = exports.MentionNodeView = /*#__PURE__*/function () {
|
|
|
159
159
|
this.mentionPrimitiveElement.textContent = name;
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
+
}, {
|
|
163
|
+
key: "shouldHighlightMention",
|
|
164
|
+
value: function shouldHighlightMention(mentionProvider) {
|
|
165
|
+
var _this$config$options;
|
|
166
|
+
var _ref4 = (_this$config$options = this.config.options) !== null && _this$config$options !== void 0 ? _this$config$options : {},
|
|
167
|
+
currentUserId = _ref4.currentUserId;
|
|
168
|
+
// Check options first (immediate), then provider (async), then default to false
|
|
169
|
+
if (currentUserId && this.node.attrs.id === currentUserId) {
|
|
170
|
+
return true;
|
|
171
|
+
} else {
|
|
172
|
+
var _mentionProvider$shou;
|
|
173
|
+
return (_mentionProvider$shou = mentionProvider === null || mentionProvider === void 0 ? void 0 : mentionProvider.shouldHighlightMention({
|
|
174
|
+
id: this.node.attrs.id
|
|
175
|
+
})) !== null && _mentionProvider$shou !== void 0 ? _mentionProvider$shou : false;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
162
178
|
}, {
|
|
163
179
|
key: "updateState",
|
|
164
180
|
value: function () {
|
|
165
181
|
var _updateState = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(mentionProvider) {
|
|
166
|
-
var _mentionProvider$
|
|
182
|
+
var _mentionProvider$shou2, _this$config$options2;
|
|
167
183
|
var isHighlighted, newState, name;
|
|
168
184
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
169
185
|
while (1) switch (_context2.prev = _context2.next) {
|
|
170
186
|
case 0:
|
|
171
|
-
isHighlighted = (_mentionProvider$
|
|
187
|
+
isHighlighted = (0, _expValEquals.expValEquals)('platform_editor_vc90_transition_fixes_batch_1', 'isEnabled', true) ? this.shouldHighlightMention(mentionProvider) : (_mentionProvider$shou2 = mentionProvider === null || mentionProvider === void 0 ? void 0 : mentionProvider.shouldHighlightMention({
|
|
172
188
|
id: this.node.attrs.id
|
|
173
|
-
})) !== null && _mentionProvider$
|
|
189
|
+
})) !== null && _mentionProvider$shou2 !== void 0 ? _mentionProvider$shou2 : false;
|
|
174
190
|
newState = getNewState(isHighlighted, (0, _types.isRestricted)(this.node.attrs.accessLevel));
|
|
175
191
|
if (newState !== this.state) {
|
|
176
192
|
this.setClassList(newState);
|
|
@@ -181,7 +197,7 @@ var MentionNodeView = exports.MentionNodeView = /*#__PURE__*/function () {
|
|
|
181
197
|
case 5:
|
|
182
198
|
name = _context2.sent;
|
|
183
199
|
this.setTextContent(name);
|
|
184
|
-
if (name && this.domElement && (_this$config$
|
|
200
|
+
if (name && this.domElement && (_this$config$options2 = this.config.options) !== null && _this$config$options2 !== void 0 && _this$config$options2.profilecardProvider) {
|
|
185
201
|
this.domElement.setAttribute('aria-label', getAccessibilityLabelFromName(name));
|
|
186
202
|
}
|
|
187
203
|
case 8:
|
|
@@ -198,8 +214,8 @@ var MentionNodeView = exports.MentionNodeView = /*#__PURE__*/function () {
|
|
|
198
214
|
}, {
|
|
199
215
|
key: "nodeIsEqual",
|
|
200
216
|
value: function nodeIsEqual(nextNode) {
|
|
201
|
-
var _this$config$
|
|
202
|
-
if ((_this$config$
|
|
217
|
+
var _this$config$options3;
|
|
218
|
+
if ((_this$config$options3 = this.config.options) !== null && _this$config$options3 !== void 0 && _this$config$options3.sanitizePrivateContent) {
|
|
203
219
|
// Compare nodes but ignore the text parameter as it may be sanitized
|
|
204
220
|
var nextNodeAttrs = _objectSpread(_objectSpread({}, nextNode.attrs), {}, {
|
|
205
221
|
text: this.node.attrs.text
|
|
@@ -23,7 +23,7 @@ var ACTIONS = exports.ACTIONS = {
|
|
|
23
23
|
SET_PROVIDER: 'SET_PROVIDER'
|
|
24
24
|
};
|
|
25
25
|
var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
|
|
26
|
-
var PACKAGE_VERSION = "9.2.
|
|
26
|
+
var PACKAGE_VERSION = "9.2.10";
|
|
27
27
|
var setProvider = function setProvider(provider) {
|
|
28
28
|
return function (state, dispatch) {
|
|
29
29
|
if (dispatch) {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MENTION_PLACEHOLDER_ACTIONS = void 0;
|
|
7
|
+
exports.createMentionPlaceholderPlugin = createMentionPlaceholderPlugin;
|
|
8
|
+
exports.mentionPlaceholderPluginKey = void 0;
|
|
9
|
+
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
10
|
+
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
11
|
+
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
12
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
13
|
+
var mentionPlaceholderPluginKey = exports.mentionPlaceholderPluginKey = new _state.PluginKey('mentionPlaceholderPlugin');
|
|
14
|
+
var MENTION_PLACEHOLDER_ACTIONS = exports.MENTION_PLACEHOLDER_ACTIONS = {
|
|
15
|
+
SHOW_PLACEHOLDER: 'SHOW_PLACEHOLDER',
|
|
16
|
+
HIDE_PLACEHOLDER: 'HIDE_PLACEHOLDER'
|
|
17
|
+
};
|
|
18
|
+
function createMentionPlaceholderPlugin() {
|
|
19
|
+
return new _safePlugin.SafePlugin({
|
|
20
|
+
key: mentionPlaceholderPluginKey,
|
|
21
|
+
state: {
|
|
22
|
+
init: function init() {
|
|
23
|
+
return {};
|
|
24
|
+
},
|
|
25
|
+
apply: function apply(tr, pluginState) {
|
|
26
|
+
var meta = tr.getMeta(mentionPlaceholderPluginKey);
|
|
27
|
+
if ((meta === null || meta === void 0 ? void 0 : meta.action) === MENTION_PLACEHOLDER_ACTIONS.SHOW_PLACEHOLDER) {
|
|
28
|
+
return {
|
|
29
|
+
placeholder: meta.placeholder
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
if ((meta === null || meta === void 0 ? void 0 : meta.action) === MENTION_PLACEHOLDER_ACTIONS.HIDE_PLACEHOLDER) {
|
|
33
|
+
return {};
|
|
34
|
+
}
|
|
35
|
+
return pluginState;
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
props: {
|
|
39
|
+
decorations: function decorations(state) {
|
|
40
|
+
var pluginState = mentionPlaceholderPluginKey.getState(state);
|
|
41
|
+
if (pluginState !== null && pluginState !== void 0 && pluginState.placeholder) {
|
|
42
|
+
var selection = state.selection;
|
|
43
|
+
var span = document.createElement('span');
|
|
44
|
+
span.textContent = pluginState.placeholder;
|
|
45
|
+
span.style.setProperty('color', "var(--ds-text-accent-blue, ".concat(_colors.B400, ")"));
|
|
46
|
+
return _view.DecorationSet.create(state.doc, [_view.Decoration.widget(selection.from, span)]);
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
@@ -10,6 +10,7 @@ exports.InlineInviteRecaptchaContainer = void 0;
|
|
|
10
10
|
var _runtime = require("@compiled/react/runtime");
|
|
11
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _mentionPlaceholder = require("../pm-plugins/mentionPlaceholder");
|
|
13
14
|
var _analytics = require("../ui/type-ahead/analytics");
|
|
14
15
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
15
16
|
/**
|
|
@@ -19,7 +20,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
19
20
|
* mentionProvider.showInlineInviteRecaptcha(email) which passes email to the component.
|
|
20
21
|
*/
|
|
21
22
|
var InlineInviteRecaptchaContainer = exports.InlineInviteRecaptchaContainer = function InlineInviteRecaptchaContainer(_ref) {
|
|
22
|
-
var _api$mention2, _api$
|
|
23
|
+
var _api$mention2, _api$core3;
|
|
23
24
|
var mentionProvider = _ref.mentionProvider,
|
|
24
25
|
api = _ref.api;
|
|
25
26
|
var _useState = (0, _react.useState)(null),
|
|
@@ -56,10 +57,27 @@ var InlineInviteRecaptchaContainer = exports.InlineInviteRecaptchaContainer = fu
|
|
|
56
57
|
userType: 'DEFAULT',
|
|
57
58
|
accessLevel: 'CONTAINER'
|
|
58
59
|
}));
|
|
60
|
+
api.core.actions.execute(function (_ref2) {
|
|
61
|
+
var tr = _ref2.tr;
|
|
62
|
+
tr.setMeta(_mentionPlaceholder.mentionPlaceholderPluginKey, {
|
|
63
|
+
action: _mentionPlaceholder.MENTION_PLACEHOLDER_ACTIONS.HIDE_PLACEHOLDER
|
|
64
|
+
});
|
|
65
|
+
return tr;
|
|
66
|
+
});
|
|
59
67
|
}, [api]);
|
|
60
68
|
var handleClose = (0, _react.useCallback)(function () {
|
|
61
|
-
|
|
62
|
-
|
|
69
|
+
var _api$core2;
|
|
70
|
+
if (!(api !== null && api !== void 0 && (_api$core2 = api.core) !== null && _api$core2 !== void 0 && (_api$core2 = _api$core2.actions) !== null && _api$core2 !== void 0 && _api$core2.execute)) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
api.core.actions.execute(function (_ref3) {
|
|
74
|
+
var tr = _ref3.tr;
|
|
75
|
+
tr.setMeta(_mentionPlaceholder.mentionPlaceholderPluginKey, {
|
|
76
|
+
action: _mentionPlaceholder.MENTION_PLACEHOLDER_ACTIONS.HIDE_PLACEHOLDER
|
|
77
|
+
});
|
|
78
|
+
return tr;
|
|
79
|
+
});
|
|
80
|
+
}, [api]);
|
|
63
81
|
var handleReady = (0, _react.useCallback)(function (showRecaptcha) {
|
|
64
82
|
if (provider) {
|
|
65
83
|
if (showRecaptcha) {
|
|
@@ -69,7 +87,7 @@ var InlineInviteRecaptchaContainer = exports.InlineInviteRecaptchaContainer = fu
|
|
|
69
87
|
}
|
|
70
88
|
}
|
|
71
89
|
}, [provider]);
|
|
72
|
-
if (!(provider !== null && provider !== void 0 && provider.InlineInviteRecaptcha) || !(api !== null && api !== void 0 && (_api$mention2 = api.mention) !== null && _api$mention2 !== void 0 && (_api$mention2 = _api$mention2.commands) !== null && _api$mention2 !== void 0 && _api$mention2.insertMention) || !(api !== null && api !== void 0 && (_api$
|
|
90
|
+
if (!(provider !== null && provider !== void 0 && provider.InlineInviteRecaptcha) || !(api !== null && api !== void 0 && (_api$mention2 = api.mention) !== null && _api$mention2 !== void 0 && (_api$mention2 = _api$mention2.commands) !== null && _api$mention2 !== void 0 && _api$mention2.insertMention) || !(api !== null && api !== void 0 && (_api$core3 = api.core) !== null && _api$core3 !== void 0 && (_api$core3 = _api$core3.actions) !== null && _api$core3 !== void 0 && _api$core3.execute)) {
|
|
73
91
|
return null;
|
|
74
92
|
}
|
|
75
93
|
var RecaptchaComponent = provider.InlineInviteRecaptcha;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.buildTypeAheadRenderedPayload = exports.buildTypeAheadInviteItemViewedPayload = exports.buildTypeAheadInviteItemClickedPayload = exports.buildTypeAheadInsertedPayload = exports.buildTypeAheadCancelPayload = exports.MENTION_SOURCE = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
7
9
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
8
10
|
var _resource = require("@atlaskit/mention/resource");
|
|
9
11
|
var _utils = require("./utils");
|
|
12
|
+
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; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
14
|
var componentName = 'mention';
|
|
11
15
|
var MENTION_SOURCE = exports.MENTION_SOURCE = 'mentionInEditor';
|
|
12
16
|
var emptyQueryResponse = {
|
|
@@ -53,7 +57,7 @@ var getPosition = function getPosition(mentionList, selectedMention) {
|
|
|
53
57
|
var isClicked = function isClicked(insertType) {
|
|
54
58
|
return insertType === 'selected';
|
|
55
59
|
};
|
|
56
|
-
var buildTypeAheadInviteItemViewedPayload = exports.buildTypeAheadInviteItemViewedPayload = function buildTypeAheadInviteItemViewedPayload(sessionId, contextIdentifierProvider, userRole) {
|
|
60
|
+
var buildTypeAheadInviteItemViewedPayload = exports.buildTypeAheadInviteItemViewedPayload = function buildTypeAheadInviteItemViewedPayload(sessionId, contextIdentifierProvider, userRole, additionalAttributes) {
|
|
57
61
|
var _ref = contextIdentifierProvider || {},
|
|
58
62
|
containerId = _ref.containerId,
|
|
59
63
|
objectId = _ref.objectId,
|
|
@@ -62,7 +66,7 @@ var buildTypeAheadInviteItemViewedPayload = exports.buildTypeAheadInviteItemView
|
|
|
62
66
|
action: _analytics.ACTION.RENDERED,
|
|
63
67
|
actionSubject: _analytics.ACTION_SUBJECT.INVITE_ITEM,
|
|
64
68
|
eventType: _analytics.EVENT_TYPE.UI,
|
|
65
|
-
attributes: {
|
|
69
|
+
attributes: _objectSpread({
|
|
66
70
|
componentName: componentName,
|
|
67
71
|
containerId: containerId,
|
|
68
72
|
objectId: objectId,
|
|
@@ -70,10 +74,10 @@ var buildTypeAheadInviteItemViewedPayload = exports.buildTypeAheadInviteItemView
|
|
|
70
74
|
userRole: userRole,
|
|
71
75
|
sessionId: sessionId,
|
|
72
76
|
source: MENTION_SOURCE
|
|
73
|
-
}
|
|
77
|
+
}, additionalAttributes)
|
|
74
78
|
};
|
|
75
79
|
};
|
|
76
|
-
var buildTypeAheadInviteItemClickedPayload = exports.buildTypeAheadInviteItemClickedPayload = function buildTypeAheadInviteItemClickedPayload(duration, upKeyCount, downKeyCount, sessionId, insertType, query, contextIdentifierProvider, userRole) {
|
|
80
|
+
var buildTypeAheadInviteItemClickedPayload = exports.buildTypeAheadInviteItemClickedPayload = function buildTypeAheadInviteItemClickedPayload(duration, upKeyCount, downKeyCount, sessionId, insertType, query, contextIdentifierProvider, userRole, additionalAttributes) {
|
|
77
81
|
var _extractAttributesFro2 = extractAttributesFromQuery(query),
|
|
78
82
|
queryLength = _extractAttributesFro2.queryLength,
|
|
79
83
|
spaceInQuery = _extractAttributesFro2.spaceInQuery;
|
|
@@ -85,7 +89,7 @@ var buildTypeAheadInviteItemClickedPayload = exports.buildTypeAheadInviteItemCli
|
|
|
85
89
|
action: isClicked(insertType) ? _analytics.ACTION.CLICKED : _analytics.ACTION.PRESSED,
|
|
86
90
|
actionSubject: _analytics.ACTION_SUBJECT.INVITE_ITEM,
|
|
87
91
|
eventType: _analytics.EVENT_TYPE.UI,
|
|
88
|
-
attributes: {
|
|
92
|
+
attributes: _objectSpread({
|
|
89
93
|
componentName: componentName,
|
|
90
94
|
duration: duration,
|
|
91
95
|
queryLength: queryLength,
|
|
@@ -98,7 +102,7 @@ var buildTypeAheadInviteItemClickedPayload = exports.buildTypeAheadInviteItemCli
|
|
|
98
102
|
userRole: userRole,
|
|
99
103
|
sessionId: sessionId,
|
|
100
104
|
keyboardKey: isClicked(insertType) ? undefined : insertType
|
|
101
|
-
}
|
|
105
|
+
}, additionalAttributes)
|
|
102
106
|
};
|
|
103
107
|
};
|
|
104
108
|
var buildTypeAheadInsertedPayload = exports.buildTypeAheadInsertedPayload = function buildTypeAheadInsertedPayload(duration, upKeyCount, downKeyCount, sessionId, insertType, mention, mentionLocalId, mentionList, query, contextIdentifierProvider, taskListId, taskItemId) {
|
|
@@ -20,6 +20,7 @@ var _resource = require("@atlaskit/mention/resource");
|
|
|
20
20
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
21
21
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
22
22
|
var _editorCommands = require("../../editor-commands");
|
|
23
|
+
var _mentionPlaceholder = require("../../pm-plugins/mentionPlaceholder");
|
|
23
24
|
var _utils2 = require("../../pm-plugins/utils");
|
|
24
25
|
var _InviteItem = _interopRequireWildcard(require("../InviteItem"));
|
|
25
26
|
var _InviteItemWithEmailDomain = _interopRequireDefault(require("../InviteItem/InviteItemWithEmailDomain"));
|
|
@@ -290,7 +291,10 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
290
291
|
firstQueryWithoutResults: firstQueryWithoutResults || '',
|
|
291
292
|
currentQuery: query,
|
|
292
293
|
onInviteItemMount: function onInviteItemMount() {
|
|
293
|
-
|
|
294
|
+
var _mentionProvider$getS2;
|
|
295
|
+
fireEvent((0, _analytics.buildTypeAheadInviteItemViewedPayload)(sessionId, contextIdentifierProvider, mentionProvider.userRole, (0, _platformFeatureFlags.fg)('jira_invites_auto_tag_new_user_in_mentions_fg') ? {
|
|
296
|
+
isInlineInviteMentionsEnabled: (_mentionProvider$getS2 = mentionProvider.getShouldEnableInlineInvite) === null || _mentionProvider$getS2 === void 0 ? void 0 : _mentionProvider$getS2.call(mentionProvider)
|
|
297
|
+
} : {}));
|
|
294
298
|
},
|
|
295
299
|
emailDomain: emailDomain
|
|
296
300
|
})(mentionItems);
|
|
@@ -343,9 +347,11 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
343
347
|
if (mentionProvider && mentionProvider.shouldEnableInvite && (0, _utils3.isInviteItem)(item.mention)) {
|
|
344
348
|
// Don't fire event and the callback with selection by space press
|
|
345
349
|
if (mode !== 'space') {
|
|
346
|
-
var _mentionProvider$
|
|
347
|
-
fireEvent((0, _analytics.buildTypeAheadInviteItemClickedPayload)(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, mode, query, contextIdentifierProvider, mentionProvider.userRole))
|
|
348
|
-
|
|
350
|
+
var _mentionProvider$getS3, _mentionProvider$getS4;
|
|
351
|
+
fireEvent((0, _analytics.buildTypeAheadInviteItemClickedPayload)(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, mode, query, contextIdentifierProvider, mentionProvider.userRole, (0, _platformFeatureFlags.fg)('jira_invites_auto_tag_new_user_in_mentions_fg') ? {
|
|
352
|
+
isInlineInviteMentionsEnabled: (_mentionProvider$getS3 = mentionProvider.getShouldEnableInlineInvite) === null || _mentionProvider$getS3 === void 0 ? void 0 : _mentionProvider$getS3.call(mentionProvider)
|
|
353
|
+
} : {}));
|
|
354
|
+
if ((_mentionProvider$getS4 = mentionProvider.getShouldEnableInlineInvite) !== null && _mentionProvider$getS4 !== void 0 && _mentionProvider$getS4.call(mentionProvider) && (0, _platformFeatureFlags.fg)('jira_invites_auto_tag_new_user_in_mentions_fg')) {
|
|
349
355
|
// Get the email from query, using the same logic as InviteItemWithEmailDomain
|
|
350
356
|
var emailDomain = mentionProvider.userEmailDomain;
|
|
351
357
|
var email = query || '';
|
|
@@ -356,6 +362,12 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
356
362
|
// If query already includes @, use it as is
|
|
357
363
|
if (email && mentionProvider.showInlineInviteRecaptcha) {
|
|
358
364
|
mentionProvider.showInlineInviteRecaptcha(email);
|
|
365
|
+
var tr = state.tr;
|
|
366
|
+
tr.setMeta(_mentionPlaceholder.mentionPlaceholderPluginKey, {
|
|
367
|
+
action: _mentionPlaceholder.MENTION_PLACEHOLDER_ACTIONS.SHOW_PLACEHOLDER,
|
|
368
|
+
placeholder: "@".concat(query)
|
|
369
|
+
});
|
|
370
|
+
return tr;
|
|
359
371
|
}
|
|
360
372
|
} else if (mentionProvider.onInviteItemClick) {
|
|
361
373
|
// Fallback to old behavior for backward compatibility
|
|
@@ -13,6 +13,7 @@ import { insertMention } from './editor-commands';
|
|
|
13
13
|
import { mentionNodeSpec } from './nodeviews/mentionNodeSpec';
|
|
14
14
|
import { mentionPluginKey } from './pm-plugins/key';
|
|
15
15
|
import { ACTIONS, createMentionPlugin } from './pm-plugins/main';
|
|
16
|
+
import { createMentionPlaceholderPlugin } from './pm-plugins/mentionPlaceholder';
|
|
16
17
|
import { InlineInviteRecaptchaContainer } from './ui/InlineInviteRecaptchaContainer';
|
|
17
18
|
import { SecondaryToolbarComponent } from './ui/SecondaryToolbarComponent';
|
|
18
19
|
import { createTypeAheadConfig } from './ui/type-ahead';
|
|
@@ -113,7 +114,7 @@ const mentionsPlugin = ({
|
|
|
113
114
|
}];
|
|
114
115
|
},
|
|
115
116
|
pmPlugins() {
|
|
116
|
-
|
|
117
|
+
const plugins = [{
|
|
117
118
|
name: 'mention',
|
|
118
119
|
plugin: pmPluginFactoryParams => createMentionPlugin({
|
|
119
120
|
pmPluginFactoryParams,
|
|
@@ -122,6 +123,13 @@ const mentionsPlugin = ({
|
|
|
122
123
|
api
|
|
123
124
|
})
|
|
124
125
|
}];
|
|
126
|
+
if (fg('jira_invites_auto_tag_new_user_in_mentions_fg')) {
|
|
127
|
+
plugins.push({
|
|
128
|
+
name: 'mentionPlaceholder',
|
|
129
|
+
plugin: () => createMentionPlaceholderPlugin()
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return plugins;
|
|
125
133
|
},
|
|
126
134
|
contentComponent({
|
|
127
135
|
editorView,
|
|
@@ -125,11 +125,26 @@ export class MentionNodeView {
|
|
|
125
125
|
this.mentionPrimitiveElement.textContent = name;
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
+
shouldHighlightMention(mentionProvider) {
|
|
129
|
+
var _this$config$options;
|
|
130
|
+
const {
|
|
131
|
+
currentUserId
|
|
132
|
+
} = (_this$config$options = this.config.options) !== null && _this$config$options !== void 0 ? _this$config$options : {};
|
|
133
|
+
// Check options first (immediate), then provider (async), then default to false
|
|
134
|
+
if (currentUserId && this.node.attrs.id === currentUserId) {
|
|
135
|
+
return true;
|
|
136
|
+
} else {
|
|
137
|
+
var _mentionProvider$shou;
|
|
138
|
+
return (_mentionProvider$shou = mentionProvider === null || mentionProvider === void 0 ? void 0 : mentionProvider.shouldHighlightMention({
|
|
139
|
+
id: this.node.attrs.id
|
|
140
|
+
})) !== null && _mentionProvider$shou !== void 0 ? _mentionProvider$shou : false;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
128
143
|
async updateState(mentionProvider) {
|
|
129
|
-
var _mentionProvider$
|
|
130
|
-
const isHighlighted = (_mentionProvider$
|
|
144
|
+
var _mentionProvider$shou2, _this$config$options2;
|
|
145
|
+
const isHighlighted = expValEquals('platform_editor_vc90_transition_fixes_batch_1', 'isEnabled', true) ? this.shouldHighlightMention(mentionProvider) : (_mentionProvider$shou2 = mentionProvider === null || mentionProvider === void 0 ? void 0 : mentionProvider.shouldHighlightMention({
|
|
131
146
|
id: this.node.attrs.id
|
|
132
|
-
})) !== null && _mentionProvider$
|
|
147
|
+
})) !== null && _mentionProvider$shou2 !== void 0 ? _mentionProvider$shou2 : false;
|
|
133
148
|
const newState = getNewState(isHighlighted, isRestricted(this.node.attrs.accessLevel));
|
|
134
149
|
if (newState !== this.state) {
|
|
135
150
|
this.setClassList(newState);
|
|
@@ -137,13 +152,13 @@ export class MentionNodeView {
|
|
|
137
152
|
}
|
|
138
153
|
const name = await handleProviderName(mentionProvider, this.node);
|
|
139
154
|
this.setTextContent(name);
|
|
140
|
-
if (name && this.domElement && (_this$config$
|
|
155
|
+
if (name && this.domElement && (_this$config$options2 = this.config.options) !== null && _this$config$options2 !== void 0 && _this$config$options2.profilecardProvider) {
|
|
141
156
|
this.domElement.setAttribute('aria-label', getAccessibilityLabelFromName(name));
|
|
142
157
|
}
|
|
143
158
|
}
|
|
144
159
|
nodeIsEqual(nextNode) {
|
|
145
|
-
var _this$config$
|
|
146
|
-
if ((_this$config$
|
|
160
|
+
var _this$config$options3;
|
|
161
|
+
if ((_this$config$options3 = this.config.options) !== null && _this$config$options3 !== void 0 && _this$config$options3.sanitizePrivateContent) {
|
|
147
162
|
// Compare nodes but ignore the text parameter as it may be sanitized
|
|
148
163
|
const nextNodeAttrs = {
|
|
149
164
|
...nextNode.attrs,
|
|
@@ -12,7 +12,7 @@ export const ACTIONS = {
|
|
|
12
12
|
SET_PROVIDER: 'SET_PROVIDER'
|
|
13
13
|
};
|
|
14
14
|
const PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
|
|
15
|
-
const PACKAGE_VERSION = "9.2.
|
|
15
|
+
const PACKAGE_VERSION = "9.2.10";
|
|
16
16
|
const setProvider = provider => (state, dispatch) => {
|
|
17
17
|
if (dispatch) {
|
|
18
18
|
dispatch(state.tr.setMeta(mentionPluginKey, {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import { B400 } from '@atlaskit/theme/colors';
|
|
5
|
+
export const mentionPlaceholderPluginKey = new PluginKey('mentionPlaceholderPlugin');
|
|
6
|
+
export const MENTION_PLACEHOLDER_ACTIONS = {
|
|
7
|
+
SHOW_PLACEHOLDER: 'SHOW_PLACEHOLDER',
|
|
8
|
+
HIDE_PLACEHOLDER: 'HIDE_PLACEHOLDER'
|
|
9
|
+
};
|
|
10
|
+
export function createMentionPlaceholderPlugin() {
|
|
11
|
+
return new SafePlugin({
|
|
12
|
+
key: mentionPlaceholderPluginKey,
|
|
13
|
+
state: {
|
|
14
|
+
init: () => ({}),
|
|
15
|
+
apply(tr, pluginState) {
|
|
16
|
+
const meta = tr.getMeta(mentionPlaceholderPluginKey);
|
|
17
|
+
if ((meta === null || meta === void 0 ? void 0 : meta.action) === MENTION_PLACEHOLDER_ACTIONS.SHOW_PLACEHOLDER) {
|
|
18
|
+
return {
|
|
19
|
+
placeholder: meta.placeholder
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
if ((meta === null || meta === void 0 ? void 0 : meta.action) === MENTION_PLACEHOLDER_ACTIONS.HIDE_PLACEHOLDER) {
|
|
23
|
+
return {};
|
|
24
|
+
}
|
|
25
|
+
return pluginState;
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
props: {
|
|
29
|
+
decorations: state => {
|
|
30
|
+
const pluginState = mentionPlaceholderPluginKey.getState(state);
|
|
31
|
+
if (pluginState !== null && pluginState !== void 0 && pluginState.placeholder) {
|
|
32
|
+
const {
|
|
33
|
+
selection
|
|
34
|
+
} = state;
|
|
35
|
+
const span = document.createElement('span');
|
|
36
|
+
span.textContent = pluginState.placeholder;
|
|
37
|
+
span.style.setProperty('color', `var(--ds-text-accent-blue, ${B400})`);
|
|
38
|
+
return DecorationSet.create(state.doc, [Decoration.widget(selection.from, span)]);
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* InlineInviteRecaptchaContainer.tsx generated by @compiled/babel-plugin v0.38.1 */
|
|
2
2
|
import { ax, ix } from "@compiled/react/runtime";
|
|
3
3
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
4
|
+
import { mentionPlaceholderPluginKey, MENTION_PLACEHOLDER_ACTIONS } from '../pm-plugins/mentionPlaceholder';
|
|
4
5
|
import { MENTION_SOURCE } from '../ui/type-ahead/analytics';
|
|
5
6
|
/**
|
|
6
7
|
* Container that renders the recaptcha component from the mention provider and manages handleSuccess.
|
|
@@ -12,7 +13,7 @@ export const InlineInviteRecaptchaContainer = ({
|
|
|
12
13
|
mentionProvider,
|
|
13
14
|
api
|
|
14
15
|
}) => {
|
|
15
|
-
var _api$mention2, _api$mention2$command, _api$
|
|
16
|
+
var _api$mention2, _api$mention2$command, _api$core3, _api$core3$actions;
|
|
16
17
|
const [provider, setProvider] = useState(null);
|
|
17
18
|
useEffect(() => {
|
|
18
19
|
if (!mentionProvider) {
|
|
@@ -44,10 +45,29 @@ export const InlineInviteRecaptchaContainer = ({
|
|
|
44
45
|
userType: 'DEFAULT',
|
|
45
46
|
accessLevel: 'CONTAINER'
|
|
46
47
|
}));
|
|
48
|
+
api.core.actions.execute(({
|
|
49
|
+
tr
|
|
50
|
+
}) => {
|
|
51
|
+
tr.setMeta(mentionPlaceholderPluginKey, {
|
|
52
|
+
action: MENTION_PLACEHOLDER_ACTIONS.HIDE_PLACEHOLDER
|
|
53
|
+
});
|
|
54
|
+
return tr;
|
|
55
|
+
});
|
|
47
56
|
}, [api]);
|
|
48
57
|
const handleClose = useCallback(() => {
|
|
49
|
-
|
|
50
|
-
|
|
58
|
+
var _api$core2, _api$core2$actions;
|
|
59
|
+
if (!(api !== null && api !== void 0 && (_api$core2 = api.core) !== null && _api$core2 !== void 0 && (_api$core2$actions = _api$core2.actions) !== null && _api$core2$actions !== void 0 && _api$core2$actions.execute)) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
api.core.actions.execute(({
|
|
63
|
+
tr
|
|
64
|
+
}) => {
|
|
65
|
+
tr.setMeta(mentionPlaceholderPluginKey, {
|
|
66
|
+
action: MENTION_PLACEHOLDER_ACTIONS.HIDE_PLACEHOLDER
|
|
67
|
+
});
|
|
68
|
+
return tr;
|
|
69
|
+
});
|
|
70
|
+
}, [api]);
|
|
51
71
|
const handleReady = useCallback(showRecaptcha => {
|
|
52
72
|
if (provider) {
|
|
53
73
|
if (showRecaptcha) {
|
|
@@ -57,7 +77,7 @@ export const InlineInviteRecaptchaContainer = ({
|
|
|
57
77
|
}
|
|
58
78
|
}
|
|
59
79
|
}, [provider]);
|
|
60
|
-
if (!(provider !== null && provider !== void 0 && provider.InlineInviteRecaptcha) || !(api !== null && api !== void 0 && (_api$mention2 = api.mention) !== null && _api$mention2 !== void 0 && (_api$mention2$command = _api$mention2.commands) !== null && _api$mention2$command !== void 0 && _api$mention2$command.insertMention) || !(api !== null && api !== void 0 && (_api$
|
|
80
|
+
if (!(provider !== null && provider !== void 0 && provider.InlineInviteRecaptcha) || !(api !== null && api !== void 0 && (_api$mention2 = api.mention) !== null && _api$mention2 !== void 0 && (_api$mention2$command = _api$mention2.commands) !== null && _api$mention2$command !== void 0 && _api$mention2$command.insertMention) || !(api !== null && api !== void 0 && (_api$core3 = api.core) !== null && _api$core3 !== void 0 && (_api$core3$actions = _api$core3.actions) !== null && _api$core3$actions !== void 0 && _api$core3$actions.execute)) {
|
|
61
81
|
return null;
|
|
62
82
|
}
|
|
63
83
|
const RecaptchaComponent = provider.InlineInviteRecaptcha;
|
|
@@ -44,7 +44,7 @@ const getPosition = (mentionList, selectedMention) => {
|
|
|
44
44
|
return;
|
|
45
45
|
};
|
|
46
46
|
const isClicked = insertType => insertType === 'selected';
|
|
47
|
-
export const buildTypeAheadInviteItemViewedPayload = (sessionId, contextIdentifierProvider, userRole) => {
|
|
47
|
+
export const buildTypeAheadInviteItemViewedPayload = (sessionId, contextIdentifierProvider, userRole, additionalAttributes) => {
|
|
48
48
|
const {
|
|
49
49
|
containerId,
|
|
50
50
|
objectId,
|
|
@@ -61,11 +61,12 @@ export const buildTypeAheadInviteItemViewedPayload = (sessionId, contextIdentifi
|
|
|
61
61
|
childObjectId,
|
|
62
62
|
userRole,
|
|
63
63
|
sessionId,
|
|
64
|
-
source: MENTION_SOURCE
|
|
64
|
+
source: MENTION_SOURCE,
|
|
65
|
+
...additionalAttributes
|
|
65
66
|
}
|
|
66
67
|
};
|
|
67
68
|
};
|
|
68
|
-
export const buildTypeAheadInviteItemClickedPayload = (duration, upKeyCount, downKeyCount, sessionId, insertType, query, contextIdentifierProvider, userRole) => {
|
|
69
|
+
export const buildTypeAheadInviteItemClickedPayload = (duration, upKeyCount, downKeyCount, sessionId, insertType, query, contextIdentifierProvider, userRole, additionalAttributes) => {
|
|
69
70
|
const {
|
|
70
71
|
queryLength,
|
|
71
72
|
spaceInQuery
|
|
@@ -91,7 +92,8 @@ export const buildTypeAheadInviteItemClickedPayload = (duration, upKeyCount, dow
|
|
|
91
92
|
childObjectId,
|
|
92
93
|
userRole,
|
|
93
94
|
sessionId,
|
|
94
|
-
keyboardKey: isClicked(insertType) ? undefined : insertType
|
|
95
|
+
keyboardKey: isClicked(insertType) ? undefined : insertType,
|
|
96
|
+
...additionalAttributes
|
|
95
97
|
}
|
|
96
98
|
};
|
|
97
99
|
};
|
|
@@ -10,6 +10,7 @@ import { isResolvingMentionProvider } from '@atlaskit/mention/resource';
|
|
|
10
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
11
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
12
12
|
import { createSingleMentionFragment } from '../../editor-commands';
|
|
13
|
+
import { mentionPlaceholderPluginKey, MENTION_PLACEHOLDER_ACTIONS } from '../../pm-plugins/mentionPlaceholder';
|
|
13
14
|
import { getMentionPluginState } from '../../pm-plugins/utils';
|
|
14
15
|
import InviteItem, { INVITE_ITEM_DESCRIPTION } from '../InviteItem';
|
|
15
16
|
import InviteItemWithEmailDomain from '../InviteItem/InviteItemWithEmailDomain';
|
|
@@ -270,7 +271,10 @@ export const createTypeAheadConfig = ({
|
|
|
270
271
|
firstQueryWithoutResults: firstQueryWithoutResults || '',
|
|
271
272
|
currentQuery: query,
|
|
272
273
|
onInviteItemMount: () => {
|
|
273
|
-
|
|
274
|
+
var _mentionProvider$getS2;
|
|
275
|
+
fireEvent(buildTypeAheadInviteItemViewedPayload(sessionId, contextIdentifierProvider, mentionProvider.userRole, fg('jira_invites_auto_tag_new_user_in_mentions_fg') ? {
|
|
276
|
+
isInlineInviteMentionsEnabled: (_mentionProvider$getS2 = mentionProvider.getShouldEnableInlineInvite) === null || _mentionProvider$getS2 === void 0 ? void 0 : _mentionProvider$getS2.call(mentionProvider)
|
|
277
|
+
} : {}));
|
|
274
278
|
},
|
|
275
279
|
emailDomain
|
|
276
280
|
})(mentionItems);
|
|
@@ -332,9 +336,11 @@ export const createTypeAheadConfig = ({
|
|
|
332
336
|
if (mentionProvider && mentionProvider.shouldEnableInvite && isInviteItem(item.mention)) {
|
|
333
337
|
// Don't fire event and the callback with selection by space press
|
|
334
338
|
if (mode !== 'space') {
|
|
335
|
-
var _mentionProvider$
|
|
336
|
-
fireEvent(buildTypeAheadInviteItemClickedPayload(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, mode, query, contextIdentifierProvider, mentionProvider.userRole)
|
|
337
|
-
|
|
339
|
+
var _mentionProvider$getS3, _mentionProvider$getS4;
|
|
340
|
+
fireEvent(buildTypeAheadInviteItemClickedPayload(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, mode, query, contextIdentifierProvider, mentionProvider.userRole, fg('jira_invites_auto_tag_new_user_in_mentions_fg') ? {
|
|
341
|
+
isInlineInviteMentionsEnabled: (_mentionProvider$getS3 = mentionProvider.getShouldEnableInlineInvite) === null || _mentionProvider$getS3 === void 0 ? void 0 : _mentionProvider$getS3.call(mentionProvider)
|
|
342
|
+
} : {}));
|
|
343
|
+
if ((_mentionProvider$getS4 = mentionProvider.getShouldEnableInlineInvite) !== null && _mentionProvider$getS4 !== void 0 && _mentionProvider$getS4.call(mentionProvider) && fg('jira_invites_auto_tag_new_user_in_mentions_fg')) {
|
|
338
344
|
// Get the email from query, using the same logic as InviteItemWithEmailDomain
|
|
339
345
|
const emailDomain = mentionProvider.userEmailDomain;
|
|
340
346
|
let email = query || '';
|
|
@@ -345,6 +351,14 @@ export const createTypeAheadConfig = ({
|
|
|
345
351
|
// If query already includes @, use it as is
|
|
346
352
|
if (email && mentionProvider.showInlineInviteRecaptcha) {
|
|
347
353
|
mentionProvider.showInlineInviteRecaptcha(email);
|
|
354
|
+
const {
|
|
355
|
+
tr
|
|
356
|
+
} = state;
|
|
357
|
+
tr.setMeta(mentionPlaceholderPluginKey, {
|
|
358
|
+
action: MENTION_PLACEHOLDER_ACTIONS.SHOW_PLACEHOLDER,
|
|
359
|
+
placeholder: `@${query}`
|
|
360
|
+
});
|
|
361
|
+
return tr;
|
|
348
362
|
}
|
|
349
363
|
} else if (mentionProvider.onInviteItemClick) {
|
|
350
364
|
// Fallback to old behavior for backward compatibility
|
|
@@ -18,6 +18,7 @@ import { insertMention } from './editor-commands';
|
|
|
18
18
|
import { mentionNodeSpec } from './nodeviews/mentionNodeSpec';
|
|
19
19
|
import { mentionPluginKey } from './pm-plugins/key';
|
|
20
20
|
import { ACTIONS, createMentionPlugin } from './pm-plugins/main';
|
|
21
|
+
import { createMentionPlaceholderPlugin } from './pm-plugins/mentionPlaceholder';
|
|
21
22
|
import { InlineInviteRecaptchaContainer } from './ui/InlineInviteRecaptchaContainer';
|
|
22
23
|
import { SecondaryToolbarComponent } from './ui/SecondaryToolbarComponent';
|
|
23
24
|
import { createTypeAheadConfig } from './ui/type-ahead';
|
|
@@ -107,7 +108,7 @@ var mentionsPlugin = function mentionsPlugin(_ref3) {
|
|
|
107
108
|
}];
|
|
108
109
|
},
|
|
109
110
|
pmPlugins: function pmPlugins() {
|
|
110
|
-
|
|
111
|
+
var plugins = [{
|
|
111
112
|
name: 'mention',
|
|
112
113
|
plugin: function plugin(pmPluginFactoryParams) {
|
|
113
114
|
return createMentionPlugin({
|
|
@@ -118,6 +119,15 @@ var mentionsPlugin = function mentionsPlugin(_ref3) {
|
|
|
118
119
|
});
|
|
119
120
|
}
|
|
120
121
|
}];
|
|
122
|
+
if (fg('jira_invites_auto_tag_new_user_in_mentions_fg')) {
|
|
123
|
+
plugins.push({
|
|
124
|
+
name: 'mentionPlaceholder',
|
|
125
|
+
plugin: function plugin() {
|
|
126
|
+
return createMentionPlaceholderPlugin();
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
return plugins;
|
|
121
131
|
},
|
|
122
132
|
contentComponent: function contentComponent(_ref4) {
|
|
123
133
|
var editorView = _ref4.editorView,
|
|
@@ -152,18 +152,34 @@ export var MentionNodeView = /*#__PURE__*/function () {
|
|
|
152
152
|
this.mentionPrimitiveElement.textContent = name;
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
+
}, {
|
|
156
|
+
key: "shouldHighlightMention",
|
|
157
|
+
value: function shouldHighlightMention(mentionProvider) {
|
|
158
|
+
var _this$config$options;
|
|
159
|
+
var _ref4 = (_this$config$options = this.config.options) !== null && _this$config$options !== void 0 ? _this$config$options : {},
|
|
160
|
+
currentUserId = _ref4.currentUserId;
|
|
161
|
+
// Check options first (immediate), then provider (async), then default to false
|
|
162
|
+
if (currentUserId && this.node.attrs.id === currentUserId) {
|
|
163
|
+
return true;
|
|
164
|
+
} else {
|
|
165
|
+
var _mentionProvider$shou;
|
|
166
|
+
return (_mentionProvider$shou = mentionProvider === null || mentionProvider === void 0 ? void 0 : mentionProvider.shouldHighlightMention({
|
|
167
|
+
id: this.node.attrs.id
|
|
168
|
+
})) !== null && _mentionProvider$shou !== void 0 ? _mentionProvider$shou : false;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
155
171
|
}, {
|
|
156
172
|
key: "updateState",
|
|
157
173
|
value: function () {
|
|
158
174
|
var _updateState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(mentionProvider) {
|
|
159
|
-
var _mentionProvider$
|
|
175
|
+
var _mentionProvider$shou2, _this$config$options2;
|
|
160
176
|
var isHighlighted, newState, name;
|
|
161
177
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
162
178
|
while (1) switch (_context2.prev = _context2.next) {
|
|
163
179
|
case 0:
|
|
164
|
-
isHighlighted = (_mentionProvider$
|
|
180
|
+
isHighlighted = expValEquals('platform_editor_vc90_transition_fixes_batch_1', 'isEnabled', true) ? this.shouldHighlightMention(mentionProvider) : (_mentionProvider$shou2 = mentionProvider === null || mentionProvider === void 0 ? void 0 : mentionProvider.shouldHighlightMention({
|
|
165
181
|
id: this.node.attrs.id
|
|
166
|
-
})) !== null && _mentionProvider$
|
|
182
|
+
})) !== null && _mentionProvider$shou2 !== void 0 ? _mentionProvider$shou2 : false;
|
|
167
183
|
newState = getNewState(isHighlighted, isRestricted(this.node.attrs.accessLevel));
|
|
168
184
|
if (newState !== this.state) {
|
|
169
185
|
this.setClassList(newState);
|
|
@@ -174,7 +190,7 @@ export var MentionNodeView = /*#__PURE__*/function () {
|
|
|
174
190
|
case 5:
|
|
175
191
|
name = _context2.sent;
|
|
176
192
|
this.setTextContent(name);
|
|
177
|
-
if (name && this.domElement && (_this$config$
|
|
193
|
+
if (name && this.domElement && (_this$config$options2 = this.config.options) !== null && _this$config$options2 !== void 0 && _this$config$options2.profilecardProvider) {
|
|
178
194
|
this.domElement.setAttribute('aria-label', getAccessibilityLabelFromName(name));
|
|
179
195
|
}
|
|
180
196
|
case 8:
|
|
@@ -191,8 +207,8 @@ export var MentionNodeView = /*#__PURE__*/function () {
|
|
|
191
207
|
}, {
|
|
192
208
|
key: "nodeIsEqual",
|
|
193
209
|
value: function nodeIsEqual(nextNode) {
|
|
194
|
-
var _this$config$
|
|
195
|
-
if ((_this$config$
|
|
210
|
+
var _this$config$options3;
|
|
211
|
+
if ((_this$config$options3 = this.config.options) !== null && _this$config$options3 !== void 0 && _this$config$options3.sanitizePrivateContent) {
|
|
196
212
|
// Compare nodes but ignore the text parameter as it may be sanitized
|
|
197
213
|
var nextNodeAttrs = _objectSpread(_objectSpread({}, nextNode.attrs), {}, {
|
|
198
214
|
text: this.node.attrs.text
|
|
@@ -15,7 +15,7 @@ export var ACTIONS = {
|
|
|
15
15
|
SET_PROVIDER: 'SET_PROVIDER'
|
|
16
16
|
};
|
|
17
17
|
var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
|
|
18
|
-
var PACKAGE_VERSION = "9.2.
|
|
18
|
+
var PACKAGE_VERSION = "9.2.10";
|
|
19
19
|
var setProvider = function setProvider(provider) {
|
|
20
20
|
return function (state, dispatch) {
|
|
21
21
|
if (dispatch) {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import { B400 } from '@atlaskit/theme/colors';
|
|
5
|
+
export var mentionPlaceholderPluginKey = new PluginKey('mentionPlaceholderPlugin');
|
|
6
|
+
export var MENTION_PLACEHOLDER_ACTIONS = {
|
|
7
|
+
SHOW_PLACEHOLDER: 'SHOW_PLACEHOLDER',
|
|
8
|
+
HIDE_PLACEHOLDER: 'HIDE_PLACEHOLDER'
|
|
9
|
+
};
|
|
10
|
+
export function createMentionPlaceholderPlugin() {
|
|
11
|
+
return new SafePlugin({
|
|
12
|
+
key: mentionPlaceholderPluginKey,
|
|
13
|
+
state: {
|
|
14
|
+
init: function init() {
|
|
15
|
+
return {};
|
|
16
|
+
},
|
|
17
|
+
apply: function apply(tr, pluginState) {
|
|
18
|
+
var meta = tr.getMeta(mentionPlaceholderPluginKey);
|
|
19
|
+
if ((meta === null || meta === void 0 ? void 0 : meta.action) === MENTION_PLACEHOLDER_ACTIONS.SHOW_PLACEHOLDER) {
|
|
20
|
+
return {
|
|
21
|
+
placeholder: meta.placeholder
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
if ((meta === null || meta === void 0 ? void 0 : meta.action) === MENTION_PLACEHOLDER_ACTIONS.HIDE_PLACEHOLDER) {
|
|
25
|
+
return {};
|
|
26
|
+
}
|
|
27
|
+
return pluginState;
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
props: {
|
|
31
|
+
decorations: function decorations(state) {
|
|
32
|
+
var pluginState = mentionPlaceholderPluginKey.getState(state);
|
|
33
|
+
if (pluginState !== null && pluginState !== void 0 && pluginState.placeholder) {
|
|
34
|
+
var selection = state.selection;
|
|
35
|
+
var span = document.createElement('span');
|
|
36
|
+
span.textContent = pluginState.placeholder;
|
|
37
|
+
span.style.setProperty('color', "var(--ds-text-accent-blue, ".concat(B400, ")"));
|
|
38
|
+
return DecorationSet.create(state.doc, [Decoration.widget(selection.from, span)]);
|
|
39
|
+
}
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React, { useCallback, useEffect, useState } from 'react';
|
|
5
|
+
import { mentionPlaceholderPluginKey, MENTION_PLACEHOLDER_ACTIONS } from '../pm-plugins/mentionPlaceholder';
|
|
5
6
|
import { MENTION_SOURCE } from '../ui/type-ahead/analytics';
|
|
6
7
|
/**
|
|
7
8
|
* Container that renders the recaptcha component from the mention provider and manages handleSuccess.
|
|
@@ -10,7 +11,7 @@ import { MENTION_SOURCE } from '../ui/type-ahead/analytics';
|
|
|
10
11
|
* mentionProvider.showInlineInviteRecaptcha(email) which passes email to the component.
|
|
11
12
|
*/
|
|
12
13
|
export var InlineInviteRecaptchaContainer = function InlineInviteRecaptchaContainer(_ref) {
|
|
13
|
-
var _api$mention2, _api$
|
|
14
|
+
var _api$mention2, _api$core3;
|
|
14
15
|
var mentionProvider = _ref.mentionProvider,
|
|
15
16
|
api = _ref.api;
|
|
16
17
|
var _useState = useState(null),
|
|
@@ -47,10 +48,27 @@ export var InlineInviteRecaptchaContainer = function InlineInviteRecaptchaContai
|
|
|
47
48
|
userType: 'DEFAULT',
|
|
48
49
|
accessLevel: 'CONTAINER'
|
|
49
50
|
}));
|
|
51
|
+
api.core.actions.execute(function (_ref2) {
|
|
52
|
+
var tr = _ref2.tr;
|
|
53
|
+
tr.setMeta(mentionPlaceholderPluginKey, {
|
|
54
|
+
action: MENTION_PLACEHOLDER_ACTIONS.HIDE_PLACEHOLDER
|
|
55
|
+
});
|
|
56
|
+
return tr;
|
|
57
|
+
});
|
|
50
58
|
}, [api]);
|
|
51
59
|
var handleClose = useCallback(function () {
|
|
52
|
-
|
|
53
|
-
|
|
60
|
+
var _api$core2;
|
|
61
|
+
if (!(api !== null && api !== void 0 && (_api$core2 = api.core) !== null && _api$core2 !== void 0 && (_api$core2 = _api$core2.actions) !== null && _api$core2 !== void 0 && _api$core2.execute)) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
api.core.actions.execute(function (_ref3) {
|
|
65
|
+
var tr = _ref3.tr;
|
|
66
|
+
tr.setMeta(mentionPlaceholderPluginKey, {
|
|
67
|
+
action: MENTION_PLACEHOLDER_ACTIONS.HIDE_PLACEHOLDER
|
|
68
|
+
});
|
|
69
|
+
return tr;
|
|
70
|
+
});
|
|
71
|
+
}, [api]);
|
|
54
72
|
var handleReady = useCallback(function (showRecaptcha) {
|
|
55
73
|
if (provider) {
|
|
56
74
|
if (showRecaptcha) {
|
|
@@ -60,7 +78,7 @@ export var InlineInviteRecaptchaContainer = function InlineInviteRecaptchaContai
|
|
|
60
78
|
}
|
|
61
79
|
}
|
|
62
80
|
}, [provider]);
|
|
63
|
-
if (!(provider !== null && provider !== void 0 && provider.InlineInviteRecaptcha) || !(api !== null && api !== void 0 && (_api$mention2 = api.mention) !== null && _api$mention2 !== void 0 && (_api$mention2 = _api$mention2.commands) !== null && _api$mention2 !== void 0 && _api$mention2.insertMention) || !(api !== null && api !== void 0 && (_api$
|
|
81
|
+
if (!(provider !== null && provider !== void 0 && provider.InlineInviteRecaptcha) || !(api !== null && api !== void 0 && (_api$mention2 = api.mention) !== null && _api$mention2 !== void 0 && (_api$mention2 = _api$mention2.commands) !== null && _api$mention2 !== void 0 && _api$mention2.insertMention) || !(api !== null && api !== void 0 && (_api$core3 = api.core) !== null && _api$core3 !== void 0 && (_api$core3 = _api$core3.actions) !== null && _api$core3 !== void 0 && _api$core3.execute)) {
|
|
64
82
|
return null;
|
|
65
83
|
}
|
|
66
84
|
var RecaptchaComponent = provider.InlineInviteRecaptcha;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
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
|
+
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; }
|
|
1
4
|
import { ACTION, ACTION_SUBJECT, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
5
|
import { isSpecialMention } from '@atlaskit/mention/resource';
|
|
3
6
|
import { isTeamType } from './utils';
|
|
@@ -47,7 +50,7 @@ var getPosition = function getPosition(mentionList, selectedMention) {
|
|
|
47
50
|
var isClicked = function isClicked(insertType) {
|
|
48
51
|
return insertType === 'selected';
|
|
49
52
|
};
|
|
50
|
-
export var buildTypeAheadInviteItemViewedPayload = function buildTypeAheadInviteItemViewedPayload(sessionId, contextIdentifierProvider, userRole) {
|
|
53
|
+
export var buildTypeAheadInviteItemViewedPayload = function buildTypeAheadInviteItemViewedPayload(sessionId, contextIdentifierProvider, userRole, additionalAttributes) {
|
|
51
54
|
var _ref = contextIdentifierProvider || {},
|
|
52
55
|
containerId = _ref.containerId,
|
|
53
56
|
objectId = _ref.objectId,
|
|
@@ -56,7 +59,7 @@ export var buildTypeAheadInviteItemViewedPayload = function buildTypeAheadInvite
|
|
|
56
59
|
action: ACTION.RENDERED,
|
|
57
60
|
actionSubject: ACTION_SUBJECT.INVITE_ITEM,
|
|
58
61
|
eventType: EVENT_TYPE.UI,
|
|
59
|
-
attributes: {
|
|
62
|
+
attributes: _objectSpread({
|
|
60
63
|
componentName: componentName,
|
|
61
64
|
containerId: containerId,
|
|
62
65
|
objectId: objectId,
|
|
@@ -64,10 +67,10 @@ export var buildTypeAheadInviteItemViewedPayload = function buildTypeAheadInvite
|
|
|
64
67
|
userRole: userRole,
|
|
65
68
|
sessionId: sessionId,
|
|
66
69
|
source: MENTION_SOURCE
|
|
67
|
-
}
|
|
70
|
+
}, additionalAttributes)
|
|
68
71
|
};
|
|
69
72
|
};
|
|
70
|
-
export var buildTypeAheadInviteItemClickedPayload = function buildTypeAheadInviteItemClickedPayload(duration, upKeyCount, downKeyCount, sessionId, insertType, query, contextIdentifierProvider, userRole) {
|
|
73
|
+
export var buildTypeAheadInviteItemClickedPayload = function buildTypeAheadInviteItemClickedPayload(duration, upKeyCount, downKeyCount, sessionId, insertType, query, contextIdentifierProvider, userRole, additionalAttributes) {
|
|
71
74
|
var _extractAttributesFro2 = extractAttributesFromQuery(query),
|
|
72
75
|
queryLength = _extractAttributesFro2.queryLength,
|
|
73
76
|
spaceInQuery = _extractAttributesFro2.spaceInQuery;
|
|
@@ -79,7 +82,7 @@ export var buildTypeAheadInviteItemClickedPayload = function buildTypeAheadInvit
|
|
|
79
82
|
action: isClicked(insertType) ? ACTION.CLICKED : ACTION.PRESSED,
|
|
80
83
|
actionSubject: ACTION_SUBJECT.INVITE_ITEM,
|
|
81
84
|
eventType: EVENT_TYPE.UI,
|
|
82
|
-
attributes: {
|
|
85
|
+
attributes: _objectSpread({
|
|
83
86
|
componentName: componentName,
|
|
84
87
|
duration: duration,
|
|
85
88
|
queryLength: queryLength,
|
|
@@ -92,7 +95,7 @@ export var buildTypeAheadInviteItemClickedPayload = function buildTypeAheadInvit
|
|
|
92
95
|
userRole: userRole,
|
|
93
96
|
sessionId: sessionId,
|
|
94
97
|
keyboardKey: isClicked(insertType) ? undefined : insertType
|
|
95
|
-
}
|
|
98
|
+
}, additionalAttributes)
|
|
96
99
|
};
|
|
97
100
|
};
|
|
98
101
|
export var buildTypeAheadInsertedPayload = function buildTypeAheadInsertedPayload(duration, upKeyCount, downKeyCount, sessionId, insertType, mention, mentionLocalId, mentionList, query, contextIdentifierProvider, taskListId, taskItemId) {
|
|
@@ -17,6 +17,7 @@ import { isResolvingMentionProvider } from '@atlaskit/mention/resource';
|
|
|
17
17
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
18
18
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
19
19
|
import { createSingleMentionFragment } from '../../editor-commands';
|
|
20
|
+
import { mentionPlaceholderPluginKey, MENTION_PLACEHOLDER_ACTIONS } from '../../pm-plugins/mentionPlaceholder';
|
|
20
21
|
import { getMentionPluginState } from '../../pm-plugins/utils';
|
|
21
22
|
import InviteItem, { INVITE_ITEM_DESCRIPTION } from '../InviteItem';
|
|
22
23
|
import InviteItemWithEmailDomain from '../InviteItem/InviteItemWithEmailDomain';
|
|
@@ -281,7 +282,10 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
281
282
|
firstQueryWithoutResults: firstQueryWithoutResults || '',
|
|
282
283
|
currentQuery: query,
|
|
283
284
|
onInviteItemMount: function onInviteItemMount() {
|
|
284
|
-
|
|
285
|
+
var _mentionProvider$getS2;
|
|
286
|
+
fireEvent(buildTypeAheadInviteItemViewedPayload(sessionId, contextIdentifierProvider, mentionProvider.userRole, fg('jira_invites_auto_tag_new_user_in_mentions_fg') ? {
|
|
287
|
+
isInlineInviteMentionsEnabled: (_mentionProvider$getS2 = mentionProvider.getShouldEnableInlineInvite) === null || _mentionProvider$getS2 === void 0 ? void 0 : _mentionProvider$getS2.call(mentionProvider)
|
|
288
|
+
} : {}));
|
|
285
289
|
},
|
|
286
290
|
emailDomain: emailDomain
|
|
287
291
|
})(mentionItems);
|
|
@@ -334,9 +338,11 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
334
338
|
if (mentionProvider && mentionProvider.shouldEnableInvite && isInviteItem(item.mention)) {
|
|
335
339
|
// Don't fire event and the callback with selection by space press
|
|
336
340
|
if (mode !== 'space') {
|
|
337
|
-
var _mentionProvider$
|
|
338
|
-
fireEvent(buildTypeAheadInviteItemClickedPayload(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, mode, query, contextIdentifierProvider, mentionProvider.userRole)
|
|
339
|
-
|
|
341
|
+
var _mentionProvider$getS3, _mentionProvider$getS4;
|
|
342
|
+
fireEvent(buildTypeAheadInviteItemClickedPayload(pickerElapsedTime, stats.keyCount.arrowUp, stats.keyCount.arrowDown, sessionId, mode, query, contextIdentifierProvider, mentionProvider.userRole, fg('jira_invites_auto_tag_new_user_in_mentions_fg') ? {
|
|
343
|
+
isInlineInviteMentionsEnabled: (_mentionProvider$getS3 = mentionProvider.getShouldEnableInlineInvite) === null || _mentionProvider$getS3 === void 0 ? void 0 : _mentionProvider$getS3.call(mentionProvider)
|
|
344
|
+
} : {}));
|
|
345
|
+
if ((_mentionProvider$getS4 = mentionProvider.getShouldEnableInlineInvite) !== null && _mentionProvider$getS4 !== void 0 && _mentionProvider$getS4.call(mentionProvider) && fg('jira_invites_auto_tag_new_user_in_mentions_fg')) {
|
|
340
346
|
// Get the email from query, using the same logic as InviteItemWithEmailDomain
|
|
341
347
|
var emailDomain = mentionProvider.userEmailDomain;
|
|
342
348
|
var email = query || '';
|
|
@@ -347,6 +353,12 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
347
353
|
// If query already includes @, use it as is
|
|
348
354
|
if (email && mentionProvider.showInlineInviteRecaptcha) {
|
|
349
355
|
mentionProvider.showInlineInviteRecaptcha(email);
|
|
356
|
+
var tr = state.tr;
|
|
357
|
+
tr.setMeta(mentionPlaceholderPluginKey, {
|
|
358
|
+
action: MENTION_PLACEHOLDER_ACTIONS.SHOW_PLACEHOLDER,
|
|
359
|
+
placeholder: "@".concat(query)
|
|
360
|
+
});
|
|
361
|
+
return tr;
|
|
350
362
|
}
|
|
351
363
|
} else if (mentionProvider.onInviteItemClick) {
|
|
352
364
|
// Fallback to old behavior for backward compatibility
|
|
@@ -23,6 +23,7 @@ export declare class MentionNodeView implements NodeView {
|
|
|
23
23
|
constructor(node: PMNode, config: MentionNodeViewProps);
|
|
24
24
|
private setClassList;
|
|
25
25
|
private setTextContent;
|
|
26
|
+
private shouldHighlightMention;
|
|
26
27
|
private updateState;
|
|
27
28
|
private nodeIsEqual;
|
|
28
29
|
update(node: PMNode): boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export declare const mentionPlaceholderPluginKey: PluginKey<any>;
|
|
4
|
+
export declare const MENTION_PLACEHOLDER_ACTIONS: {
|
|
5
|
+
SHOW_PLACEHOLDER: string;
|
|
6
|
+
HIDE_PLACEHOLDER: string;
|
|
7
|
+
};
|
|
8
|
+
export type MentionPlaceholderPluginState = {
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function createMentionPlaceholderPlugin(): SafePlugin<{}>;
|
|
@@ -23,6 +23,14 @@ export type MentionsChangedHandler = (changes: {
|
|
|
23
23
|
export interface MentionsPluginOptions extends MentionPluginConfig {
|
|
24
24
|
allowZeroWidthSpaceAfter?: boolean;
|
|
25
25
|
handleMentionsChanged?: MentionsChangedHandler;
|
|
26
|
+
/**
|
|
27
|
+
* User ID to highlight as a self-mention (typically the current user).
|
|
28
|
+
*
|
|
29
|
+
* When provided, mentions matching this ID will be highlighted immediately,
|
|
30
|
+
* without waiting for the mention provider to load. This enables instant highlighting on initial render.
|
|
31
|
+
* Takes priority over `MentionProvider.shouldHighlightMention()` if both are present.
|
|
32
|
+
*/
|
|
33
|
+
currentUserId?: string;
|
|
26
34
|
mentionProvider?: Providers['mentionProvider'];
|
|
27
35
|
sanitizePrivateContent?: boolean;
|
|
28
36
|
}
|
|
@@ -6,7 +6,7 @@ import type { MentionDescription } from '@atlaskit/mention/resource';
|
|
|
6
6
|
import type { TeamInfoAttrAnalytics } from '../../types';
|
|
7
7
|
export declare const MENTION_SOURCE = "mentionInEditor";
|
|
8
8
|
export declare const buildTypeAheadCancelPayload: (duration: number, upKeyCount: number, downKeyCount: number, sessionId: string, query?: string) => AnalyticsEventPayload;
|
|
9
|
-
export declare const buildTypeAheadInviteItemViewedPayload: (sessionId: string, contextIdentifierProvider?: ContextIdentifierProvider, userRole?: UserRole) => AnalyticsEventPayload;
|
|
10
|
-
export declare const buildTypeAheadInviteItemClickedPayload: (duration: number, upKeyCount: number, downKeyCount: number, sessionId: string, insertType: SelectItemMode, query?: string, contextIdentifierProvider?: ContextIdentifierProvider, userRole?: UserRole) => AnalyticsEventPayload;
|
|
9
|
+
export declare const buildTypeAheadInviteItemViewedPayload: (sessionId: string, contextIdentifierProvider?: ContextIdentifierProvider, userRole?: UserRole, additionalAttributes?: Record<string, unknown>) => AnalyticsEventPayload;
|
|
10
|
+
export declare const buildTypeAheadInviteItemClickedPayload: (duration: number, upKeyCount: number, downKeyCount: number, sessionId: string, insertType: SelectItemMode, query?: string, contextIdentifierProvider?: ContextIdentifierProvider, userRole?: UserRole, additionalAttributes?: Record<string, unknown>) => AnalyticsEventPayload;
|
|
11
11
|
export declare const buildTypeAheadInsertedPayload: (duration: number, upKeyCount: number, downKeyCount: number, sessionId: string, insertType: SelectItemMode, mention: MentionDescription, mentionLocalId: string, mentionList?: MentionDescription[], query?: string, contextIdentifierProvider?: ContextIdentifierProvider, taskListId?: string, taskItemId?: string) => AnalyticsEventPayload;
|
|
12
12
|
export declare const buildTypeAheadRenderedPayload: (duration: number, userIds: Array<string> | null, query: string, teams: TeamInfoAttrAnalytics[] | null, xProductMentionsLength: number) => AnalyticsEventPayload;
|
|
@@ -23,6 +23,7 @@ export declare class MentionNodeView implements NodeView {
|
|
|
23
23
|
constructor(node: PMNode, config: MentionNodeViewProps);
|
|
24
24
|
private setClassList;
|
|
25
25
|
private setTextContent;
|
|
26
|
+
private shouldHighlightMention;
|
|
26
27
|
private updateState;
|
|
27
28
|
private nodeIsEqual;
|
|
28
29
|
update(node: PMNode): boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
+
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export declare const mentionPlaceholderPluginKey: PluginKey<any>;
|
|
4
|
+
export declare const MENTION_PLACEHOLDER_ACTIONS: {
|
|
5
|
+
SHOW_PLACEHOLDER: string;
|
|
6
|
+
HIDE_PLACEHOLDER: string;
|
|
7
|
+
};
|
|
8
|
+
export type MentionPlaceholderPluginState = {
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function createMentionPlaceholderPlugin(): SafePlugin<{}>;
|
|
@@ -23,6 +23,14 @@ export type MentionsChangedHandler = (changes: {
|
|
|
23
23
|
export interface MentionsPluginOptions extends MentionPluginConfig {
|
|
24
24
|
allowZeroWidthSpaceAfter?: boolean;
|
|
25
25
|
handleMentionsChanged?: MentionsChangedHandler;
|
|
26
|
+
/**
|
|
27
|
+
* User ID to highlight as a self-mention (typically the current user).
|
|
28
|
+
*
|
|
29
|
+
* When provided, mentions matching this ID will be highlighted immediately,
|
|
30
|
+
* without waiting for the mention provider to load. This enables instant highlighting on initial render.
|
|
31
|
+
* Takes priority over `MentionProvider.shouldHighlightMention()` if both are present.
|
|
32
|
+
*/
|
|
33
|
+
currentUserId?: string;
|
|
26
34
|
mentionProvider?: Providers['mentionProvider'];
|
|
27
35
|
sanitizePrivateContent?: boolean;
|
|
28
36
|
}
|
|
@@ -6,7 +6,7 @@ import type { MentionDescription } from '@atlaskit/mention/resource';
|
|
|
6
6
|
import type { TeamInfoAttrAnalytics } from '../../types';
|
|
7
7
|
export declare const MENTION_SOURCE = "mentionInEditor";
|
|
8
8
|
export declare const buildTypeAheadCancelPayload: (duration: number, upKeyCount: number, downKeyCount: number, sessionId: string, query?: string) => AnalyticsEventPayload;
|
|
9
|
-
export declare const buildTypeAheadInviteItemViewedPayload: (sessionId: string, contextIdentifierProvider?: ContextIdentifierProvider, userRole?: UserRole) => AnalyticsEventPayload;
|
|
10
|
-
export declare const buildTypeAheadInviteItemClickedPayload: (duration: number, upKeyCount: number, downKeyCount: number, sessionId: string, insertType: SelectItemMode, query?: string, contextIdentifierProvider?: ContextIdentifierProvider, userRole?: UserRole) => AnalyticsEventPayload;
|
|
9
|
+
export declare const buildTypeAheadInviteItemViewedPayload: (sessionId: string, contextIdentifierProvider?: ContextIdentifierProvider, userRole?: UserRole, additionalAttributes?: Record<string, unknown>) => AnalyticsEventPayload;
|
|
10
|
+
export declare const buildTypeAheadInviteItemClickedPayload: (duration: number, upKeyCount: number, downKeyCount: number, sessionId: string, insertType: SelectItemMode, query?: string, contextIdentifierProvider?: ContextIdentifierProvider, userRole?: UserRole, additionalAttributes?: Record<string, unknown>) => AnalyticsEventPayload;
|
|
11
11
|
export declare const buildTypeAheadInsertedPayload: (duration: number, upKeyCount: number, downKeyCount: number, sessionId: string, insertType: SelectItemMode, mention: MentionDescription, mentionLocalId: string, mentionList?: MentionDescription[], query?: string, contextIdentifierProvider?: ContextIdentifierProvider, taskListId?: string, taskItemId?: string) => AnalyticsEventPayload;
|
|
12
12
|
export declare const buildTypeAheadRenderedPayload: (duration: number, userIds: Array<string> | null, query: string, teams: TeamInfoAttrAnalytics[] | null, xProductMentionsLength: number) => AnalyticsEventPayload;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-mentions",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.3.0",
|
|
4
4
|
"description": "Mentions plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -40,16 +40,16 @@
|
|
|
40
40
|
"@atlaskit/icon": "^31.0.0",
|
|
41
41
|
"@atlaskit/insm": "^0.3.0",
|
|
42
42
|
"@atlaskit/link": "^3.3.0",
|
|
43
|
-
"@atlaskit/mention": "^24.
|
|
43
|
+
"@atlaskit/mention": "^24.5.0",
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
45
45
|
"@atlaskit/popper": "^7.1.0",
|
|
46
46
|
"@atlaskit/portal": "^5.2.0",
|
|
47
47
|
"@atlaskit/primitives": "^18.0.0",
|
|
48
48
|
"@atlaskit/profilecard": "^24.37.0",
|
|
49
49
|
"@atlaskit/theme": "^21.0.0",
|
|
50
|
-
"@atlaskit/tmp-editor-statsig": "^29.
|
|
50
|
+
"@atlaskit/tmp-editor-statsig": "^29.6.0",
|
|
51
51
|
"@atlaskit/tokens": "^11.0.0",
|
|
52
|
-
"@atlaskit/user-picker": "^11.
|
|
52
|
+
"@atlaskit/user-picker": "^11.23.0",
|
|
53
53
|
"@babel/runtime": "^7.0.0",
|
|
54
54
|
"@compiled/react": "^0.18.6",
|
|
55
55
|
"bind-event-listener": "^3.0.0",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"uuid": "^3.1.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"@atlaskit/editor-common": "^111.
|
|
60
|
+
"@atlaskit/editor-common": "^111.19.0",
|
|
61
61
|
"react": "^18.2.0",
|
|
62
62
|
"react-dom": "^18.2.0",
|
|
63
63
|
"react-intl-next": "npm:react-intl@^5.18.1"
|