@atlaskit/editor-plugin-mentions 8.2.23 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/pm-plugins/main.js +5 -34
- package/dist/es2019/pm-plugins/main.js +2 -28
- package/dist/esm/pm-plugins/main.js +2 -31
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-mentions
|
|
2
2
|
|
|
3
|
+
## 9.0.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 8.2.24
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`019e34f92a799`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/019e34f92a799) -
|
|
14
|
+
Cleanup FG platform_editor_new_mentions_detection_logic
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 8.2.23
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -9,16 +9,14 @@ exports.createMentionPlugin = createMentionPlugin;
|
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
11
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
12
|
-
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
13
12
|
var _insm = require("@atlaskit/insm");
|
|
14
13
|
var _resource = require("@atlaskit/mention/resource");
|
|
15
14
|
var _types = require("@atlaskit/mention/types");
|
|
16
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
|
-
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
18
16
|
var _mentionNodeView = require("../nodeviews/mentionNodeView");
|
|
19
17
|
var _types2 = require("../types");
|
|
20
18
|
var _key = require("./key");
|
|
21
|
-
var
|
|
19
|
+
var _utils = require("./utils");
|
|
22
20
|
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; }
|
|
23
21
|
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; }
|
|
24
22
|
var ACTIONS = exports.ACTIONS = {
|
|
@@ -63,7 +61,7 @@ function createMentionPlugin(_ref) {
|
|
|
63
61
|
key: _key.mentionPluginKey,
|
|
64
62
|
state: {
|
|
65
63
|
init: function init(_, state) {
|
|
66
|
-
var canInsertMention = (0,
|
|
64
|
+
var canInsertMention = (0, _utils.canMentionBeCreatedInRange)(state.selection.from, state.selection.to)(state);
|
|
67
65
|
return {
|
|
68
66
|
canInsertMention: canInsertMention
|
|
69
67
|
};
|
|
@@ -80,7 +78,7 @@ function createMentionPlugin(_ref) {
|
|
|
80
78
|
var hasPositionChanged = oldState.selection.from !== newState.selection.from || oldState.selection.to !== newState.selection.to;
|
|
81
79
|
if (tr.docChanged || tr.selectionSet && hasPositionChanged) {
|
|
82
80
|
newPluginState = _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
83
|
-
canInsertMention: (0,
|
|
81
|
+
canInsertMention: (0, _utils.canMentionBeCreatedInRange)(newState.selection.from, newState.selection.to)(newState)
|
|
84
82
|
});
|
|
85
83
|
hasNewPluginState = true;
|
|
86
84
|
}
|
|
@@ -95,7 +93,7 @@ function createMentionPlugin(_ref) {
|
|
|
95
93
|
if (hasNewPluginState) {
|
|
96
94
|
pmPluginFactoryParams.dispatch(_key.mentionPluginKey, newPluginState);
|
|
97
95
|
}
|
|
98
|
-
if (
|
|
96
|
+
if (options !== null && options !== void 0 && options.handleMentionsChanged && tr.docChanged) {
|
|
99
97
|
var _insm$session, _insm$session2;
|
|
100
98
|
(_insm$session = _insm.insm.session) === null || _insm$session === void 0 || _insm$session.startFeature('mentionDeletionDetection');
|
|
101
99
|
var mentionSchema = newState.schema.nodes.mention;
|
|
@@ -159,7 +157,7 @@ function createMentionPlugin(_ref) {
|
|
|
159
157
|
},
|
|
160
158
|
props: {
|
|
161
159
|
nodeViews: {
|
|
162
|
-
mention: function mention(node
|
|
160
|
+
mention: function mention(node) {
|
|
163
161
|
return new _mentionNodeView.MentionNodeView(node, {
|
|
164
162
|
options: options,
|
|
165
163
|
api: api,
|
|
@@ -221,33 +219,6 @@ function createMentionPlugin(_ref) {
|
|
|
221
219
|
if (mentionProvider) {
|
|
222
220
|
mentionProvider.unsubscribe('mentionPlugin');
|
|
223
221
|
}
|
|
224
|
-
},
|
|
225
|
-
update: function update(view, prevState) {
|
|
226
|
-
var newState = view.state;
|
|
227
|
-
if (!(0, _expValEquals.expValEquals)('platform_editor_new_mentions_detection_logic', 'isEnabled', true) && options !== null && options !== void 0 && options.handleMentionsChanged) {
|
|
228
|
-
var mentionSchema = newState.schema.nodes.mention;
|
|
229
|
-
var mentionNodesBefore = (0, _utils.findChildrenByType)(prevState.doc, mentionSchema);
|
|
230
|
-
var mentionLocalIdsAfter = new Set((0, _utils.findChildrenByType)(newState.doc, mentionSchema).map(function (_ref3) {
|
|
231
|
-
var node = _ref3.node;
|
|
232
|
-
return node.attrs.localId;
|
|
233
|
-
}));
|
|
234
|
-
if (mentionNodesBefore.length > mentionLocalIdsAfter.size) {
|
|
235
|
-
var deletedMentions = mentionNodesBefore.filter(function (_ref4) {
|
|
236
|
-
var node = _ref4.node;
|
|
237
|
-
return !mentionLocalIdsAfter.has(node.attrs.localId);
|
|
238
|
-
}).map(function (_ref5) {
|
|
239
|
-
var node = _ref5.node;
|
|
240
|
-
return {
|
|
241
|
-
type: 'deleted',
|
|
242
|
-
id: node.attrs.id,
|
|
243
|
-
localId: node.attrs.localId
|
|
244
|
-
};
|
|
245
|
-
});
|
|
246
|
-
if (deletedMentions.length > 0) {
|
|
247
|
-
options.handleMentionsChanged(deletedMentions);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
222
|
}
|
|
252
223
|
};
|
|
253
224
|
}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
3
|
-
import { findChildrenByType } from '@atlaskit/editor-prosemirror/utils';
|
|
4
3
|
import { insm } from '@atlaskit/insm';
|
|
5
4
|
import { SLI_EVENT_TYPE, SMART_EVENT_TYPE } from '@atlaskit/mention/resource';
|
|
6
5
|
import { ComponentNames } from '@atlaskit/mention/types';
|
|
7
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
7
|
import { MentionNodeView } from '../nodeviews/mentionNodeView';
|
|
10
8
|
import { MENTION_PROVIDER_REJECTED, MENTION_PROVIDER_UNDEFINED } from '../types';
|
|
11
9
|
import { mentionPluginKey } from './key';
|
|
@@ -87,7 +85,7 @@ export function createMentionPlugin({
|
|
|
87
85
|
if (hasNewPluginState) {
|
|
88
86
|
pmPluginFactoryParams.dispatch(mentionPluginKey, newPluginState);
|
|
89
87
|
}
|
|
90
|
-
if (
|
|
88
|
+
if (options !== null && options !== void 0 && options.handleMentionsChanged && tr.docChanged) {
|
|
91
89
|
var _insm$session, _insm$session2;
|
|
92
90
|
(_insm$session = insm.session) === null || _insm$session === void 0 ? void 0 : _insm$session.startFeature('mentionDeletionDetection');
|
|
93
91
|
const mentionSchema = newState.schema.nodes.mention;
|
|
@@ -149,7 +147,7 @@ export function createMentionPlugin({
|
|
|
149
147
|
},
|
|
150
148
|
props: {
|
|
151
149
|
nodeViews: {
|
|
152
|
-
mention:
|
|
150
|
+
mention: node => {
|
|
153
151
|
return new MentionNodeView(node, {
|
|
154
152
|
options,
|
|
155
153
|
api,
|
|
@@ -211,30 +209,6 @@ export function createMentionPlugin({
|
|
|
211
209
|
if (mentionProvider) {
|
|
212
210
|
mentionProvider.unsubscribe('mentionPlugin');
|
|
213
211
|
}
|
|
214
|
-
},
|
|
215
|
-
update(view, prevState) {
|
|
216
|
-
const newState = view.state;
|
|
217
|
-
if (!expValEquals('platform_editor_new_mentions_detection_logic', 'isEnabled', true) && options !== null && options !== void 0 && options.handleMentionsChanged) {
|
|
218
|
-
const mentionSchema = newState.schema.nodes.mention;
|
|
219
|
-
const mentionNodesBefore = findChildrenByType(prevState.doc, mentionSchema);
|
|
220
|
-
const mentionLocalIdsAfter = new Set(findChildrenByType(newState.doc, mentionSchema).map(({
|
|
221
|
-
node
|
|
222
|
-
}) => node.attrs.localId));
|
|
223
|
-
if (mentionNodesBefore.length > mentionLocalIdsAfter.size) {
|
|
224
|
-
const deletedMentions = mentionNodesBefore.filter(({
|
|
225
|
-
node
|
|
226
|
-
}) => !mentionLocalIdsAfter.has(node.attrs.localId)).map(({
|
|
227
|
-
node
|
|
228
|
-
}) => ({
|
|
229
|
-
type: 'deleted',
|
|
230
|
-
id: node.attrs.id,
|
|
231
|
-
localId: node.attrs.localId
|
|
232
|
-
}));
|
|
233
|
-
if (deletedMentions.length > 0) {
|
|
234
|
-
options.handleMentionsChanged(deletedMentions);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
212
|
}
|
|
239
213
|
};
|
|
240
214
|
}
|
|
@@ -3,12 +3,10 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
6
|
-
import { findChildrenByType } from '@atlaskit/editor-prosemirror/utils';
|
|
7
6
|
import { insm } from '@atlaskit/insm';
|
|
8
7
|
import { SLI_EVENT_TYPE, SMART_EVENT_TYPE } from '@atlaskit/mention/resource';
|
|
9
8
|
import { ComponentNames } from '@atlaskit/mention/types';
|
|
10
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
11
|
-
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
10
|
import { MentionNodeView } from '../nodeviews/mentionNodeView';
|
|
13
11
|
import { MENTION_PROVIDER_REJECTED, MENTION_PROVIDER_UNDEFINED } from '../types';
|
|
14
12
|
import { mentionPluginKey } from './key';
|
|
@@ -87,7 +85,7 @@ export function createMentionPlugin(_ref) {
|
|
|
87
85
|
if (hasNewPluginState) {
|
|
88
86
|
pmPluginFactoryParams.dispatch(mentionPluginKey, newPluginState);
|
|
89
87
|
}
|
|
90
|
-
if (
|
|
88
|
+
if (options !== null && options !== void 0 && options.handleMentionsChanged && tr.docChanged) {
|
|
91
89
|
var _insm$session, _insm$session2;
|
|
92
90
|
(_insm$session = insm.session) === null || _insm$session === void 0 || _insm$session.startFeature('mentionDeletionDetection');
|
|
93
91
|
var mentionSchema = newState.schema.nodes.mention;
|
|
@@ -151,7 +149,7 @@ export function createMentionPlugin(_ref) {
|
|
|
151
149
|
},
|
|
152
150
|
props: {
|
|
153
151
|
nodeViews: {
|
|
154
|
-
mention: function mention(node
|
|
152
|
+
mention: function mention(node) {
|
|
155
153
|
return new MentionNodeView(node, {
|
|
156
154
|
options: options,
|
|
157
155
|
api: api,
|
|
@@ -213,33 +211,6 @@ export function createMentionPlugin(_ref) {
|
|
|
213
211
|
if (mentionProvider) {
|
|
214
212
|
mentionProvider.unsubscribe('mentionPlugin');
|
|
215
213
|
}
|
|
216
|
-
},
|
|
217
|
-
update: function update(view, prevState) {
|
|
218
|
-
var newState = view.state;
|
|
219
|
-
if (!expValEquals('platform_editor_new_mentions_detection_logic', 'isEnabled', true) && options !== null && options !== void 0 && options.handleMentionsChanged) {
|
|
220
|
-
var mentionSchema = newState.schema.nodes.mention;
|
|
221
|
-
var mentionNodesBefore = findChildrenByType(prevState.doc, mentionSchema);
|
|
222
|
-
var mentionLocalIdsAfter = new Set(findChildrenByType(newState.doc, mentionSchema).map(function (_ref3) {
|
|
223
|
-
var node = _ref3.node;
|
|
224
|
-
return node.attrs.localId;
|
|
225
|
-
}));
|
|
226
|
-
if (mentionNodesBefore.length > mentionLocalIdsAfter.size) {
|
|
227
|
-
var deletedMentions = mentionNodesBefore.filter(function (_ref4) {
|
|
228
|
-
var node = _ref4.node;
|
|
229
|
-
return !mentionLocalIdsAfter.has(node.attrs.localId);
|
|
230
|
-
}).map(function (_ref5) {
|
|
231
|
-
var node = _ref5.node;
|
|
232
|
-
return {
|
|
233
|
-
type: 'deleted',
|
|
234
|
-
id: node.attrs.id,
|
|
235
|
-
localId: node.attrs.localId
|
|
236
|
-
};
|
|
237
|
-
});
|
|
238
|
-
if (deletedMentions.length > 0) {
|
|
239
|
-
options.handleMentionsChanged(deletedMentions);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
214
|
}
|
|
244
215
|
};
|
|
245
216
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-mentions",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0",
|
|
4
4
|
"description": "Mentions plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@atlaskit/adf-schema": "^51.5.0",
|
|
33
33
|
"@atlaskit/css": "^0.19.0",
|
|
34
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
35
|
-
"@atlaskit/editor-plugin-base": "^
|
|
36
|
-
"@atlaskit/editor-plugin-context-identifier": "^
|
|
37
|
-
"@atlaskit/editor-plugin-selection": "^
|
|
38
|
-
"@atlaskit/editor-plugin-type-ahead": "^
|
|
34
|
+
"@atlaskit/editor-plugin-analytics": "^7.0.0",
|
|
35
|
+
"@atlaskit/editor-plugin-base": "^8.0.0",
|
|
36
|
+
"@atlaskit/editor-plugin-context-identifier": "^7.0.0",
|
|
37
|
+
"@atlaskit/editor-plugin-selection": "^7.0.0",
|
|
38
|
+
"@atlaskit/editor-plugin-type-ahead": "^7.0.0",
|
|
39
39
|
"@atlaskit/editor-prosemirror": "^7.2.0",
|
|
40
40
|
"@atlaskit/icon": "^29.3.0",
|
|
41
41
|
"@atlaskit/insm": "^0.2.0",
|
|
@@ -44,9 +44,9 @@
|
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
45
45
|
"@atlaskit/popper": "^7.1.0",
|
|
46
46
|
"@atlaskit/portal": "^5.1.0",
|
|
47
|
-
"@atlaskit/profilecard": "^24.
|
|
47
|
+
"@atlaskit/profilecard": "^24.27.0",
|
|
48
48
|
"@atlaskit/theme": "^21.0.0",
|
|
49
|
-
"@atlaskit/tmp-editor-statsig": "^16.
|
|
49
|
+
"@atlaskit/tmp-editor-statsig": "^16.3.0",
|
|
50
50
|
"@atlaskit/tokens": "^9.0.0",
|
|
51
51
|
"@babel/runtime": "^7.0.0",
|
|
52
52
|
"@compiled/react": "^0.18.6",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"uuid": "^3.1.0"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"@atlaskit/editor-common": "^
|
|
58
|
+
"@atlaskit/editor-common": "^111.0.0",
|
|
59
59
|
"react": "^18.2.0",
|
|
60
60
|
"react-dom": "^18.2.0",
|
|
61
61
|
"react-intl-next": "npm:react-intl@^5.18.1"
|