@atlaskit/editor-plugin-annotation 1.9.4 → 1.10.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 CHANGED
@@ -1,5 +1,23 @@
1
1
  # @atlaskit/editor-plugin-annotation
2
2
 
3
+ ## 1.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#108623](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/108623)
8
+ [`c01339668ebde`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c01339668ebde) -
9
+ [ux] ED-23617 Add support in editor for comments on status, emoji, date and mention nodes
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
15
+ ## 1.9.5
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies
20
+
3
21
  ## 1.9.4
4
22
 
5
23
  ### Patch Changes
package/dist/cjs/utils.js CHANGED
@@ -375,30 +375,52 @@ var isSupportedBlockNode = exports.isSupportedBlockNode = function isSupportedBl
375
375
  function hasInvalidWhitespaceNode(selection, schema) {
376
376
  var foundInvalidWhitespace = false;
377
377
  var content = selection.content().content;
378
+ var hasCommentableInlineNodeDescendants = false;
379
+ var hasCommentableTextNodeDescendants = false;
378
380
  content.descendants(function (node) {
381
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
382
+ var isAllowedInlineNode = ['emoji', 'status', 'date', 'mention', 'inlineCard'].includes(node.type.name);
383
+ if (isAllowedInlineNode) {
384
+ hasCommentableInlineNodeDescendants = true;
385
+ return false;
386
+ }
387
+ }
379
388
  if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes') && node.type === schema.nodes.inlineCard) {
380
389
  return false;
381
390
  }
382
391
  if ((0, _utils.isText)(node, schema)) {
392
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
393
+ if (node.textContent.trim() !== '') {
394
+ hasCommentableTextNodeDescendants = true;
395
+ }
396
+ }
383
397
  return false;
384
398
  }
385
- if (node.textContent.trim() === '') {
386
- // Trailing new lines do not result in the annotation spanning into
387
- // the trailing new line so can be ignored when looking for invalid
388
- // whitespace nodes.
389
- var nodeIsTrailingNewLine =
390
- // it is the final node
391
- node.eq(content.lastChild) &&
392
- // and there are multiple nodes
393
- !node.eq(content.firstChild) &&
394
- // and it is a paragraph node
395
- (0, _utils.isParagraph)(node, schema);
396
- if (!nodeIsTrailingNewLine) {
397
- foundInvalidWhitespace = true;
399
+ if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
400
+ if (node.textContent.trim() === '') {
401
+ // Trailing new lines do not result in the annotation spanning into
402
+ // the trailing new line so can be ignored when looking for invalid
403
+ // whitespace nodes.
404
+ var nodeIsTrailingNewLine =
405
+ // it is the final node
406
+ node.eq(content.lastChild) &&
407
+ // and there are multiple nodes
408
+ !node.eq(content.firstChild) &&
409
+ // and it is a paragraph node
410
+ (0, _utils.isParagraph)(node, schema);
411
+ if (!nodeIsTrailingNewLine) {
412
+ foundInvalidWhitespace = true;
413
+ }
398
414
  }
399
415
  }
400
416
  return !foundInvalidWhitespace;
401
417
  });
418
+ if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
419
+ if (hasCommentableInlineNodeDescendants) {
420
+ return false;
421
+ }
422
+ return !hasCommentableTextNodeDescendants;
423
+ }
402
424
  return foundInvalidWhitespace;
403
425
  }
404
426
 
@@ -341,30 +341,52 @@ export const isSupportedBlockNode = (node, supportedBlockNodes = []) => {
341
341
  export function hasInvalidWhitespaceNode(selection, schema) {
342
342
  let foundInvalidWhitespace = false;
343
343
  const content = selection.content().content;
344
+ let hasCommentableInlineNodeDescendants = false;
345
+ let hasCommentableTextNodeDescendants = false;
344
346
  content.descendants(node => {
347
+ if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
348
+ const isAllowedInlineNode = ['emoji', 'status', 'date', 'mention', 'inlineCard'].includes(node.type.name);
349
+ if (isAllowedInlineNode) {
350
+ hasCommentableInlineNodeDescendants = true;
351
+ return false;
352
+ }
353
+ }
345
354
  if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes') && node.type === schema.nodes.inlineCard) {
346
355
  return false;
347
356
  }
348
357
  if (isText(node, schema)) {
358
+ if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
359
+ if (node.textContent.trim() !== '') {
360
+ hasCommentableTextNodeDescendants = true;
361
+ }
362
+ }
349
363
  return false;
350
364
  }
351
- if (node.textContent.trim() === '') {
352
- // Trailing new lines do not result in the annotation spanning into
353
- // the trailing new line so can be ignored when looking for invalid
354
- // whitespace nodes.
355
- const nodeIsTrailingNewLine =
356
- // it is the final node
357
- node.eq(content.lastChild) &&
358
- // and there are multiple nodes
359
- !node.eq(content.firstChild) &&
360
- // and it is a paragraph node
361
- isParagraph(node, schema);
362
- if (!nodeIsTrailingNewLine) {
363
- foundInvalidWhitespace = true;
365
+ if (!getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
366
+ if (node.textContent.trim() === '') {
367
+ // Trailing new lines do not result in the annotation spanning into
368
+ // the trailing new line so can be ignored when looking for invalid
369
+ // whitespace nodes.
370
+ const nodeIsTrailingNewLine =
371
+ // it is the final node
372
+ node.eq(content.lastChild) &&
373
+ // and there are multiple nodes
374
+ !node.eq(content.firstChild) &&
375
+ // and it is a paragraph node
376
+ isParagraph(node, schema);
377
+ if (!nodeIsTrailingNewLine) {
378
+ foundInvalidWhitespace = true;
379
+ }
364
380
  }
365
381
  }
366
382
  return !foundInvalidWhitespace;
367
383
  });
384
+ if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
385
+ if (hasCommentableInlineNodeDescendants) {
386
+ return false;
387
+ }
388
+ return !hasCommentableTextNodeDescendants;
389
+ }
368
390
  return foundInvalidWhitespace;
