@atlaskit/editor-plugin-annotation 29.0.4 → 29.0.6

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,19 @@
1
1
  # @atlaskit/editor-plugin-annotation
2
2
 
3
+ ## 29.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`de0b3e0a118bc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/de0b3e0a118bc) -
8
+ Add comment target attribution to inline comment draft-open analytics.
9
+ - Updated dependencies
10
+
11
+ ## 29.0.5
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 29.0.4
4
18
 
5
19
  ### Patch Changes
@@ -288,9 +288,21 @@ var getDraftCommandAnalyticsPayload = exports.getDraftCommandAnalyticsPayload =
288
288
  var payload = function payload(state) {
289
289
  var attributes = {};
290
290
  if (drafting) {
291
+ var _currentMediaNodeWith;
292
+ var selection = state.selection;
293
+ var targetNode = selection instanceof _state.NodeSelection ? selection.node : (_currentMediaNodeWith = (0, _mediaSingle.currentMediaNodeWithPos)(state)) === null || _currentMediaNodeWith === void 0 ? void 0 : _currentMediaNodeWith.node;
294
+ var commentTargetType = 'other';
295
+ if ((targetNode === null || targetNode === void 0 ? void 0 : targetNode.type.name) === 'extension') {
296
+ commentTargetType = targetNode.attrs.extensionKey === 'native-embed:maui' ? 'remixEmbed' : 'other';
297
+ } else if (targetNode && ['media', 'mediaSingle', 'mediaInline'].includes(targetNode.type.name)) {
298
+ commentTargetType = 'media';
299
+ } else if (selection instanceof _state.TextSelection || selection instanceof _state.AllSelection) {
300
+ commentTargetType = 'text';
301
+ }
291
302
  attributes = {
292
303
  inputMethod: inputMethod,
293
- overlap: getAnnotationsInSelectionCount(state)
304
+ overlap: getAnnotationsInSelectionCount(state),
305
+ commentTargetType: commentTargetType
294
306
  };
295
307
  }
296
308
  if ((0, _fg.fg)('editor_inline_comments_on_inline_nodes')) {
@@ -312,7 +324,7 @@ var getDraftCommandAnalyticsPayload = exports.getDraftCommandAnalyticsPayload =
312
324
  return payload;
313
325
  };
314
326
  var isSelectionValid = exports.isSelectionValid = function isSelectionValid(state) {
315
- var _currentMediaNodeWith;
327
+ var _currentMediaNodeWith2;
316
328
  var supportedBlockNodes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
317
329
  var isBlockNodeSupported = arguments.length > 2 ? arguments[2] : undefined;
318
330
  var selection = state.selection;
@@ -326,7 +338,7 @@ var isSelectionValid = exports.isSelectionValid = function isSelectionValid(stat
326
338
  var isValidSelection = isTextOrAllSelection || isValidNodeSelection;
327
339
 
328
340
  // Allow media so that it can enter draft mode
329
- if ((_currentMediaNodeWith = (0, _mediaSingle.currentMediaNodeWithPos)(state)) !== null && _currentMediaNodeWith !== void 0 && _currentMediaNodeWith.node) {
341
+ if ((_currentMediaNodeWith2 = (0, _mediaSingle.currentMediaNodeWithPos)(state)) !== null && _currentMediaNodeWith2 !== void 0 && _currentMediaNodeWith2.node) {
330
342
  return _types.AnnotationSelectionType.VALID;
331
343
  }
332
344
  if (isSelectionEmpty || !isValidSelection) {
@@ -246,9 +246,23 @@ export const getDraftCommandAnalyticsPayload = (drafting, inputMethod) => {
246
246
  const payload = state => {
247
247
  let attributes = {};
248
248
  if (drafting) {
249
+ var _currentMediaNodeWith;
250
+ const {
251
+ selection
252
+ } = state;
253
+ const targetNode = selection instanceof NodeSelection ? selection.node : (_currentMediaNodeWith = currentMediaNodeWithPos(state)) === null || _currentMediaNodeWith === void 0 ? void 0 : _currentMediaNodeWith.node;
254
+ let commentTargetType = 'other';
255
+ if ((targetNode === null || targetNode === void 0 ? void 0 : targetNode.type.name) === 'extension') {
256
+ commentTargetType = targetNode.attrs.extensionKey === 'native-embed:maui' ? 'remixEmbed' : 'other';
257
+ } else if (targetNode && ['media', 'mediaSingle', 'mediaInline'].includes(targetNode.type.name)) {
258
+ commentTargetType = 'media';
259
+ } else if (selection instanceof TextSelection || selection instanceof AllSelection) {
260
+ commentTargetType = 'text';
261
+ }
249
262
  attributes = {
250
263
  inputMethod,
251
- overlap: getAnnotationsInSelectionCount(state)
264
+ overlap: getAnnotationsInSelectionCount(state),
265
+ commentTargetType
252
266
  };
253
267
  }
254
268
  if (fg('editor_inline_comments_on_inline_nodes')) {
@@ -271,7 +285,7 @@ export const getDraftCommandAnalyticsPayload = (drafting, inputMethod) => {
271
285
  return payload;
272
286
  };
273
287
  export const isSelectionValid = (state, supportedBlockNodes = [], isBlockNodeSupported) => {
274
- var _currentMediaNodeWith;
288
+ var _currentMediaNodeWith2;
275
289
  const {
276
290
  selection
277
291
  } = state;
@@ -286,7 +300,7 @@ export const isSelectionValid = (state, supportedBlockNodes = [], isBlockNodeSup
286
300
  const isValidSelection = isTextOrAllSelection || isValidNodeSelection;
287
301
 
288
302
  // Allow media so that it can enter draft mode
289
- if ((_currentMediaNodeWith = currentMediaNodeWithPos(state)) !== null && _currentMediaNodeWith !== void 0 && _currentMediaNodeWith.node) {
303
+ if ((_currentMediaNodeWith2 = currentMediaNodeWithPos(state)) !== null && _currentMediaNodeWith2 !== void 0 && _currentMediaNodeWith2.node) {
290
304
  return AnnotationSelectionType.VALID;
291
305
  }
292
306
  if (isSelectionEmpty || !isValidSelection) {
@@ -271,9 +271,21 @@ export var getDraftCommandAnalyticsPayload = function getDraftCommandAnalyticsPa
271
271
  var payload = function payload(state) {
272
272
  var attributes = {};
273
273
  if (drafting) {
274
+ var _currentMediaNodeWith;
275
+ var selection = state.selection;
276
+ var targetNode = selection instanceof NodeSelection ? selection.node : (_currentMediaNodeWith = currentMediaNodeWithPos(state)) === null || _currentMediaNodeWith === void 0 ? void 0 : _currentMediaNodeWith.node;
277
+ var commentTargetType = 'other';
278
+ if ((targetNode === null || targetNode === void 0 ? void 0 : targetNode.type.name) === 'extension') {
279
+ commentTargetType = targetNode.attrs.extensionKey === 'native-embed:maui' ? 'remixEmbed' : 'other';
280
+ } else if (targetNode && ['media', 'mediaSingle', 'mediaInline'].includes(targetNode.type.name)) {
281
+ commentTargetType = 'media';
282
+ } else if (selection instanceof TextSelection || selection instanceof AllSelection) {
283
+ commentTargetType = 'text';
284
+ }
274
285
  attributes = {
275
286
  inputMethod: inputMethod,
276
- overlap: getAnnotationsInSelectionCount(state)
287
+ overlap: getAnnotationsInSelectionCount(state),
288
+ commentTargetType: commentTargetType
277
289
  };
278
290
  }
279
291
  if (fg('editor_inline_comments_on_inline_nodes')) {
@@ -295,7 +307,7 @@ export var getDraftCommandAnalyticsPayload = function getDraftCommandAnalyticsPa
295
307
  return payload;
296
308
  };
297
309
  export var isSelectionValid = function isSelectionValid(state) {
298
- var _currentMediaNodeWith;
310
+ var _currentMediaNodeWith2;
299
311
  var supportedBlockNodes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
300
312
  var isBlockNodeSupported = arguments.length > 2 ? arguments[2] : undefined;
301
313
  var selection = state.selection;
@@ -309,7 +321,7 @@ export var isSelectionValid = function isSelectionValid(state) {
309
321
  var isValidSelection = isTextOrAllSelection || isValidNodeSelection;
310
322
 
311
323
  // Allow media so that it can enter draft mode
312
- if ((_currentMediaNodeWith = currentMediaNodeWithPos(state)) !== null && _currentMediaNodeWith !== void 0 && _currentMediaNodeWith.node) {
324
+ if ((_currentMediaNodeWith2 = currentMediaNodeWithPos(state)) !== null && _currentMediaNodeWith2 !== void 0 && _currentMediaNodeWith2.node) {
313
325
  return AnnotationSelectionType.VALID;
314
326
  }
315
327
  if (isSelectionEmpty || !isValidSelection) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-annotation",
3
- "version": "29.0.4",
3
+ "version": "29.0.6",
4
4
  "description": "Annotation plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,11 +31,11 @@
31
31
  "@atlaskit/editor-toolbar-model": "^1.2.0",
32
32
  "@atlaskit/icon": "^38.0.0",
33
33
  "@atlaskit/platform-feature-flags": "^2.2.0",
34
- "@atlaskit/tmp-editor-statsig": "^245.0.0",
34
+ "@atlaskit/tmp-editor-statsig": "^246.0.0",
35
35
  "@babel/runtime": "^7.0.0"
36
36
  },
37
37
  "peerDependencies": {
38
- "@atlaskit/editor-common": "^133.5.0",
38
+ "@atlaskit/editor-common": "^133.7.0",
39
39
  "react": "^18.2.0 || ^19.2.0",
40
40
  "react-dom": "^18.2.0 || ^19.2.0",
41
41
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"