@atlaskit/editor-plugin-annotation 1.25.3 → 1.25.4

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,14 @@
1
1
  # @atlaskit/editor-plugin-annotation
2
2
 
3
+ ## 1.25.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#169327](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/169327)
8
+ [`d1439013677f3`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d1439013677f3) -
9
+ [ED-25834] adding tests for allow comment on inline node selection
10
+ - Updated dependencies
11
+
3
12
  ## 1.25.3
4
13
 
5
14
  ### Patch Changes
@@ -322,12 +322,16 @@ var isSelectionValid = exports.isSelectionValid = function isSelectionValid(stat
322
322
  var _ref4 = getPluginState(state) || {},
323
323
  disallowOnWhitespace = _ref4.disallowOnWhitespace;
324
324
  var allowedInlineNodes = ['emoji', 'status', 'date', 'mention', 'inlineCard'];
325
+ var isSelectionEmpty = selection.empty;
326
+ var isTextOrAllSelection = selection instanceof _state.TextSelection || selection instanceof _state.AllSelection;
327
+ var isValidNodeSelection = selection instanceof _state.NodeSelection && allowedInlineNodes.includes(selection.node.type.name) && (0, _platformFeatureFlags.fg)('platform_inline_node_as_valid_annotation_selection');
328
+ var isValidSelection = isTextOrAllSelection || isValidNodeSelection;
325
329
 
326
330
  // Allow media so that it can enter draft mode
327
331
  if ((_currentMediaNodeWith = (0, _mediaSingle.currentMediaNodeWithPos)(state)) !== null && _currentMediaNodeWith !== void 0 && _currentMediaNodeWith.node) {
328
332
  return _types.AnnotationSelectionType.VALID;
329
333
  }
330
- if (selection.empty || !(selection instanceof _state.TextSelection || selection instanceof _state.AllSelection || selection instanceof _state.NodeSelection && allowedInlineNodes.includes(selection.node.type.name) && (0, _platformFeatureFlags.fg)('platform_inline_node_as_valid_annotation_selection'))) {
334
+ if (isSelectionEmpty || !isValidSelection) {
331
335
  return _types.AnnotationSelectionType.INVALID;
332
336
  }
333
337
  var containsInvalidNodes = hasInvalidNodes(state);
@@ -287,12 +287,16 @@ export const isSelectionValid = (state, _supportedNodes = []) => {
287
287
  disallowOnWhitespace
288
288
  } = getPluginState(state) || {};
289
289
  const allowedInlineNodes = ['emoji', 'status', 'date', 'mention', 'inlineCard'];
290
+ const isSelectionEmpty = selection.empty;
291
+ const isTextOrAllSelection = selection instanceof TextSelection || selection instanceof AllSelection;
292
+ const isValidNodeSelection = selection instanceof NodeSelection && allowedInlineNodes.includes(selection.node.type.name) && fg('platform_inline_node_as_valid_annotation_selection');
293
+ const isValidSelection = isTextOrAllSelection || isValidNodeSelection;
290
294
 
291
295
  // Allow media so that it can enter draft mode
292
296
  if ((_currentMediaNodeWith = currentMediaNodeWithPos(state)) !== null && _currentMediaNodeWith !== void 0 && _currentMediaNodeWith.node) {
293
297
  return AnnotationSelectionType.VALID;
294
298
  }
295
- if (selection.empty || !(selection instanceof TextSelection || selection instanceof AllSelection || selection instanceof NodeSelection && allowedInlineNodes.includes(selection.node.type.name) && fg('platform_inline_node_as_valid_annotation_selection'))) {
299
+ if (isSelectionEmpty || !isValidSelection) {
296
300
  return AnnotationSelectionType.INVALID;
297
301
  }
298
302
  const containsInvalidNodes = hasInvalidNodes(state);
@@ -295,12 +295,16 @@ export var isSelectionValid = function isSelectionValid(state) {
295
295
  var _ref4 = getPluginState(state) || {},
296
296
  disallowOnWhitespace = _ref4.disallowOnWhitespace;
297
297
  var allowedInlineNodes = ['emoji', 'status', 'date', 'mention', 'inlineCard'];
298
+ var isSelectionEmpty = selection.empty;
299
+ var isTextOrAllSelection = selection instanceof TextSelection || selection instanceof AllSelection;
300
+ var isValidNodeSelection = selection instanceof NodeSelection && allowedInlineNodes.includes(selection.node.type.name) && fg('platform_inline_node_as_valid_annotation_selection');
301
+ var isValidSelection = isTextOrAllSelection || isValidNodeSelection;
298
302
 
299
303
  // Allow media so that it can enter draft mode
300
304
  if ((_currentMediaNodeWith = currentMediaNodeWithPos(state)) !== null && _currentMediaNodeWith !== void 0 && _currentMediaNodeWith.node) {
301
305
  return AnnotationSelectionType.VALID;
302
306
  }
303
- if (selection.empty || !(selection instanceof TextSelection || selection instanceof AllSelection || selection instanceof NodeSelection && allowedInlineNodes.includes(selection.node.type.name) && fg('platform_inline_node_as_valid_annotation_selection'))) {
307
+ if (isSelectionEmpty || !isValidSelection) {
304
308
  return AnnotationSelectionType.INVALID;
305
309
  }
306
310
  var containsInvalidNodes = hasInvalidNodes(state);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-annotation",
3
- "version": "1.25.3",
3
+ "version": "1.25.4",
4
4
  "description": "Annotation plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^46.1.0",
35
- "@atlaskit/editor-common": "^95.7.0",
35
+ "@atlaskit/editor-common": "^95.8.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
37
37
  "@atlaskit/editor-plugin-editor-viewmode-effects": "^1.1.0",
38
38
  "@atlaskit/editor-plugin-engagement-platform": "^2.1.0",