369
391
  }
370
392
 
package/dist/esm/utils.js CHANGED
@@ -348,30 +348,52 @@ export var isSupportedBlockNode = function isSupportedBlockNode(node) {
348
348
  export function hasInvalidWhitespaceNode(selection, schema) {
349
349
  var foundInvalidWhitespace = false;
350
350
  var content = selection.content().content;
351
+ var hasCommentableInlineNodeDescendants = false;
352
+ var hasCommentableTextNodeDescendants = false;
351
353
  content.descendants(function (node) {
354
+ if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
355
+ var isAllowedInlineNode = ['emoji', 'status', 'date', 'mention', 'inlineCard'].includes(node.type.name);
356
+ if (isAllowedInlineNode) {
357
+ hasCommentableInlineNodeDescendants = true;
358
+ return false;
359
+ }
360
+ }
352
361
  if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes') && node.type === schema.nodes.inlineCard) {
353
362
  return false;
354
363
  }
355
364
  if (isText(node, schema)) {
365
+ if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
366
+ if (node.textContent.trim() !== '') {
367
+ hasCommentableTextNodeDescendants = true;
368
+ }
369
+ }
356
370
  return false;
357
371
  }
358
- if (node.textContent.trim() === '') {
359
- // Trailing new lines do not result in the annotation spanning into
360
- // the trailing new line so can be ignored when looking for invalid
361
- // whitespace nodes.
362
- var nodeIsTrailingNewLine =
363
- // it is the final node
364
- node.eq(content.lastChild) &&
365
- // and there are multiple nodes
366
- !node.eq(content.firstChild) &&
367
- // and it is a paragraph node
368
- isParagraph(node, schema);
369
- if (!nodeIsTrailingNewLine) {
370
- foundInvalidWhitespace = true;
372
+ if (!getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
373
+ if (node.textContent.trim() === '') {
374
+ // Trailing new lines do not result in the annotation spanning into
375
+ // the trailing new line so can be ignored when looking for invalid
376
+ // whitespace nodes.
377
+ var nodeIsTrailingNewLine =
378
+ // it is the final node
379
+ node.eq(content.lastChild) &&
380
+ // and there are multiple nodes
381
+ !node.eq(content.firstChild) &&
382
+ // and it is a paragraph node
383
+ isParagraph(node, schema);
384
+ if (!nodeIsTrailingNewLine) {
385
+ foundInvalidWhitespace = true;
386
+ }
371
387
  }
372
388
  }
373
389
  return !foundInvalidWhitespace;
374
390
  });
391
+ if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
392
+ if (hasCommentableInlineNodeDescendants) {
393
+ return false;
394
+ }
395
+ return !hasCommentableTextNodeDescendants;
396
+ }
375
397
  return foundInvalidWhitespace;
376
398
  }
377
399
 
@@ -49,6 +49,7 @@ declare const _default: {
49
49
  to: number;
50
50
  mark: import("prosemirror-model").Mark;
51
51
  }) => boolean;
52
+ isRemoteReplaceDocumentTransaction: (tr: Transaction) => boolean;
52
53
  };
53
54
  }, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>];
54
55
  pluginConfiguration?: {
@@ -114,6 +115,7 @@ declare const _default: {
114
115
  to: number;
115
116
  mark: import("prosemirror-model").Mark;
116
117
  }) => boolean;
118
+ isRemoteReplaceDocumentTransaction: (tr: Transaction) => boolean;
117
119
  };
118
120
  }, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>];
119
121
  pluginConfiguration?: {
@@ -60,6 +60,7 @@ declare const _default: {
60
60
  to: number;
61
61
  mark: import("prosemirror-model").Mark;
62
62
  }) => boolean;
63
+ isRemoteReplaceDocumentTransaction: (tr: Transaction) => boolean;
63
64
  };
64
65
  }, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>
65
66
  ];
@@ -138,6 +139,7 @@ declare const _default: {
138
139
  to: number;
139
140
  mark: import("prosemirror-model").Mark;
140
141
  }) => boolean;
142
+ isRemoteReplaceDocumentTransaction: (tr: Transaction) => boolean;
141
143
  };
142
144
  }, import("@atlaskit/editor-plugin-collab-edit").PrivateCollabEditOptions>
143
145
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-annotation",
3
- "version": "1.9.4",
3
+ "version": "1.10.0",
4
4
  "description": "Annotation plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@atlaskit/adf-schema": "^36.10.7",
36
- "@atlaskit/editor-common": "^81.2.0",
36
+ "@atlaskit/editor-common": "^82.1.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^1.2.0",
38
38
  "@atlaskit/editor-plugin-editor-viewmode": "^1.1.0",
39
39
  "@atlaskit/editor-plugin-feature-flags": "^1.1.0",
@@ -96,6 +96,9 @@
96
96
  "platform.editor.allow-inline-comments-for-inline-nodes": {
97
97
  "type": "boolean"
98
98
  },
99
+ "platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz": {
100
+ "type": "boolean"
101
+ },
99
102
  "platform.editor.comments-on-media.bug.preserve-draft_i3vqb": {
100
103
  "type": "boolean"
101
104
  }