@atlaskit/editor-plugin-mentions 2.10.9 → 2.11.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 +14 -0
- package/dist/cjs/mentionsPlugin.js +57 -4
- package/dist/cjs/nodeviews/mention.js +8 -4
- package/dist/cjs/pm-plugins/main.js +24 -13
- package/dist/cjs/ui/type-ahead/index.js +5 -1
- package/dist/es2019/mentionsPlugin.js +29 -2
- package/dist/es2019/nodeviews/mention.js +9 -5
- package/dist/es2019/pm-plugins/main.js +15 -4
- package/dist/es2019/ui/type-ahead/index.js +5 -1
- package/dist/esm/mentionsPlugin.js +58 -5
- package/dist/esm/nodeviews/mention.js +8 -4
- package/dist/esm/pm-plugins/main.js +23 -13
- package/dist/esm/ui/type-ahead/index.js +5 -1
- package/dist/types/mentionsPluginType.d.ts +8 -0
- package/dist/types/nodeviews/mention.d.ts +3 -0
- package/dist/types/pm-plugins/main.d.ts +13 -2
- package/dist/types/types/index.d.ts +2 -0
- package/dist/types-ts4.5/mentionsPluginType.d.ts +8 -0
- package/dist/types-ts4.5/nodeviews/mention.d.ts +3 -0
- package/dist/types-ts4.5/pm-plugins/main.d.ts +13 -2
- package/dist/types-ts4.5/types/index.d.ts +2 -0
- package/package.json +6 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-mentions
|
|
2
2
|
|
|
3
|
+
## 2.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#99344](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/99344)
|
|
8
|
+
[`fbeb84f180cd2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fbeb84f180cd2) -
|
|
9
|
+
Added optional `isEligibleXProductUserInvite` and `inviteXProductUser` props which will be used in
|
|
10
|
+
CCEDITIONS-4746 (x-product-user-invite experiment). Project poster link -
|
|
11
|
+
https://hello.atlassian.net/wiki/spaces/CV1/pages/3685626022/Project+poster+-+Cross+Product+User+Search+Invites
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 2.10.9
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -5,13 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.mentionsPlugin = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
8
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
9
11
|
var _react = _interopRequireDefault(require("react"));
|
|
10
12
|
var _uuid = _interopRequireDefault(require("uuid"));
|
|
11
13
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
12
14
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
13
15
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
14
16
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
17
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
15
18
|
var _key = require("./pm-plugins/key");
|
|
16
19
|
var _main = require("./pm-plugins/main");
|
|
17
20
|
var _SecondaryToolbarComponent = require("./ui/SecondaryToolbarComponent");
|
|
@@ -22,6 +25,7 @@ var mentionsPlugin = exports.mentionsPlugin = function mentionsPlugin(_ref) {
|
|
|
22
25
|
var options = _ref.config,
|
|
23
26
|
api = _ref.api;
|
|
24
27
|
var sessionId = (0, _uuid.default)();
|
|
28
|
+
var previousMediaProvider;
|
|
25
29
|
var fireEvent = function fireEvent(payload, channel) {
|
|
26
30
|
var _api$analytics;
|
|
27
31
|
var fireAnalyticsEvent = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 ? void 0 : _api$analytics.fireAnalyticsEvent;
|
|
@@ -53,7 +57,12 @@ var mentionsPlugin = exports.mentionsPlugin = function mentionsPlugin(_ref) {
|
|
|
53
57
|
return [{
|
|
54
58
|
name: 'mention',
|
|
55
59
|
plugin: function plugin(pmPluginFactoryParams) {
|
|
56
|
-
return (0, _main.createMentionPlugin)(
|
|
60
|
+
return (0, _main.createMentionPlugin)({
|
|
61
|
+
pmPluginFactoryParams: pmPluginFactoryParams,
|
|
62
|
+
fireEvent: fireEvent,
|
|
63
|
+
options: options,
|
|
64
|
+
api: api
|
|
65
|
+
});
|
|
57
66
|
}
|
|
58
67
|
}];
|
|
59
68
|
},
|
|
@@ -79,7 +88,51 @@ var mentionsPlugin = exports.mentionsPlugin = function mentionsPlugin(_ref) {
|
|
|
79
88
|
if (options !== null && options !== void 0 && options.handleMentionsChanged) {
|
|
80
89
|
options.handleMentionsChanged(mentionChanges);
|
|
81
90
|
}
|
|
82
|
-
}
|
|
91
|
+
},
|
|
92
|
+
setProvider: function () {
|
|
93
|
+
var _setProvider = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(providerPromise) {
|
|
94
|
+
var _api$core$actions$exe;
|
|
95
|
+
var provider;
|
|
96
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
97
|
+
while (1) switch (_context.prev = _context.next) {
|
|
98
|
+
case 0:
|
|
99
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_mention_provider_via_plugin_config')) {
|
|
100
|
+
_context.next = 2;
|
|
101
|
+
break;
|
|
102
|
+
}
|
|
103
|
+
return _context.abrupt("return", false);
|
|
104
|
+
case 2:
|
|
105
|
+
_context.next = 4;
|
|
106
|
+
return providerPromise;
|
|
107
|
+
case 4:
|
|
108
|
+
provider = _context.sent;
|
|
109
|
+
if (!(previousMediaProvider === provider)) {
|
|
110
|
+
_context.next = 7;
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
return _context.abrupt("return", false);
|
|
114
|
+
case 7:
|
|
115
|
+
previousMediaProvider = provider;
|
|
116
|
+
return _context.abrupt("return", (_api$core$actions$exe = api === null || api === void 0 ? void 0 : api.core.actions.execute(function (_ref3) {
|
|
117
|
+
var tr = _ref3.tr;
|
|
118
|
+
return tr.setMeta(_key.mentionPluginKey, {
|
|
119
|
+
action: _main.ACTIONS.SET_PROVIDER,
|
|
120
|
+
params: {
|
|
121
|
+
provider: provider
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
})) !== null && _api$core$actions$exe !== void 0 ? _api$core$actions$exe : false);
|
|
125
|
+
case 9:
|
|
126
|
+
case "end":
|
|
127
|
+
return _context.stop();
|
|
128
|
+
}
|
|
129
|
+
}, _callee);
|
|
130
|
+
}));
|
|
131
|
+
function setProvider(_x) {
|
|
132
|
+
return _setProvider.apply(this, arguments);
|
|
133
|
+
}
|
|
134
|
+
return setProvider;
|
|
135
|
+
}()
|
|
83
136
|
},
|
|
84
137
|
getSharedState: function getSharedState(editorState) {
|
|
85
138
|
if (!editorState) {
|
|
@@ -91,8 +144,8 @@ var mentionsPlugin = exports.mentionsPlugin = function mentionsPlugin(_ref) {
|
|
|
91
144
|
});
|
|
92
145
|
},
|
|
93
146
|
pluginsOptions: {
|
|
94
|
-
quickInsert: function quickInsert(
|
|
95
|
-
var formatMessage =
|
|
147
|
+
quickInsert: function quickInsert(_ref4) {
|
|
148
|
+
var formatMessage = _ref4.formatMessage;
|
|
96
149
|
return [{
|
|
97
150
|
id: 'mention',
|
|
98
151
|
title: formatMessage(_messages.toolbarInsertBlockMessages.mention),
|
|
@@ -6,25 +6,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.MentionNodeView = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
9
10
|
var _providerFactory = require("@atlaskit/editor-common/provider-factory");
|
|
10
11
|
var _Mention = require("../ui/Mention");
|
|
11
12
|
var MentionNodeView = exports.MentionNodeView = function MentionNodeView(props) {
|
|
12
|
-
var providerFactory = props.providerFactory
|
|
13
|
+
var providerFactory = props.providerFactory,
|
|
14
|
+
pluginInjectionApi = props.pluginInjectionApi;
|
|
13
15
|
var _props$node$attrs = props.node.attrs,
|
|
14
16
|
id = _props$node$attrs.id,
|
|
15
17
|
text = _props$node$attrs.text,
|
|
16
18
|
accessLevel = _props$node$attrs.accessLevel,
|
|
17
19
|
localId = _props$node$attrs.localId;
|
|
20
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['mention']),
|
|
21
|
+
mentionState = _useSharedPluginState.mentionState;
|
|
22
|
+
var mentionProvider = mentionState === null || mentionState === void 0 ? void 0 : mentionState.mentionProvider;
|
|
18
23
|
var renderAssistiveTextWithProviders = function renderAssistiveTextWithProviders(providers) {
|
|
19
24
|
var _props$options;
|
|
20
|
-
var
|
|
21
|
-
mentionProvider = _ref.mentionProvider;
|
|
25
|
+
var mentionProviderPromise = mentionProvider ? Promise.resolve(mentionProvider) : providers.mentionProvider;
|
|
22
26
|
var profilecardProvider = (_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.profilecardProvider;
|
|
23
27
|
return /*#__PURE__*/_react.default.createElement(_Mention.Mention, {
|
|
24
28
|
id: id,
|
|
25
29
|
text: text,
|
|
26
30
|
accessLevel: accessLevel,
|
|
27
|
-
mentionProvider:
|
|
31
|
+
mentionProvider: mentionProviderPromise,
|
|
28
32
|
profilecardProvider: profilecardProvider,
|
|
29
33
|
localId: localId
|
|
30
34
|
});
|
|
@@ -4,6 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
exports.ACTIONS = void 0;
|
|
7
8
|
exports.createMentionPlugin = createMentionPlugin;
|
|
8
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
@@ -19,11 +20,11 @@ var _key = require("./key");
|
|
|
19
20
|
var _utils2 = require("./utils");
|
|
20
21
|
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; }
|
|
21
22
|
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; }
|
|
22
|
-
var ACTIONS = {
|
|
23
|
+
var ACTIONS = exports.ACTIONS = {
|
|
23
24
|
SET_PROVIDER: 'SET_PROVIDER'
|
|
24
25
|
};
|
|
25
26
|
var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
|
|
26
|
-
var PACKAGE_VERSION = "2.
|
|
27
|
+
var PACKAGE_VERSION = "2.11.0";
|
|
27
28
|
var setProvider = function setProvider(provider) {
|
|
28
29
|
return function (state, dispatch) {
|
|
29
30
|
if (dispatch) {
|
|
@@ -37,7 +38,11 @@ var setProvider = function setProvider(provider) {
|
|
|
37
38
|
return true;
|
|
38
39
|
};
|
|
39
40
|
};
|
|
40
|
-
function createMentionPlugin(
|
|
41
|
+
function createMentionPlugin(_ref) {
|
|
42
|
+
var pmPluginFactoryParams = _ref.pmPluginFactoryParams,
|
|
43
|
+
fireEvent = _ref.fireEvent,
|
|
44
|
+
options = _ref.options,
|
|
45
|
+
api = _ref.api;
|
|
41
46
|
var mentionProvider;
|
|
42
47
|
var sendAnalytics = function sendAnalytics(event, actionSubject, action, attributes
|
|
43
48
|
// Ignored via go/ees005
|
|
@@ -68,12 +73,12 @@ function createMentionPlugin(pmPluginFactoryParams, fireEvent, options) {
|
|
|
68
73
|
// Ignored via go/ees005
|
|
69
74
|
// eslint-disable-next-line @typescript-eslint/max-params
|
|
70
75
|
apply: function apply(tr, pluginState, oldState, newState) {
|
|
71
|
-
var
|
|
76
|
+
var _ref2 = tr.getMeta(_key.mentionPluginKey) || {
|
|
72
77
|
action: null,
|
|
73
78
|
params: null
|
|
74
79
|
},
|
|
75
|
-
action =
|
|
76
|
-
params =
|
|
80
|
+
action = _ref2.action,
|
|
81
|
+
params = _ref2.params;
|
|
77
82
|
var hasNewPluginState = false;
|
|
78
83
|
var newPluginState = pluginState;
|
|
79
84
|
var hasPositionChanged = oldState.selection.from !== newState.selection.from || oldState.selection.to !== newState.selection.to;
|
|
@@ -104,6 +109,7 @@ function createMentionPlugin(pmPluginFactoryParams, fireEvent, options) {
|
|
|
104
109
|
Component: _mention.MentionNodeView,
|
|
105
110
|
extraComponentProps: {
|
|
106
111
|
providerFactory: pmPluginFactoryParams.providerFactory,
|
|
112
|
+
pluginInjectionApi: api,
|
|
107
113
|
options: options
|
|
108
114
|
}
|
|
109
115
|
})
|
|
@@ -148,7 +154,12 @@ function createMentionPlugin(pmPluginFactoryParams, fireEvent, options) {
|
|
|
148
154
|
}
|
|
149
155
|
return;
|
|
150
156
|
};
|
|
151
|
-
|
|
157
|
+
var providerViaConfig = (0, _platformFeatureFlags.fg)('platform_editor_mention_provider_via_plugin_config');
|
|
158
|
+
if (providerViaConfig && options !== null && options !== void 0 && options.mentionProvider) {
|
|
159
|
+
providerHandler('mentionProvider', options === null || options === void 0 ? void 0 : options.mentionProvider);
|
|
160
|
+
} else {
|
|
161
|
+
pmPluginFactoryParams.providerFactory.subscribe('mentionProvider', providerHandler);
|
|
162
|
+
}
|
|
152
163
|
return {
|
|
153
164
|
destroy: function destroy() {
|
|
154
165
|
if (pmPluginFactoryParams.providerFactory) {
|
|
@@ -163,16 +174,16 @@ function createMentionPlugin(pmPluginFactoryParams, fireEvent, options) {
|
|
|
163
174
|
if (options !== null && options !== void 0 && options.handleMentionsChanged && (0, _platformFeatureFlags.fg)('confluence_updated_mentions_livepages')) {
|
|
164
175
|
var mentionSchema = newState.schema.nodes.mention;
|
|
165
176
|
var mentionNodesBefore = (0, _utils.findChildrenByType)(prevState.doc, mentionSchema);
|
|
166
|
-
var mentionLocalIdsAfter = new Set((0, _utils.findChildrenByType)(newState.doc, mentionSchema).map(function (
|
|
167
|
-
var node =
|
|
177
|
+
var mentionLocalIdsAfter = new Set((0, _utils.findChildrenByType)(newState.doc, mentionSchema).map(function (_ref3) {
|
|
178
|
+
var node = _ref3.node;
|
|
168
179
|
return node.attrs.localId;
|
|
169
180
|
}));
|
|
170
181
|
if (mentionNodesBefore.length > mentionLocalIdsAfter.size) {
|
|
171
|
-
var deletedMentions = mentionNodesBefore.filter(function (
|
|
172
|
-
var node = _ref3.node;
|
|
173
|
-
return !mentionLocalIdsAfter.has(node.attrs.localId);
|
|
174
|
-
}).map(function (_ref4) {
|
|
182
|
+
var deletedMentions = mentionNodesBefore.filter(function (_ref4) {
|
|
175
183
|
var node = _ref4.node;
|
|
184
|
+
return !mentionLocalIdsAfter.has(node.attrs.localId);
|
|
185
|
+
}).map(function (_ref5) {
|
|
186
|
+
var node = _ref5.node;
|
|
176
187
|
return {
|
|
177
188
|
type: 'deleted',
|
|
178
189
|
id: node.attrs.id,
|
|
@@ -299,7 +299,8 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
299
299
|
name = _item$mention.name,
|
|
300
300
|
nickname = _item$mention.nickname,
|
|
301
301
|
accessLevel = _item$mention.accessLevel,
|
|
302
|
-
userType = _item$mention.userType
|
|
302
|
+
userType = _item$mention.userType,
|
|
303
|
+
isXProductUser = _item$mention.isXProductUser;
|
|
303
304
|
var trimmedNickname = nickname && nickname.startsWith('@') ? nickname.slice(1) : nickname;
|
|
304
305
|
var renderName = mentionInsertDisplayName || !trimmedNickname ? name : trimmedNickname;
|
|
305
306
|
var _ref10 = (_api$contextIdentifie3 = api === null || api === void 0 || (_api$contextIdentifie4 = api.contextIdentifier) === null || _api$contextIdentifie4 === void 0 ? void 0 : _api$contextIdentifie4.sharedState.currentState()) !== null && _api$contextIdentifie3 !== void 0 ? _api$contextIdentifie3 : {},
|
|
@@ -356,6 +357,9 @@ var createTypeAheadConfig = exports.createTypeAheadConfig = function createTypeA
|
|
|
356
357
|
if (mentionProvider && (0, _utils4.isTeamType)(userType)) {
|
|
357
358
|
return insert(buildNodesForTeamMention(schema, item.mention, mentionProvider, sanitizePrivateContent));
|
|
358
359
|
}
|
|
360
|
+
if (isXProductUser && mentionProvider && mentionProvider.inviteXProductUser) {
|
|
361
|
+
mentionProvider.inviteXProductUser(id);
|
|
362
|
+
}
|
|
359
363
|
|
|
360
364
|
// Don't insert into document if document data is sanitized.
|
|
361
365
|
var text = sanitizePrivateContent ? '' : "@".concat(renderName);
|
|
@@ -4,8 +4,9 @@ import { mention } from '@atlaskit/adf-schema';
|
|
|
4
4
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
6
|
import { IconMention } from '@atlaskit/editor-common/quick-insert';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { mentionPluginKey } from './pm-plugins/key';
|
|
8
|
-
import { createMentionPlugin } from './pm-plugins/main';
|
|
9
|
+
import { ACTIONS, createMentionPlugin } from './pm-plugins/main';
|
|
9
10
|
import { SecondaryToolbarComponent } from './ui/SecondaryToolbarComponent';
|
|
10
11
|
import { createTypeAheadConfig } from './ui/type-ahead';
|
|
11
12
|
const mentionsPlugin = ({
|
|
@@ -13,6 +14,7 @@ const mentionsPlugin = ({
|
|
|
13
14
|
api
|
|
14
15
|
}) => {
|
|
15
16
|
const sessionId = uuid();
|
|
17
|
+
let previousMediaProvider;
|
|
16
18
|
const fireEvent = (payload, channel) => {
|
|
17
19
|
var _api$analytics, _api$analytics$action;
|
|
18
20
|
const fireAnalyticsEvent = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : (_api$analytics$action = _api$analytics.actions) === null || _api$analytics$action === void 0 ? void 0 : _api$analytics$action.fireAnalyticsEvent;
|
|
@@ -43,7 +45,12 @@ const mentionsPlugin = ({
|
|
|
43
45
|
pmPlugins() {
|
|
44
46
|
return [{
|
|
45
47
|
name: 'mention',
|
|
46
|
-
plugin: pmPluginFactoryParams => createMentionPlugin(
|
|
48
|
+
plugin: pmPluginFactoryParams => createMentionPlugin({
|
|
49
|
+
pmPluginFactoryParams,
|
|
50
|
+
fireEvent,
|
|
51
|
+
options,
|
|
52
|
+
api
|
|
53
|
+
})
|
|
47
54
|
}];
|
|
48
55
|
},
|
|
49
56
|
secondaryToolbarComponent({
|
|
@@ -69,6 +76,26 @@ const mentionsPlugin = ({
|
|
|
69
76
|
if (options !== null && options !== void 0 && options.handleMentionsChanged) {
|
|
70
77
|
options.handleMentionsChanged(mentionChanges);
|
|
71
78
|
}
|
|
79
|
+
},
|
|
80
|
+
setProvider: async providerPromise => {
|
|
81
|
+
var _api$core$actions$exe;
|
|
82
|
+
if (!fg('platform_editor_mention_provider_via_plugin_config')) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
const provider = await providerPromise;
|
|
86
|
+
// Prevent someone trying to set the exact same provider twice for performance reasons
|
|
87
|
+
if (previousMediaProvider === provider) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
previousMediaProvider = provider;
|
|
91
|
+
return (_api$core$actions$exe = api === null || api === void 0 ? void 0 : api.core.actions.execute(({
|
|
92
|
+
tr
|
|
93
|
+
}) => tr.setMeta(mentionPluginKey, {
|
|
94
|
+
action: ACTIONS.SET_PROVIDER,
|
|
95
|
+
params: {
|
|
96
|
+
provider
|
|
97
|
+
}
|
|
98
|
+
}))) !== null && _api$core$actions$exe !== void 0 ? _api$core$actions$exe : false;
|
|
72
99
|
}
|
|
73
100
|
},
|
|
74
101
|
getSharedState(editorState) {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
2
3
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
3
4
|
import { Mention } from '../ui/Mention';
|
|
4
5
|
export const MentionNodeView = props => {
|
|
5
6
|
const {
|
|
6
|
-
providerFactory
|
|
7
|
+
providerFactory,
|
|
8
|
+
pluginInjectionApi
|
|
7
9
|
} = props;
|
|
8
10
|
const {
|
|
9
11
|
id,
|
|
@@ -11,17 +13,19 @@ export const MentionNodeView = props => {
|
|
|
11
13
|
accessLevel,
|
|
12
14
|
localId
|
|
13
15
|
} = props.node.attrs;
|
|
16
|
+
const {
|
|
17
|
+
mentionState
|
|
18
|
+
} = useSharedPluginState(pluginInjectionApi, ['mention']);
|
|
19
|
+
const mentionProvider = mentionState === null || mentionState === void 0 ? void 0 : mentionState.mentionProvider;
|
|
14
20
|
const renderAssistiveTextWithProviders = providers => {
|
|
15
21
|
var _props$options;
|
|
16
|
-
const
|
|
17
|
-
mentionProvider
|
|
18
|
-
} = providers;
|
|
22
|
+
const mentionProviderPromise = mentionProvider ? Promise.resolve(mentionProvider) : providers.mentionProvider;
|
|
19
23
|
const profilecardProvider = (_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.profilecardProvider;
|
|
20
24
|
return /*#__PURE__*/React.createElement(Mention, {
|
|
21
25
|
id: id,
|
|
22
26
|
text: text,
|
|
23
27
|
accessLevel: accessLevel,
|
|
24
|
-
mentionProvider:
|
|
28
|
+
mentionProvider: mentionProviderPromise,
|
|
25
29
|
profilecardProvider: profilecardProvider,
|
|
26
30
|
localId: localId
|
|
27
31
|
});
|
|
@@ -9,11 +9,11 @@ import { MentionNodeView } from '../nodeviews/mention';
|
|
|
9
9
|
import { MENTION_PROVIDER_REJECTED, MENTION_PROVIDER_UNDEFINED } from '../types';
|
|
10
10
|
import { mentionPluginKey } from './key';
|
|
11
11
|
import { canMentionBeCreatedInRange } from './utils';
|
|
12
|
-
const ACTIONS = {
|
|
12
|
+
export const ACTIONS = {
|
|
13
13
|
SET_PROVIDER: 'SET_PROVIDER'
|
|
14
14
|
};
|
|
15
15
|
const PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
|
|
16
|
-
const PACKAGE_VERSION = "2.
|
|
16
|
+
const PACKAGE_VERSION = "2.11.0";
|
|
17
17
|
const setProvider = provider => (state, dispatch) => {
|
|
18
18
|
if (dispatch) {
|
|
19
19
|
dispatch(state.tr.setMeta(mentionPluginKey, {
|
|
@@ -25,7 +25,12 @@ const setProvider = provider => (state, dispatch) => {
|
|
|
25
25
|
}
|
|
26
26
|
return true;
|
|
27
27
|
};
|
|
28
|
-
export function createMentionPlugin(
|
|
28
|
+
export function createMentionPlugin({
|
|
29
|
+
pmPluginFactoryParams,
|
|
30
|
+
fireEvent,
|
|
31
|
+
options,
|
|
32
|
+
api
|
|
33
|
+
}) {
|
|
29
34
|
let mentionProvider;
|
|
30
35
|
const sendAnalytics = (event, actionSubject, action, attributes
|
|
31
36
|
// Ignored via go/ees005
|
|
@@ -96,6 +101,7 @@ export function createMentionPlugin(pmPluginFactoryParams, fireEvent, options) {
|
|
|
96
101
|
Component: MentionNodeView,
|
|
97
102
|
extraComponentProps: {
|
|
98
103
|
providerFactory: pmPluginFactoryParams.providerFactory,
|
|
104
|
+
pluginInjectionApi: api,
|
|
99
105
|
options
|
|
100
106
|
}
|
|
101
107
|
})
|
|
@@ -140,7 +146,12 @@ export function createMentionPlugin(pmPluginFactoryParams, fireEvent, options) {
|
|
|
140
146
|
}
|
|
141
147
|
return;
|
|
142
148
|
};
|
|
143
|
-
|
|
149
|
+
const providerViaConfig = fg('platform_editor_mention_provider_via_plugin_config');
|
|
150
|
+
if (providerViaConfig && options !== null && options !== void 0 && options.mentionProvider) {
|
|
151
|
+
providerHandler('mentionProvider', options === null || options === void 0 ? void 0 : options.mentionProvider);
|
|
152
|
+
} else {
|
|
153
|
+
pmPluginFactoryParams.providerFactory.subscribe('mentionProvider', providerHandler);
|
|
154
|
+
}
|
|
144
155
|
return {
|
|
145
156
|
destroy() {
|
|
146
157
|
if (pmPluginFactoryParams.providerFactory) {
|
|
@@ -282,7 +282,8 @@ export const createTypeAheadConfig = ({
|
|
|
282
282
|
name,
|
|
283
283
|
nickname,
|
|
284
284
|
accessLevel,
|
|
285
|
-
userType
|
|
285
|
+
userType,
|
|
286
|
+
isXProductUser
|
|
286
287
|
} = item.mention;
|
|
287
288
|
const trimmedNickname = nickname && nickname.startsWith('@') ? nickname.slice(1) : nickname;
|
|
288
289
|
const renderName = mentionInsertDisplayName || !trimmedNickname ? name : trimmedNickname;
|
|
@@ -340,6 +341,9 @@ export const createTypeAheadConfig = ({
|
|
|
340
341
|
if (mentionProvider && isTeamType(userType)) {
|
|
341
342
|
return insert(buildNodesForTeamMention(schema, item.mention, mentionProvider, sanitizePrivateContent));
|
|
342
343
|
}
|
|
344
|
+
if (isXProductUser && mentionProvider && mentionProvider.inviteXProductUser) {
|
|
345
|
+
mentionProvider.inviteXProductUser(id);
|
|
346
|
+
}
|
|
343
347
|
|
|
344
348
|
// Don't insert into document if document data is sanitized.
|
|
345
349
|
const text = sanitizePrivateContent ? '' : `@${renderName}`;
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
3
|
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
4
|
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; }
|
|
5
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
6
|
import React from 'react';
|
|
5
7
|
import uuid from 'uuid';
|
|
6
8
|
import { mention } from '@atlaskit/adf-schema';
|
|
7
9
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
8
10
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
9
11
|
import { IconMention } from '@atlaskit/editor-common/quick-insert';
|
|
12
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
13
|
import { mentionPluginKey } from './pm-plugins/key';
|
|
11
|
-
import { createMentionPlugin } from './pm-plugins/main';
|
|
14
|
+
import { ACTIONS, createMentionPlugin } from './pm-plugins/main';
|
|
12
15
|
import { SecondaryToolbarComponent } from './ui/SecondaryToolbarComponent';
|
|
13
16
|
import { createTypeAheadConfig } from './ui/type-ahead';
|
|
14
17
|
var mentionsPlugin = function mentionsPlugin(_ref) {
|
|
15
18
|
var options = _ref.config,
|
|
16
19
|
api = _ref.api;
|
|
17
20
|
var sessionId = uuid();
|
|
21
|
+
var previousMediaProvider;
|
|
18
22
|
var fireEvent = function fireEvent(payload, channel) {
|
|
19
23
|
var _api$analytics;
|
|
20
24
|
var fireAnalyticsEvent = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 || (_api$analytics = _api$analytics.actions) === null || _api$analytics === void 0 ? void 0 : _api$analytics.fireAnalyticsEvent;
|
|
@@ -46,7 +50,12 @@ var mentionsPlugin = function mentionsPlugin(_ref) {
|
|
|
46
50
|
return [{
|
|
47
51
|
name: 'mention',
|
|
48
52
|
plugin: function plugin(pmPluginFactoryParams) {
|
|
49
|
-
return createMentionPlugin(
|
|
53
|
+
return createMentionPlugin({
|
|
54
|
+
pmPluginFactoryParams: pmPluginFactoryParams,
|
|
55
|
+
fireEvent: fireEvent,
|
|
56
|
+
options: options,
|
|
57
|
+
api: api
|
|
58
|
+
});
|
|
50
59
|
}
|
|
51
60
|
}];
|
|
52
61
|
},
|
|
@@ -72,7 +81,51 @@ var mentionsPlugin = function mentionsPlugin(_ref) {
|
|
|
72
81
|
if (options !== null && options !== void 0 && options.handleMentionsChanged) {
|
|
73
82
|
options.handleMentionsChanged(mentionChanges);
|
|
74
83
|
}
|
|
75
|
-
}
|
|
84
|
+
},
|
|
85
|
+
setProvider: function () {
|
|
86
|
+
var _setProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(providerPromise) {
|
|
87
|
+
var _api$core$actions$exe;
|
|
88
|
+
var provider;
|
|
89
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
90
|
+
while (1) switch (_context.prev = _context.next) {
|
|
91
|
+
case 0:
|
|
92
|
+
if (fg('platform_editor_mention_provider_via_plugin_config')) {
|
|
93
|
+
_context.next = 2;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
return _context.abrupt("return", false);
|
|
97
|
+
case 2:
|
|
98
|
+
_context.next = 4;
|
|
99
|
+
return providerPromise;
|
|
100
|
+
case 4:
|
|
101
|
+
provider = _context.sent;
|
|
102
|
+
if (!(previousMediaProvider === provider)) {
|
|
103
|
+
_context.next = 7;
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
return _context.abrupt("return", false);
|
|
107
|
+
case 7:
|
|
108
|
+
previousMediaProvider = provider;
|
|
109
|
+
return _context.abrupt("return", (_api$core$actions$exe = api === null || api === void 0 ? void 0 : api.core.actions.execute(function (_ref3) {
|
|
110
|
+
var tr = _ref3.tr;
|
|
111
|
+
return tr.setMeta(mentionPluginKey, {
|
|
112
|
+
action: ACTIONS.SET_PROVIDER,
|
|
113
|
+
params: {
|
|
114
|
+
provider: provider
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
})) !== null && _api$core$actions$exe !== void 0 ? _api$core$actions$exe : false);
|
|
118
|
+
case 9:
|
|
119
|
+
case "end":
|
|
120
|
+
return _context.stop();
|
|
121
|
+
}
|
|
122
|
+
}, _callee);
|
|
123
|
+
}));
|
|
124
|
+
function setProvider(_x) {
|
|
125
|
+
return _setProvider.apply(this, arguments);
|
|
126
|
+
}
|
|
127
|
+
return setProvider;
|
|
128
|
+
}()
|
|
76
129
|
},
|
|
77
130
|
getSharedState: function getSharedState(editorState) {
|
|
78
131
|
if (!editorState) {
|
|
@@ -84,8 +137,8 @@ var mentionsPlugin = function mentionsPlugin(_ref) {
|
|
|
84
137
|
});
|
|
85
138
|
},
|
|
86
139
|
pluginsOptions: {
|
|
87
|
-
quickInsert: function quickInsert(
|
|
88
|
-
var formatMessage =
|
|
140
|
+
quickInsert: function quickInsert(_ref4) {
|
|
141
|
+
var formatMessage = _ref4.formatMessage;
|
|
89
142
|
return [{
|
|
90
143
|
id: 'mention',
|
|
91
144
|
title: formatMessage(messages.mention),
|
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
|
|
2
3
|
import { WithProviders } from '@atlaskit/editor-common/provider-factory';
|
|
3
4
|
import { Mention } from '../ui/Mention';
|
|
4
5
|
export var MentionNodeView = function MentionNodeView(props) {
|
|
5
|
-
var providerFactory = props.providerFactory
|
|
6
|
+
var providerFactory = props.providerFactory,
|
|
7
|
+
pluginInjectionApi = props.pluginInjectionApi;
|
|
6
8
|
var _props$node$attrs = props.node.attrs,
|
|
7
9
|
id = _props$node$attrs.id,
|
|
8
10
|
text = _props$node$attrs.text,
|
|
9
11
|
accessLevel = _props$node$attrs.accessLevel,
|
|
10
12
|
localId = _props$node$attrs.localId;
|
|
13
|
+
var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['mention']),
|
|
14
|
+
mentionState = _useSharedPluginState.mentionState;
|
|
15
|
+
var mentionProvider = mentionState === null || mentionState === void 0 ? void 0 : mentionState.mentionProvider;
|
|
11
16
|
var renderAssistiveTextWithProviders = function renderAssistiveTextWithProviders(providers) {
|
|
12
17
|
var _props$options;
|
|
13
|
-
var
|
|
14
|
-
mentionProvider = _ref.mentionProvider;
|
|
18
|
+
var mentionProviderPromise = mentionProvider ? Promise.resolve(mentionProvider) : providers.mentionProvider;
|
|
15
19
|
var profilecardProvider = (_props$options = props.options) === null || _props$options === void 0 ? void 0 : _props$options.profilecardProvider;
|
|
16
20
|
return /*#__PURE__*/React.createElement(Mention, {
|
|
17
21
|
id: id,
|
|
18
22
|
text: text,
|
|
19
23
|
accessLevel: accessLevel,
|
|
20
|
-
mentionProvider:
|
|
24
|
+
mentionProvider: mentionProviderPromise,
|
|
21
25
|
profilecardProvider: profilecardProvider,
|
|
22
26
|
localId: localId
|
|
23
27
|
});
|
|
@@ -12,11 +12,11 @@ import { MentionNodeView } from '../nodeviews/mention';
|
|
|
12
12
|
import { MENTION_PROVIDER_REJECTED, MENTION_PROVIDER_UNDEFINED } from '../types';
|
|
13
13
|
import { mentionPluginKey } from './key';
|
|
14
14
|
import { canMentionBeCreatedInRange } from './utils';
|
|
15
|
-
var ACTIONS = {
|
|
15
|
+
export var ACTIONS = {
|
|
16
16
|
SET_PROVIDER: 'SET_PROVIDER'
|
|
17
17
|
};
|
|
18
18
|
var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
|
|
19
|
-
var PACKAGE_VERSION = "2.
|
|
19
|
+
var PACKAGE_VERSION = "2.11.0";
|
|
20
20
|
var setProvider = function setProvider(provider) {
|
|
21
21
|
return function (state, dispatch) {
|
|
22
22
|
if (dispatch) {
|
|
@@ -30,7 +30,11 @@ var setProvider = function setProvider(provider) {
|
|
|
30
30
|
return true;
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
-
export function createMentionPlugin(
|
|
33
|
+
export function createMentionPlugin(_ref) {
|
|
34
|
+
var pmPluginFactoryParams = _ref.pmPluginFactoryParams,
|
|
35
|
+
fireEvent = _ref.fireEvent,
|
|
36
|
+
options = _ref.options,
|
|
37
|
+
api = _ref.api;
|
|
34
38
|
var mentionProvider;
|
|
35
39
|
var sendAnalytics = function sendAnalytics(event, actionSubject, action, attributes
|
|
36
40
|
// Ignored via go/ees005
|
|
@@ -61,12 +65,12 @@ export function createMentionPlugin(pmPluginFactoryParams, fireEvent, options) {
|
|
|
61
65
|
// Ignored via go/ees005
|
|
62
66
|
// eslint-disable-next-line @typescript-eslint/max-params
|
|
63
67
|
apply: function apply(tr, pluginState, oldState, newState) {
|
|
64
|
-
var
|
|
68
|
+
var _ref2 = tr.getMeta(mentionPluginKey) || {
|
|
65
69
|
action: null,
|
|
66
70
|
params: null
|
|
67
71
|
},
|
|
68
|
-
action =
|
|
69
|
-
params =
|
|
72
|
+
action = _ref2.action,
|
|
73
|
+
params = _ref2.params;
|
|
70
74
|
var hasNewPluginState = false;
|
|
71
75
|
var newPluginState = pluginState;
|
|
72
76
|
var hasPositionChanged = oldState.selection.from !== newState.selection.from || oldState.selection.to !== newState.selection.to;
|
|
@@ -97,6 +101,7 @@ export function createMentionPlugin(pmPluginFactoryParams, fireEvent, options) {
|
|
|
97
101
|
Component: MentionNodeView,
|
|
98
102
|
extraComponentProps: {
|
|
99
103
|
providerFactory: pmPluginFactoryParams.providerFactory,
|
|
104
|
+
pluginInjectionApi: api,
|
|
100
105
|
options: options
|
|
101
106
|
}
|
|
102
107
|
})
|
|
@@ -141,7 +146,12 @@ export function createMentionPlugin(pmPluginFactoryParams, fireEvent, options) {
|
|
|
141
146
|
}
|
|
142
147
|
return;
|
|
143
148
|
};
|
|
144
|
-
|
|
149
|
+
var providerViaConfig = fg('platform_editor_mention_provider_via_plugin_config');
|
|
150
|
+
if (providerViaConfig && options !== null && options !== void 0 && options.mentionProvider) {
|
|
151
|
+
providerHandler('mentionProvider', options === null || options === void 0 ? void 0 : options.mentionProvider);
|
|
152
|
+
} else {
|
|
153
|
+
pmPluginFactoryParams.providerFactory.subscribe('mentionProvider', providerHandler);
|
|
154
|
+
}
|
|
145
155
|
return {
|
|
146
156
|
destroy: function destroy() {
|
|
147
157
|
if (pmPluginFactoryParams.providerFactory) {
|
|
@@ -156,16 +166,16 @@ export function createMentionPlugin(pmPluginFactoryParams, fireEvent, options) {
|
|
|
156
166
|
if (options !== null && options !== void 0 && options.handleMentionsChanged && fg('confluence_updated_mentions_livepages')) {
|
|
157
167
|
var mentionSchema = newState.schema.nodes.mention;
|
|
158
168
|
var mentionNodesBefore = findChildrenByType(prevState.doc, mentionSchema);
|
|
159
|
-
var mentionLocalIdsAfter = new Set(findChildrenByType(newState.doc, mentionSchema).map(function (
|
|
160
|
-
var node =
|
|
169
|
+
var mentionLocalIdsAfter = new Set(findChildrenByType(newState.doc, mentionSchema).map(function (_ref3) {
|
|
170
|
+
var node = _ref3.node;
|
|
161
171
|
return node.attrs.localId;
|
|
162
172
|
}));
|
|
163
173
|
if (mentionNodesBefore.length > mentionLocalIdsAfter.size) {
|
|
164
|
-
var deletedMentions = mentionNodesBefore.filter(function (
|
|
165
|
-
var node = _ref3.node;
|
|
166
|
-
return !mentionLocalIdsAfter.has(node.attrs.localId);
|
|
167
|
-
}).map(function (_ref4) {
|
|
174
|
+
var deletedMentions = mentionNodesBefore.filter(function (_ref4) {
|
|
168
175
|
var node = _ref4.node;
|
|
176
|
+
return !mentionLocalIdsAfter.has(node.attrs.localId);
|
|
177
|
+
}).map(function (_ref5) {
|
|
178
|
+
var node = _ref5.node;
|
|
169
179
|
return {
|
|
170
180
|
type: 'deleted',
|
|
171
181
|
id: node.attrs.id,
|
|
@@ -287,7 +287,8 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
287
287
|
name = _item$mention.name,
|
|
288
288
|
nickname = _item$mention.nickname,
|
|
289
289
|
accessLevel = _item$mention.accessLevel,
|
|
290
|
-
userType = _item$mention.userType
|
|
290
|
+
userType = _item$mention.userType,
|
|
291
|
+
isXProductUser = _item$mention.isXProductUser;
|
|
291
292
|
var trimmedNickname = nickname && nickname.startsWith('@') ? nickname.slice(1) : nickname;
|
|
292
293
|
var renderName = mentionInsertDisplayName || !trimmedNickname ? name : trimmedNickname;
|
|
293
294
|
var _ref10 = (_api$contextIdentifie3 = api === null || api === void 0 || (_api$contextIdentifie4 = api.contextIdentifier) === null || _api$contextIdentifie4 === void 0 ? void 0 : _api$contextIdentifie4.sharedState.currentState()) !== null && _api$contextIdentifie3 !== void 0 ? _api$contextIdentifie3 : {},
|
|
@@ -344,6 +345,9 @@ export var createTypeAheadConfig = function createTypeAheadConfig(_ref6) {
|
|
|
344
345
|
if (mentionProvider && isTeamType(userType)) {
|
|
345
346
|
return insert(buildNodesForTeamMention(schema, item.mention, mentionProvider, sanitizePrivateContent));
|
|
346
347
|
}
|
|
348
|
+
if (isXProductUser && mentionProvider && mentionProvider.inviteXProductUser) {
|
|
349
|
+
mentionProvider.inviteXProductUser(id);
|
|
350
|
+
}
|
|
347
351
|
|
|
348
352
|
// Don't insert into document if document data is sanitized.
|
|
349
353
|
var text = sanitizePrivateContent ? '' : "@".concat(renderName);
|
|
@@ -2,6 +2,7 @@ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/t
|
|
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
3
|
import type { ContextIdentifierPlugin } from '@atlaskit/editor-plugin-context-identifier';
|
|
4
4
|
import type { TypeAheadInputMethod, TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
5
|
+
import type { MentionProvider } from '@atlaskit/mention/resource';
|
|
5
6
|
import type { MentionPluginOptions, MentionSharedState } from './types';
|
|
6
7
|
export type MentionsPlugin = NextEditorPlugin<'mention', {
|
|
7
8
|
pluginConfiguration: MentionPluginOptions | undefined;
|
|
@@ -19,5 +20,12 @@ export type MentionsPlugin = NextEditorPlugin<'mention', {
|
|
|
19
20
|
id: string;
|
|
20
21
|
taskLocalId?: string;
|
|
21
22
|
}[]) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Used to update the initial provider passed to the mention plugin.
|
|
25
|
+
*
|
|
26
|
+
* @param provider Promise<MentionProvider>
|
|
27
|
+
* @returns {boolean} if setting the provider was successful or not
|
|
28
|
+
*/
|
|
29
|
+
setProvider: (provider: Promise<MentionProvider>) => Promise<boolean>;
|
|
22
30
|
};
|
|
23
31
|
}>;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
3
|
import type { InlineNodeViewComponentProps } from '@atlaskit/editor-common/react-node-view';
|
|
4
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { MentionsPlugin } from '../mentionsPluginType';
|
|
4
6
|
import type { MentionPluginOptions } from '../types';
|
|
5
7
|
export type Props = InlineNodeViewComponentProps & {
|
|
6
8
|
options: MentionPluginOptions | undefined;
|
|
7
9
|
providerFactory: ProviderFactory;
|
|
10
|
+
pluginInjectionApi?: ExtractInjectionAPI<MentionsPlugin>;
|
|
8
11
|
};
|
|
9
12
|
export declare const MentionNodeView: (props: Props) => JSX.Element;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { ExtractInjectionAPI, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { MentionsPlugin } from '../mentionsPluginType';
|
|
3
4
|
import { type FireElementsChannelEvent, type MentionPluginOptions, type MentionPluginState } from '../types';
|
|
4
|
-
export declare
|
|
5
|
+
export declare const ACTIONS: {
|
|
6
|
+
SET_PROVIDER: string;
|
|
7
|
+
};
|
|
8
|
+
interface CreateMentionPlugin {
|
|
9
|
+
pmPluginFactoryParams: PMPluginFactoryParams;
|
|
10
|
+
fireEvent: FireElementsChannelEvent;
|
|
11
|
+
options?: MentionPluginOptions;
|
|
12
|
+
api?: ExtractInjectionAPI<MentionsPlugin>;
|
|
13
|
+
}
|
|
14
|
+
export declare function createMentionPlugin({ pmPluginFactoryParams, fireEvent, options, api, }: CreateMentionPlugin): SafePlugin<MentionPluginState>;
|
|
15
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { type ProfilecardProvider } from '@atlaskit/editor-common/provider-factory';
|
|
4
|
+
import type { Providers } from '@atlaskit/editor-common/provider-factory';
|
|
4
5
|
import type { TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
5
6
|
import type { MentionDescription, MentionProvider } from '@atlaskit/mention';
|
|
6
7
|
export declare const MENTION_PROVIDER_REJECTED = "REJECTED";
|
|
@@ -16,6 +17,7 @@ export interface MentionPluginConfig {
|
|
|
16
17
|
profilecardProvider?: Promise<ProfilecardProvider>;
|
|
17
18
|
}
|
|
18
19
|
export interface MentionPluginOptions extends MentionPluginConfig {
|
|
20
|
+
mentionProvider?: Providers['mentionProvider'];
|
|
19
21
|
sanitizePrivateContent?: boolean;
|
|
20
22
|
allowZeroWidthSpaceAfter?: boolean;
|
|
21
23
|
handleMentionsChanged?: (mentionChanges: {
|
|
@@ -2,6 +2,7 @@ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/t
|
|
|
2
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
3
3
|
import type { ContextIdentifierPlugin } from '@atlaskit/editor-plugin-context-identifier';
|
|
4
4
|
import type { TypeAheadInputMethod, TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
5
|
+
import type { MentionProvider } from '@atlaskit/mention/resource';
|
|
5
6
|
import type { MentionPluginOptions, MentionSharedState } from './types';
|
|
6
7
|
export type MentionsPlugin = NextEditorPlugin<'mention', {
|
|
7
8
|
pluginConfiguration: MentionPluginOptions | undefined;
|
|
@@ -19,5 +20,12 @@ export type MentionsPlugin = NextEditorPlugin<'mention', {
|
|
|
19
20
|
id: string;
|
|
20
21
|
taskLocalId?: string;
|
|
21
22
|
}[]) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Used to update the initial provider passed to the mention plugin.
|
|
25
|
+
*
|
|
26
|
+
* @param provider Promise<MentionProvider>
|
|
27
|
+
* @returns {boolean} if setting the provider was successful or not
|
|
28
|
+
*/
|
|
29
|
+
setProvider: (provider: Promise<MentionProvider>) => Promise<boolean>;
|
|
22
30
|
};
|
|
23
31
|
}>;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
3
3
|
import type { InlineNodeViewComponentProps } from '@atlaskit/editor-common/react-node-view';
|
|
4
|
+
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { MentionsPlugin } from '../mentionsPluginType';
|
|
4
6
|
import type { MentionPluginOptions } from '../types';
|
|
5
7
|
export type Props = InlineNodeViewComponentProps & {
|
|
6
8
|
options: MentionPluginOptions | undefined;
|
|
7
9
|
providerFactory: ProviderFactory;
|
|
10
|
+
pluginInjectionApi?: ExtractInjectionAPI<MentionsPlugin>;
|
|
8
11
|
};
|
|
9
12
|
export declare const MentionNodeView: (props: Props) => JSX.Element;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type { PMPluginFactoryParams } from '@atlaskit/editor-common/types';
|
|
2
|
+
import type { ExtractInjectionAPI, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
|
|
3
|
+
import type { MentionsPlugin } from '../mentionsPluginType';
|
|
3
4
|
import { type FireElementsChannelEvent, type MentionPluginOptions, type MentionPluginState } from '../types';
|
|
4
|
-
export declare
|
|
5
|
+
export declare const ACTIONS: {
|
|
6
|
+
SET_PROVIDER: string;
|
|
7
|
+
};
|
|
8
|
+
interface CreateMentionPlugin {
|
|
9
|
+
pmPluginFactoryParams: PMPluginFactoryParams;
|
|
10
|
+
fireEvent: FireElementsChannelEvent;
|
|
11
|
+
options?: MentionPluginOptions;
|
|
12
|
+
api?: ExtractInjectionAPI<MentionsPlugin>;
|
|
13
|
+
}
|
|
14
|
+
export declare function createMentionPlugin({ pmPluginFactoryParams, fireEvent, options, api, }: CreateMentionPlugin): SafePlugin<MentionPluginState>;
|
|
15
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { type ProfilecardProvider } from '@atlaskit/editor-common/provider-factory';
|
|
4
|
+
import type { Providers } from '@atlaskit/editor-common/provider-factory';
|
|
4
5
|
import type { TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
5
6
|
import type { MentionDescription, MentionProvider } from '@atlaskit/mention';
|
|
6
7
|
export declare const MENTION_PROVIDER_REJECTED = "REJECTED";
|
|
@@ -16,6 +17,7 @@ export interface MentionPluginConfig {
|
|
|
16
17
|
profilecardProvider?: Promise<ProfilecardProvider>;
|
|
17
18
|
}
|
|
18
19
|
export interface MentionPluginOptions extends MentionPluginConfig {
|
|
20
|
+
mentionProvider?: Providers['mentionProvider'];
|
|
19
21
|
sanitizePrivateContent?: boolean;
|
|
20
22
|
allowZeroWidthSpaceAfter?: boolean;
|
|
21
23
|
handleMentionsChanged?: (mentionChanges: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-mentions",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.11.0",
|
|
4
4
|
"description": "Mentions plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^46.1.0",
|
|
35
|
-
"@atlaskit/editor-common": "^98.
|
|
35
|
+
"@atlaskit/editor-common": "^98.2.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
|
37
37
|
"@atlaskit/editor-plugin-context-identifier": "^1.3.0",
|
|
38
38
|
"@atlaskit/editor-plugin-type-ahead": "^1.11.0",
|
|
39
39
|
"@atlaskit/editor-prosemirror": "6.2.1",
|
|
40
40
|
"@atlaskit/icon": "^23.1.0",
|
|
41
|
-
"@atlaskit/mention": "^23.
|
|
41
|
+
"@atlaskit/mention": "^23.7.0",
|
|
42
42
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
43
43
|
"@atlaskit/theme": "^14.0.0",
|
|
44
44
|
"@atlaskit/tokens": "^2.5.0",
|
|
@@ -106,6 +106,9 @@
|
|
|
106
106
|
},
|
|
107
107
|
"team-mention-inline-smartlink": {
|
|
108
108
|
"type": "boolean"
|
|
109
|
+
},
|
|
110
|
+
"platform_editor_mention_provider_via_plugin_config": {
|
|
111
|
+
"type": "boolean"
|
|
109
112
|
}
|
|
110
113
|
}
|
|
111
114
|
}
|