@atlaskit/editor-plugin-mentions 8.2.16 → 8.2.18

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