@atlaskit/editor-plugin-mentions 8.2.13 → 8.2.15

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,20 @@
1
1
  # @atlaskit/editor-plugin-mentions
2
2
 
3
+ ## 8.2.15
4
+
5
+ ### Patch Changes
6
+
7
+ - [`4d676bbdb3ce6`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4d676bbdb3ce6) -
8
+ ts-ignore added temporarily to unblock local consumption for help-center, will be removed once
9
+ project refs are setup
10
+ - Updated dependencies
11
+
12
+ ## 8.2.14
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
3
18
  ## 8.2.13
4
19
 
5
20
  ### Patch Changes
@@ -62,12 +62,14 @@ function createMentionPlugin(_ref) {
62
62
  return new _safePlugin.SafePlugin({
63
63
  key: _key.mentionPluginKey,
64
64
  state: {
65
+ // @ts-ignore - Workaround for help-center local consumption
65
66
  init: function init(_, state) {
66
67
  var canInsertMention = (0, _utils2.canMentionBeCreatedInRange)(state.selection.from, state.selection.to)(state);
67
68
  return {
68
69
  canInsertMention: canInsertMention
69
70
  };
70
71
  },
72
+ // @ts-ignore - Workaround for help-center local consumption
71
73
  apply: function apply(tr, pluginState, oldState, newState) {
72
74
  var _ref2 = tr.getMeta(_key.mentionPluginKey) || {
73
75
  action: null,
@@ -100,16 +102,31 @@ function createMentionPlugin(_ref) {
100
102
  (_insm$session = _insm.insm.session) === null || _insm$session === void 0 || _insm$session.startFeature('mentionDeletionDetection');
101
103
  var mentionSchema = newState.schema.nodes.mention;
102
104
  var mentionsRemoved = new Map();
105
+
106
+ // @ts-ignore - Workaround for help-center local consumption
107
+
103
108
  tr.steps.forEach(function (step, index) {
109
+ // @ts-ignore - Workaround for help-center local consumption
110
+
104
111
  step.getMap().forEach(function (from, to) {
112
+ // @ts-ignore - Workaround for help-center local consumption
113
+
105
114
  var newStart = tr.mapping.slice(index).map(from, -1);
115
+ // @ts-ignore - Workaround for help-center local consumption
116
+
106
117
  var newEnd = tr.mapping.slice(index).map(to);
118
+ // @ts-ignore - Workaround for help-center local consumption
119
+
107
120
  var oldStart = tr.mapping.invert().map(newStart, -1);
121
+ // @ts-ignore - Workaround for help-center local consumption
122
+
108
123
  var oldEnd = tr.mapping.invert().map(newEnd);
109
124
  var oldSlice = oldState.doc.slice(oldStart, oldEnd);
110
125
  var newSlice = newState.doc.slice(newStart, newEnd);
111
126
  var mentionsBefore = new Map();
112
127
  var mentionsAfter = new Map();
128
+
129
+ // @ts-ignore - Workaround for help-center local consumption
113
130
  oldSlice.content.descendants(function (node) {
114
131
  if (node.type.name === mentionSchema.name && node.attrs.localId) {
115
132
  mentionsBefore.set(node.attrs.localId, {
@@ -118,6 +135,9 @@ function createMentionPlugin(_ref) {
118
135
  });
119
136
  }
120
137
  });
138
+
139
+ // @ts-ignore - Workaround for help-center local consumption
140
+
121
141
  newSlice.content.descendants(function (node) {
122
142
  if (node.type.name === mentionSchema.name && node.attrs.localId) {
123
143
  mentionsAfter.set(node.attrs.localId, {
@@ -128,6 +148,8 @@ function createMentionPlugin(_ref) {
128
148
  });
129
149
 
130
150
  // Determine which mentions were removed in this step
151
+ // @ts-ignore - Workaround for help-center local consumption
152
+
131
153
  mentionsBefore.forEach(function (mention, localId) {
132
154
  if (!mentionsAfter.has(localId)) {
133
155
  mentionsRemoved.set(localId, mention);
@@ -135,6 +157,8 @@ function createMentionPlugin(_ref) {
135
157
  });
136
158
 
137
159
  // Adjust mentionsRemoved by removing any that reappear
160
+ // @ts-ignore - Workaround for help-center local consumption
161
+
138
162
  mentionsAfter.forEach(function (_, localId) {
139
163
  if (mentionsRemoved.has(localId)) {
140
164
  mentionsRemoved.delete(localId);
@@ -143,6 +167,8 @@ function createMentionPlugin(_ref) {
143
167
  });
144
168
  });
145
169
  if (mentionsRemoved.size > 0) {
170
+ // @ts-ignore - Workaround for help-center local consumption
171
+
146
172
  var changes = Array.from(mentionsRemoved.values()).map(function (mention) {
147
173
  return {
148
174
  id: mention.id,
@@ -158,7 +184,10 @@ function createMentionPlugin(_ref) {
158
184
  }
159
185
  },
160
186
  props: {
187
+ // @ts-ignore - Workaround for help-center local consumption
188
+
161
189
  nodeViews: {
190
+ // @ts-ignore - Workaround for help-center local consumption
162
191
  mention: function mention(node, view, getPos, decorations, innerDecorations) {
163
192
  return new _mentionNodeView.MentionNodeView(node, {
164
193
  options: options,
@@ -168,6 +197,7 @@ function createMentionPlugin(_ref) {
168
197
  }
169
198
  }
170
199
  },
200
+ // @ts-ignore - Workaround for help-center local consumption
171
201
  view: function view(editorView) {
172
202
  var providerHandler = function providerHandler(name, providerPromise) {
173
203
  switch (name) {
@@ -214,6 +244,7 @@ function createMentionPlugin(_ref) {
214
244
  pmPluginFactoryParams.providerFactory.subscribe('mentionProvider', providerHandler);
215
245
  }
216
246
  return {
247
+ // @ts-ignore - Workaround for help-center local consumption
217
248
  destroy: function destroy() {
218
249
  if (pmPluginFactoryParams.providerFactory) {
219
250
  pmPluginFactoryParams.providerFactory.unsubscribe('mentionProvider', providerHandler);
@@ -222,20 +253,28 @@ function createMentionPlugin(_ref) {
222
253
  mentionProvider.unsubscribe('mentionPlugin');
223
254
  }
224
255
  },
256
+ // @ts-ignore - Workaround for help-center local consumption
225
257
  update: function update(view, prevState) {
226
258
  var newState = view.state;
227
259
  if (!(0, _expValEquals.expValEquals)('platform_editor_new_mentions_detection_logic', 'isEnabled', true) && options !== null && options !== void 0 && options.handleMentionsChanged) {
228
260
  var mentionSchema = newState.schema.nodes.mention;
229
261
  var mentionNodesBefore = (0, _utils.findChildrenByType)(prevState.doc, mentionSchema);
230
- var mentionLocalIdsAfter = new Set((0, _utils.findChildrenByType)(newState.doc, mentionSchema).map(function (_ref3) {
262
+ var mentionLocalIdsAfter = new Set(
263
+ // @ts-ignore - Workaround for help-center local consumption
264
+
265
+ (0, _utils.findChildrenByType)(newState.doc, mentionSchema).map(function (_ref3) {
231
266
  var node = _ref3.node;
232
267
  return node.attrs.localId;
233
268
  }));
234
269
  if (mentionNodesBefore.length > mentionLocalIdsAfter.size) {
235
- var deletedMentions = mentionNodesBefore.filter(function (_ref4) {
270
+ var deletedMentions = mentionNodesBefore
271
+ // @ts-ignore - Workaround for help-center local consumption
272
+ .filter(function (_ref4) {
236
273
  var node = _ref4.node;
237
274
  return !mentionLocalIdsAfter.has(node.attrs.localId);
238
- }).map(function (_ref5) {
275
+ })
276
+ // @ts-ignore - Workaround for help-center local consumption
277
+ .map(function (_ref5) {
239
278
  var node = _ref5.node;
240
279
  return {
241
280
  type: 'deleted',
@@ -51,12 +51,16 @@ export function createMentionPlugin({
51
51
  return new SafePlugin({
52
52
  key: mentionPluginKey,
53
53
  state: {
54
+ // @ts-ignore - Workaround for help-center local consumption
55
+
54
56
  init(_, state) {
55
57
  const canInsertMention = canMentionBeCreatedInRange(state.selection.from, state.selection.to)(state);
56
58
  return {
57
59
  canInsertMention
58
60
  };
59
61
  },
62
+ // @ts-ignore - Workaround for help-center local consumption
63
+
60
64
  apply(tr, pluginState, oldState, newState) {
61
65
  const {
62
66
  action,
@@ -92,16 +96,31 @@ export function createMentionPlugin({
92
96
  (_insm$session = insm.session) === null || _insm$session === void 0 ? void 0 : _insm$session.startFeature('mentionDeletionDetection');
93
97
  const mentionSchema = newState.schema.nodes.mention;
94
98
  const mentionsRemoved = new Map();
99
+
100
+ // @ts-ignore - Workaround for help-center local consumption
101
+
95
102
  tr.steps.forEach((step, index) => {
103
+ // @ts-ignore - Workaround for help-center local consumption
104
+
96
105
  step.getMap().forEach((from, to) => {
106
+ // @ts-ignore - Workaround for help-center local consumption
107
+
97
108
  const newStart = tr.mapping.slice(index).map(from, -1);
109
+ // @ts-ignore - Workaround for help-center local consumption
110
+
98
111
  const newEnd = tr.mapping.slice(index).map(to);
112
+ // @ts-ignore - Workaround for help-center local consumption
113
+
99
114
  const oldStart = tr.mapping.invert().map(newStart, -1);
115
+ // @ts-ignore - Workaround for help-center local consumption
116
+
100
117
  const oldEnd = tr.mapping.invert().map(newEnd);
101
118
  const oldSlice = oldState.doc.slice(oldStart, oldEnd);
102
119
  const newSlice = newState.doc.slice(newStart, newEnd);
103
120
  const mentionsBefore = new Map();
104
121
  const mentionsAfter = new Map();
122
+
123
+ // @ts-ignore - Workaround for help-center local consumption
105
124
  oldSlice.content.descendants(node => {
106
125
  if (node.type.name === mentionSchema.name && node.attrs.localId) {
107
126
  mentionsBefore.set(node.attrs.localId, {
@@ -110,6 +129,9 @@ export function createMentionPlugin({
110
129
  });
111
130
  }
112
131
  });
132
+
133
+ // @ts-ignore - Workaround for help-center local consumption
134
+
113
135
  newSlice.content.descendants(node => {
114
136
  if (node.type.name === mentionSchema.name && node.attrs.localId) {
115
137
  mentionsAfter.set(node.attrs.localId, {
@@ -120,6 +142,8 @@ export function createMentionPlugin({
120
142
  });
121
143
 
122
144
  // Determine which mentions were removed in this step
145
+ // @ts-ignore - Workaround for help-center local consumption
146
+
123
147
  mentionsBefore.forEach((mention, localId) => {
124
148
  if (!mentionsAfter.has(localId)) {
125
149
  mentionsRemoved.set(localId, mention);
@@ -127,6 +151,8 @@ export function createMentionPlugin({
127
151
  });
128
152
 
129
153
  // Adjust mentionsRemoved by removing any that reappear
154
+ // @ts-ignore - Workaround for help-center local consumption
155
+
130
156
  mentionsAfter.forEach((_, localId) => {
131
157
  if (mentionsRemoved.has(localId)) {
132
158
  mentionsRemoved.delete(localId);
@@ -135,6 +161,8 @@ export function createMentionPlugin({
135
161
  });
136
162
  });
137
163
  if (mentionsRemoved.size > 0) {
164
+ // @ts-ignore - Workaround for help-center local consumption
165
+
138
166
  const changes = Array.from(mentionsRemoved.values()).map(mention => ({
139
167
  id: mention.id,
140
168
  localId: mention.localId,
@@ -148,7 +176,10 @@ export function createMentionPlugin({
148
176
  }
149
177
  },
150
178
  props: {
179
+ // @ts-ignore - Workaround for help-center local consumption
180
+
151
181
  nodeViews: {
182
+ // @ts-ignore - Workaround for help-center local consumption
152
183
  mention: (node, view, getPos, decorations, innerDecorations) => {
153
184
  return new MentionNodeView(node, {
154
185
  options,
@@ -158,6 +189,8 @@ export function createMentionPlugin({
158
189
  }
159
190
  }
160
191
  },
192
+ // @ts-ignore - Workaround for help-center local consumption
193
+
161
194
  view(editorView) {
162
195
  const providerHandler = (name, providerPromise) => {
163
196
  switch (name) {
@@ -204,6 +237,8 @@ export function createMentionPlugin({
204
237
  pmPluginFactoryParams.providerFactory.subscribe('mentionProvider', providerHandler);
205
238
  }
206
239
  return {
240
+ // @ts-ignore - Workaround for help-center local consumption
241
+
207
242
  destroy() {
208
243
  if (pmPluginFactoryParams.providerFactory) {
209
244
  pmPluginFactoryParams.providerFactory.unsubscribe('mentionProvider', providerHandler);
@@ -212,18 +247,27 @@ export function createMentionPlugin({
212
247
  mentionProvider.unsubscribe('mentionPlugin');
213
248
  }
214
249
  },
250
+ // @ts-ignore - Workaround for help-center local consumption
251
+
215
252
  update(view, prevState) {
216
253
  const newState = view.state;
217
254
  if (!expValEquals('platform_editor_new_mentions_detection_logic', 'isEnabled', true) && options !== null && options !== void 0 && options.handleMentionsChanged) {
218
255
  const mentionSchema = newState.schema.nodes.mention;
219
256
  const mentionNodesBefore = findChildrenByType(prevState.doc, mentionSchema);
220
- const mentionLocalIdsAfter = new Set(findChildrenByType(newState.doc, mentionSchema).map(({
257
+ const mentionLocalIdsAfter = new Set(
258
+ // @ts-ignore - Workaround for help-center local consumption
259
+
260
+ findChildrenByType(newState.doc, mentionSchema).map(({
221
261
  node
222
262
  }) => node.attrs.localId));
223
263
  if (mentionNodesBefore.length > mentionLocalIdsAfter.size) {
224
- const deletedMentions = mentionNodesBefore.filter(({
264
+ const deletedMentions = mentionNodesBefore
265
+ // @ts-ignore - Workaround for help-center local consumption
266
+ .filter(({
225
267
  node
226
- }) => !mentionLocalIdsAfter.has(node.attrs.localId)).map(({
268
+ }) => !mentionLocalIdsAfter.has(node.attrs.localId))
269
+ // @ts-ignore - Workaround for help-center local consumption
270
+ .map(({
227
271
  node
228
272
  }) => ({
229
273
  type: 'deleted',
@@ -54,12 +54,14 @@ export function createMentionPlugin(_ref) {
54
54
  return new SafePlugin({
55
55
  key: mentionPluginKey,
56
56
  state: {
57
+ // @ts-ignore - Workaround for help-center local consumption
57
58
  init: function init(_, state) {
58
59
  var canInsertMention = canMentionBeCreatedInRange(state.selection.from, state.selection.to)(state);
59
60
  return {
60
61
  canInsertMention: canInsertMention
61
62
  };
62
63
  },
64
+ // @ts-ignore - Workaround for help-center local consumption
63
65
  apply: function apply(tr, pluginState, oldState, newState) {
64
66
  var _ref2 = tr.getMeta(mentionPluginKey) || {
65
67
  action: null,
@@ -92,16 +94,31 @@ export function createMentionPlugin(_ref) {
92
94
  (_insm$session = insm.session) === null || _insm$session === void 0 || _insm$session.startFeature('mentionDeletionDetection');
93
95
  var mentionSchema = newState.schema.nodes.mention;
94
96
  var mentionsRemoved = new Map();
97
+
98
+ // @ts-ignore - Workaround for help-center local consumption
99
+
95
100
  tr.steps.forEach(function (step, index) {
101
+ // @ts-ignore - Workaround for help-center local consumption
102
+
96
103
  step.getMap().forEach(function (from, to) {
104
+ // @ts-ignore - Workaround for help-center local consumption
105
+
97
106
  var newStart = tr.mapping.slice(index).map(from, -1);
107
+ // @ts-ignore - Workaround for help-center local consumption
108
+
98
109
  var newEnd = tr.mapping.slice(index).map(to);
110
+ // @ts-ignore - Workaround for help-center local consumption
111
+
99
112
  var oldStart = tr.mapping.invert().map(newStart, -1);
113
+ // @ts-ignore - Workaround for help-center local consumption
114
+
100
115
  var oldEnd = tr.mapping.invert().map(newEnd);
101
116
  var oldSlice = oldState.doc.slice(oldStart, oldEnd);
102
117
  var newSlice = newState.doc.slice(newStart, newEnd);
103
118
  var mentionsBefore = new Map();
104
119
  var mentionsAfter = new Map();
120
+
121
+ // @ts-ignore - Workaround for help-center local consumption
105
122
  oldSlice.content.descendants(function (node) {
106
123
  if (node.type.name === mentionSchema.name && node.attrs.localId) {
107
124
  mentionsBefore.set(node.attrs.localId, {
@@ -110,6 +127,9 @@ export function createMentionPlugin(_ref) {
110
127
  });
111
128
  }
112
129
  });
130
+
131
+ // @ts-ignore - Workaround for help-center local consumption
132
+
113
133
  newSlice.content.descendants(function (node) {
114
134
  if (node.type.name === mentionSchema.name && node.attrs.localId) {
115
135
  mentionsAfter.set(node.attrs.localId, {
@@ -120,6 +140,8 @@ export function createMentionPlugin(_ref) {
120
140
  });
121
141
 
122
142
  // Determine which mentions were removed in this step
143
+ // @ts-ignore - Workaround for help-center local consumption
144
+
123
145
  mentionsBefore.forEach(function (mention, localId) {
124
146
  if (!mentionsAfter.has(localId)) {
125
147
  mentionsRemoved.set(localId, mention);
@@ -127,6 +149,8 @@ export function createMentionPlugin(_ref) {
127
149
  });
128
150
 
129
151
  // Adjust mentionsRemoved by removing any that reappear
152
+ // @ts-ignore - Workaround for help-center local consumption
153
+
130
154
  mentionsAfter.forEach(function (_, localId) {
131
155
  if (mentionsRemoved.has(localId)) {
132
156
  mentionsRemoved.delete(localId);
@@ -135,6 +159,8 @@ export function createMentionPlugin(_ref) {
135
159
  });
136
160
  });
137
161
  if (mentionsRemoved.size > 0) {
162
+ // @ts-ignore - Workaround for help-center local consumption
163
+
138
164
  var changes = Array.from(mentionsRemoved.values()).map(function (mention) {
139
165
  return {
140
166
  id: mention.id,
@@ -150,7 +176,10 @@ export function createMentionPlugin(_ref) {
150
176
  }
151
177
  },
152
178
  props: {
179
+ // @ts-ignore - Workaround for help-center local consumption
180
+
153
181
  nodeViews: {
182
+ // @ts-ignore - Workaround for help-center local consumption
154
183
  mention: function mention(node, view, getPos, decorations, innerDecorations) {
155
184
  return new MentionNodeView(node, {
156
185
  options: options,
@@ -160,6 +189,7 @@ export function createMentionPlugin(_ref) {
160
189
  }
161
190
  }
162
191
  },
192
+ // @ts-ignore - Workaround for help-center local consumption
163
193
  view: function view(editorView) {
164
194
  var providerHandler = function providerHandler(name, providerPromise) {
165
195
  switch (name) {
@@ -206,6 +236,7 @@ export function createMentionPlugin(_ref) {
206
236
  pmPluginFactoryParams.providerFactory.subscribe('mentionProvider', providerHandler);
207
237
  }
208
238
  return {
239
+ // @ts-ignore - Workaround for help-center local consumption
209
240
  destroy: function destroy() {
210
241
  if (pmPluginFactoryParams.providerFactory) {
211
242
  pmPluginFactoryParams.providerFactory.unsubscribe('mentionProvider', providerHandler);
@@ -214,20 +245,28 @@ export function createMentionPlugin(_ref) {
214
245
  mentionProvider.unsubscribe('mentionPlugin');
215
246
  }
216
247
  },
248
+ // @ts-ignore - Workaround for help-center local consumption
217
249
  update: function update(view, prevState) {
218
250
  var newState = view.state;
219
251
  if (!expValEquals('platform_editor_new_mentions_detection_logic', 'isEnabled', true) && options !== null && options !== void 0 && options.handleMentionsChanged) {
220
252
  var mentionSchema = newState.schema.nodes.mention;
221
253
  var mentionNodesBefore = findChildrenByType(prevState.doc, mentionSchema);
222
- var mentionLocalIdsAfter = new Set(findChildrenByType(newState.doc, mentionSchema).map(function (_ref3) {
254
+ var mentionLocalIdsAfter = new Set(
255
+ // @ts-ignore - Workaround for help-center local consumption
256
+
257
+ findChildrenByType(newState.doc, mentionSchema).map(function (_ref3) {
223
258
  var node = _ref3.node;
224
259
  return node.attrs.localId;
225
260
  }));
226
261
  if (mentionNodesBefore.length > mentionLocalIdsAfter.size) {
227
- var deletedMentions = mentionNodesBefore.filter(function (_ref4) {
262
+ var deletedMentions = mentionNodesBefore
263
+ // @ts-ignore - Workaround for help-center local consumption
264
+ .filter(function (_ref4) {
228
265
  var node = _ref4.node;
229
266
  return !mentionLocalIdsAfter.has(node.attrs.localId);
230
- }).map(function (_ref5) {
267
+ })
268
+ // @ts-ignore - Workaround for help-center local consumption
269
+ .map(function (_ref5) {
231
270
  var node = _ref5.node;
232
271
  return {
233
272
  type: 'deleted',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-mentions",
3
- "version": "8.2.13",
3
+ "version": "8.2.15",
4
4
  "description": "Mentions plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -30,7 +30,7 @@
30
30
  "atlaskit:src": "src/index.ts",
31
31
  "dependencies": {
32
32
  "@atlaskit/adf-schema": "^51.4.0",
33
- "@atlaskit/css": "^0.16.0",
33
+ "@atlaskit/css": "^0.17.0",
34
34
  "@atlaskit/editor-plugin-analytics": "^6.2.0",
35
35
  "@atlaskit/editor-plugin-base": "^7.2.0",
36
36
  "@atlaskit/editor-plugin-context-identifier": "^6.0.0",
@@ -46,8 +46,8 @@
46
46
  "@atlaskit/portal": "^5.1.0",
47
47
  "@atlaskit/profilecard": "^24.21.0",
48
48
  "@atlaskit/theme": "^21.0.0",
49
- "@atlaskit/tmp-editor-statsig": "^13.39.0",
50
- "@atlaskit/tokens": "^8.1.0",
49
+ "@atlaskit/tmp-editor-statsig": "^13.42.0",
50
+ "@atlaskit/tokens": "^8.3.0",
51
51
  "@babel/runtime": "^7.0.0",
52
52
  "@compiled/react": "^0.18.6",
53
53
  "bind-event-listener": "^3.0.0",
@@ -55,7 +55,7 @@
55
55
  "uuid": "^3.1.0"
56
56
  },
57
57
  "peerDependencies": {
58
- "@atlaskit/editor-common": "^110.32.0",
58
+ "@atlaskit/editor-common": "^110.34.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"