@atlaskit/editor-plugin-annotation 1.25.1 → 1.25.3

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,22 @@
1
1
  # @atlaskit/editor-plugin-annotation
2
2
 
3
+ ## 1.25.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#165765](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/165765)
8
+ [`3f441f30e6507`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3f441f30e6507) -
9
+ Bump adf-schema to 46.0.0
10
+ - Updated dependencies
11
+
12
+ ## 1.25.2
13
+
14
+ ### Patch Changes
15
+
16
+ - [#168832](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/168832)
17
+ [`6a5261e14e959`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/6a5261e14e959) -
18
+ [ux] ED-25834 allow comment on inline node selection
19
+
3
20
  ## 1.25.1
4
21
 
5
22
  ### Patch Changes
@@ -321,12 +321,13 @@ var isSelectionValid = exports.isSelectionValid = function isSelectionValid(stat
321
321
  var selection = state.selection;
322
322
  var _ref4 = getPluginState(state) || {},
323
323
  disallowOnWhitespace = _ref4.disallowOnWhitespace;
324
+ var allowedInlineNodes = ['emoji', 'status', 'date', 'mention', 'inlineCard'];
324
325
 
325
326
  // Allow media so that it can enter draft mode
326
327
  if ((_currentMediaNodeWith = (0, _mediaSingle.currentMediaNodeWithPos)(state)) !== null && _currentMediaNodeWith !== void 0 && _currentMediaNodeWith.node) {
327
328
  return _types.AnnotationSelectionType.VALID;
328
329
  }
329
- if (selection.empty || !(selection instanceof _state.TextSelection || selection instanceof _state.AllSelection)) {
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'))) {
330
331
  return _types.AnnotationSelectionType.INVALID;
331
332
  }
332
333
  var containsInvalidNodes = hasInvalidNodes(state);
@@ -342,7 +343,7 @@ var isSelectionValid = exports.isSelectionValid = function isSelectionValid(stat
342
343
  if (disallowOnWhitespace && hasInvalidWhitespaceNode(selection, state.schema)) {
343
344
  return _types.AnnotationSelectionType.INVALID;
344
345
  }
345
- if ((0, _utils.isEmptyTextSelection)(selection, state.schema)) {
346
+ if (!(selection instanceof _state.NodeSelection) && (0, _utils.isEmptyTextSelection)(selection, state.schema)) {
346
347
  return _types.AnnotationSelectionType.INVALID;
347
348
  }
348
349
  return _types.AnnotationSelectionType.VALID;
@@ -286,12 +286,13 @@ export const isSelectionValid = (state, _supportedNodes = []) => {
286
286
  const {
287
287
  disallowOnWhitespace
288
288
  } = getPluginState(state) || {};
289
+ const allowedInlineNodes = ['emoji', 'status', 'date', 'mention', 'inlineCard'];
289
290
 
290
291
  // Allow media so that it can enter draft mode
291
292
  if ((_currentMediaNodeWith = currentMediaNodeWithPos(state)) !== null && _currentMediaNodeWith !== void 0 && _currentMediaNodeWith.node) {
292
293
  return AnnotationSelectionType.VALID;
293
294
  }
294
- if (selection.empty || !(selection instanceof TextSelection || selection instanceof AllSelection)) {
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'))) {
295
296
  return AnnotationSelectionType.INVALID;
296
297
  }
297
298
  const containsInvalidNodes = hasInvalidNodes(state);
@@ -307,7 +308,7 @@ export const isSelectionValid = (state, _supportedNodes = []) => {
307
308
  if (disallowOnWhitespace && hasInvalidWhitespaceNode(selection, state.schema)) {
308
309
  return AnnotationSelectionType.INVALID;
309
310
  }
310
- if (isEmptyTextSelection(selection, state.schema)) {
311
+ if (!(selection instanceof NodeSelection) && isEmptyTextSelection(selection, state.schema)) {
311
312
  return AnnotationSelectionType.INVALID;
312
313
  }
313
314
  return AnnotationSelectionType.VALID;
@@ -294,12 +294,13 @@ export var isSelectionValid = function isSelectionValid(state) {
294
294
  var selection = state.selection;
295
295
  var _ref4 = getPluginState(state) || {},
296
296
  disallowOnWhitespace = _ref4.disallowOnWhitespace;
297
+ var allowedInlineNodes = ['emoji', 'status', 'date', 'mention', 'inlineCard'];
297
298
 
298
299
  // Allow media so that it can enter draft mode
299
300
  if ((_currentMediaNodeWith = currentMediaNodeWithPos(state)) !== null && _currentMediaNodeWith !== void 0 && _currentMediaNodeWith.node) {
300
301
  return AnnotationSelectionType.VALID;
301
302
  }
302
- if (selection.empty || !(selection instanceof TextSelection || selection instanceof AllSelection)) {
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'))) {
303
304
  return AnnotationSelectionType.INVALID;
304
305
  }
305
306
  var containsInvalidNodes = hasInvalidNodes(state);
@@ -315,7 +316,7 @@ export var isSelectionValid = function isSelectionValid(state) {
315
316
  if (disallowOnWhitespace && hasInvalidWhitespaceNode(selection, state.schema)) {
316
317
  return AnnotationSelectionType.INVALID;
317
318
  }
318
- if (isEmptyTextSelection(selection, state.schema)) {
319
+ if (!(selection instanceof NodeSelection) && isEmptyTextSelection(selection, state.schema)) {
319
320
  return AnnotationSelectionType.INVALID;
320
321
  }
321
322
  return AnnotationSelectionType.VALID;
@@ -2,7 +2,7 @@ import type { AnalyticsEventPayloadCallback } from '@atlaskit/editor-common/anal
2
2
  import { containsAnyAnnotations, hasAnnotationMark } from '@atlaskit/editor-common/utils';
3
3
  import type { Mark, Node, ResolvedPos, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
4
4
  import type { EditorState, Selection, SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
5
- import { AllSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
5
+ import { AllSelection, NodeSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
6
6
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
7
7
  import type { AnnotationInfo, DraftBookmark, InlineCommentInputMethod, TargetType } from '../types';
8
8
  import { AnnotationSelectionType } from '../types';
@@ -41,7 +41,7 @@ export declare const isSupportedBlockNode: (node: Node, supportedBlockNodes?: st
41
41
  * Checks if any of the nodes in a given selection are completely whitespace
42
42
  * This is to conform to Confluence annotation specifications
43
43
  */
44
- export declare function hasInvalidWhitespaceNode(selection: TextSelection | AllSelection, schema: Schema): boolean;
44
+ export declare function hasInvalidWhitespaceNode(selection: TextSelection | AllSelection | NodeSelection, schema: Schema): boolean;
45
45
  export declare function annotationExists(annotationId: string, state: EditorState): boolean;
46
46
  export declare function stripNonExistingAnnotations(slice: Slice, state: EditorState): false | undefined;
47
47
  /**
@@ -2,7 +2,7 @@ import type { AnalyticsEventPayloadCallback } from '@atlaskit/editor-common/anal
2
2
  import { containsAnyAnnotations, hasAnnotationMark } from '@atlaskit/editor-common/utils';
3
3
  import type { Mark, Node, ResolvedPos, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
4
4
  import type { EditorState, Selection, SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
5
- import { AllSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
5
+ import { AllSelection, NodeSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
6
6
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
7
7
  import type { AnnotationInfo, DraftBookmark, InlineCommentInputMethod, TargetType } from '../types';
8
8
  import { AnnotationSelectionType } from '../types';
@@ -41,7 +41,7 @@ export declare const isSupportedBlockNode: (node: Node, supportedBlockNodes?: st
41
41
  * Checks if any of the nodes in a given selection are completely whitespace
42
42
  * This is to conform to Confluence annotation specifications
43
43
  */
44
- export declare function hasInvalidWhitespaceNode(selection: TextSelection | AllSelection, schema: Schema): boolean;
44
+ export declare function hasInvalidWhitespaceNode(selection: TextSelection | AllSelection | NodeSelection, schema: Schema): boolean;
45
45
  export declare function annotationExists(annotationId: string, state: EditorState): boolean;
46
46
  export declare function stripNonExistingAnnotations(slice: Slice, state: EditorState): false | undefined;
47
47
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-annotation",
3
- "version": "1.25.1",
3
+ "version": "1.25.3",
4
4
  "description": "Annotation plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,8 +31,8 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/adf-schema": "^44.2.0",
35
- "@atlaskit/editor-common": "^95.6.0",
34
+ "@atlaskit/adf-schema": "^46.1.0",
35
+ "@atlaskit/editor-common": "^95.7.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",
@@ -41,7 +41,7 @@
41
41
  "@atlaskit/icon": "^22.26.0",
42
42
  "@atlaskit/onboarding": "^12.1.0",
43
43
  "@atlaskit/platform-feature-flags": "^0.3.0",
44
- "@atlaskit/tmp-editor-statsig": "^2.20.0",
44
+ "@atlaskit/tmp-editor-statsig": "^2.21.0",
45
45
  "@babel/runtime": "^7.0.0"
46
46
  },
47
47
  "peerDependencies": {
@@ -99,6 +99,9 @@
99
99
  },
100
100
  "editor_inline_comments_on_inline_nodes_spotlight": {
101
101
  "type": "boolean"
102
+ },
103
+ "platform_inline_node_as_valid_annotation_selection": {
104
+ "type": "boolean"
102
105
  }
103
106
  }
104
107
  }