@atlaskit/editor-plugin-mentions 8.2.23 → 8.2.24

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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-plugin-mentions
2
2
 
3
+ ## 8.2.24
4
+
5
+ ### Patch Changes
6
+
7
+ - [`019e34f92a799`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/019e34f92a799) -
8
+ Cleanup FG platform_editor_new_mentions_detection_logic
9
+ - Updated dependencies
10
+
3
11
  ## 8.2.23
4
12
 
5
13
  ### Patch Changes
@@ -9,23 +9,21 @@ 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 _utils2 = require("./utils");
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 = {
25
23
  SET_PROVIDER: 'SET_PROVIDER'
26
24
  };
27
25
  var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
28
- var PACKAGE_VERSION = "0.0.0-development";
26
+ var PACKAGE_VERSION = "8.2.23";
29
27
  var setProvider = function setProvider(provider) {
30
28
  return function (state, dispatch) {
31
29
  if (dispatch) {
@@ -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, _utils2.canMentionBeCreatedInRange)(state.selection.from, state.selection.to)(state);
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, _utils2.canMentionBeCreatedInRange)(newState.selection.from, newState.selection.to)(newState)
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 ((0, _expValEquals.expValEquals)('platform_editor_new_mentions_detection_logic', 'isEnabled', true) && options !== null && options !== void 0 && options.handleMentionsChanged && tr.docChanged) {
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, view, getPos, decorations, innerDecorations) {
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';
@@ -14,7 +12,7 @@ export const ACTIONS = {
14
12
  SET_PROVIDER: 'SET_PROVIDER'
15
13
  };
16
14
  const PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
17
- const PACKAGE_VERSION = "0.0.0-development";
15
+ const PACKAGE_VERSION = "8.2.23";
18
16
  const setProvider = provider => (state, dispatch) => {
19
17
  if (dispatch) {
20
18
  dispatch(state.tr.setMeta(mentionPluginKey, {
@@ -87,7 +85,7 @@ export function createMentionPlugin({
87
85
  if (hasNewPluginState) {
88
86
  pmPluginFactoryParams.dispatch(mentionPluginKey, newPluginState);
89
87
  }
90
- if (expValEquals('platform_editor_new_mentions_detection_logic', 'isEnabled', true) && options !== null && options !== void 0 && options.handleMentionsChanged && tr.docChanged) {
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: (node, view, getPos, decorations, innerDecorations) => {
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';
@@ -17,7 +15,7 @@ export var ACTIONS = {
17
15
  SET_PROVIDER: 'SET_PROVIDER'
18
16
  };
19
17
  var PACKAGE_NAME = "@atlaskit/editor-plugin-mentions";
20
- var PACKAGE_VERSION = "0.0.0-development";
18
+ var PACKAGE_VERSION = "8.2.23";
21
19
  var setProvider = function setProvider(provider) {
22
20
  return function (state, dispatch) {
23
21
  if (dispatch) {
@@ -87,7 +85,7 @@ export function createMentionPlugin(_ref) {
87
85
  if (hasNewPluginState) {
88
86
  pmPluginFactoryParams.dispatch(mentionPluginKey, newPluginState);
89
87
  }
90
- if (expValEquals('platform_editor_new_mentions_detection_logic', 'isEnabled', true) && options !== null && options !== void 0 && options.handleMentionsChanged && tr.docChanged) {
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, view, getPos, decorations, innerDecorations) {
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": "8.2.23",
3
+ "version": "8.2.24",
4
4
  "description": "Mentions plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -44,7 +44,7 @@
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.26.0",
47
+ "@atlaskit/profilecard": "^24.27.0",
48
48
  "@atlaskit/theme": "^21.0.0",
49
49
  "@atlaskit/tmp-editor-statsig": "^16.0.0",
50
50
  "@atlaskit/tokens": "^9.0.0",