@atlaskit/editor-plugin-annotation 19.1.0 → 19.2.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.
Files changed (32) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/annotationPlugin.js +2 -2
  3. package/dist/cjs/editor-commands/index.js +22 -14
  4. package/dist/cjs/editor-commands/transform.js +4 -4
  5. package/dist/cjs/pm-plugins/annotation-manager-hooks.js +5 -5
  6. package/dist/cjs/pm-plugins/inline-comment.js +2 -3
  7. package/dist/cjs/pm-plugins/reducer.js +3 -3
  8. package/dist/cjs/pm-plugins/utils.js +10 -5
  9. package/dist/cjs/ui/InlineCommentView.js +3 -3
  10. package/dist/es2019/annotationPlugin.js +2 -2
  11. package/dist/es2019/editor-commands/index.js +20 -18
  12. package/dist/es2019/editor-commands/transform.js +4 -4
  13. package/dist/es2019/pm-plugins/annotation-manager-hooks.js +5 -5
  14. package/dist/es2019/pm-plugins/inline-comment.js +3 -4
  15. package/dist/es2019/pm-plugins/reducer.js +3 -3
  16. package/dist/es2019/pm-plugins/utils.js +9 -7
  17. package/dist/es2019/ui/InlineCommentView.js +3 -3
  18. package/dist/esm/annotationPlugin.js +2 -2
  19. package/dist/esm/editor-commands/index.js +22 -14
  20. package/dist/esm/editor-commands/transform.js +4 -4
  21. package/dist/esm/pm-plugins/annotation-manager-hooks.js +5 -5
  22. package/dist/esm/pm-plugins/inline-comment.js +3 -4
  23. package/dist/esm/pm-plugins/reducer.js +3 -3
  24. package/dist/esm/pm-plugins/utils.js +10 -5
  25. package/dist/esm/ui/InlineCommentView.js +3 -3
  26. package/dist/types/editor-commands/index.d.ts +7 -7
  27. package/dist/types/editor-commands/transform.d.ts +3 -3
  28. package/dist/types/pm-plugins/annotation-manager-hooks.d.ts +1 -1
  29. package/dist/types/pm-plugins/types.d.ts +1 -0
  30. package/dist/types/pm-plugins/utils.d.ts +4 -4
  31. package/dist/types/types/index.d.ts +9 -0
  32. package/package.json +5 -1
@@ -3,7 +3,7 @@ import type { Mark, Node, ResolvedPos, Schema, Slice } from '@atlaskit/editor-pr
3
3
  import type { EditorState, Selection, SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
4
4
  import { AllSelection, NodeSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
5
5
  import { Decoration } from '@atlaskit/editor-prosemirror/view';
6
- import type { AnnotationInfo, DraftBookmark, InlineCommentInputMethod, TargetType } from '../types';
6
+ import type { AnnotationInfo, DraftBookmark, InlineCommentAnnotationProvider, InlineCommentInputMethod, TargetType } from '../types';
7
7
  import { AnnotationSelectionType } from '../types';
8
8
  import type { InlineCommentPluginState } from './types';
9
9
  /**
@@ -19,7 +19,7 @@ export declare const decorationKey: {
19
19
  export declare const addDraftDecoration: (start: number, end: number, targetType?: TargetType) => Decoration;
20
20
  export declare const getAnnotationViewKey: (annotations: AnnotationInfo[]) => string;
21
21
  export declare const findAnnotationsInSelection: (selection: Selection, doc: Node) => AnnotationInfo[];
22
- export declare const resolveDraftBookmark: (editorState: EditorState, bookmark?: SelectionBookmark, supportedBlockNodes?: string[]) => DraftBookmark;
22
+ export declare const resolveDraftBookmark: (editorState: EditorState, bookmark?: SelectionBookmark, supportedBlockNodes?: string[], isBlockNodeSupported?: InlineCommentAnnotationProvider['isBlockNodeSupported']) => DraftBookmark;
23
23
  /**
24
24
  * get selection from position to apply new comment for
25
25
  * @returns bookmarked positions if they exists, otherwise current selection positions
@@ -31,9 +31,9 @@ export declare const getPluginState: (state: EditorState) => InlineCommentPlugin
31
31
  * get payload for the open/close analytics event
32
32
  */
33
33
  export declare const getDraftCommandAnalyticsPayload: (drafting: boolean, inputMethod: InlineCommentInputMethod) => AnalyticsEventPayloadCallback;
34
- export declare const isSelectionValid: (state: EditorState, _supportedNodes?: string[]) => AnnotationSelectionType;
34
+ export declare const isSelectionValid: (state: EditorState, supportedBlockNodes?: string[], isBlockNodeSupported?: InlineCommentAnnotationProvider['isBlockNodeSupported']) => AnnotationSelectionType;
35
35
  export declare const hasInvalidNodes: (state: EditorState) => boolean;
36
- export declare const isSupportedBlockNode: (node: Node, supportedBlockNodes?: string[]) => boolean;
36
+ export declare const isSupportedBlockNode: (node: Node, supportedBlockNodes?: string[], isBlockNodeSupported?: InlineCommentAnnotationProvider['isBlockNodeSupported']) => boolean;
37
37
  /**
38
38
  * Checks if any of the nodes in a given selection are completely whitespace
39
39
  * This is to conform to Confluence annotation specifications
@@ -2,6 +2,7 @@ import type React from 'react';
2
2
  import type { AnnotationTypes } from '@atlaskit/adf-schema/annotation';
3
3
  import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import type { AnnotationUpdateEmitter, AnnotationManager } from '@atlaskit/editor-common/annotation';
5
+ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
5
6
  /**
6
7
  * type of target that annotation apply to.
7
8
  * This is used to apply correct decoration to a draft comment
@@ -99,6 +100,14 @@ export type InlineCommentAnnotationProvider = AnnotationTypeProvider<AnnotationT
99
100
  contentType?: string;
100
101
  createComponent?: React.ComponentType<React.PropsWithChildren<InlineCommentCreateComponentProps>>;
101
102
  getCanAddComments?: () => boolean;
103
+ /**
104
+ * @experimental Still under development. Do not use.
105
+ *
106
+ * Determines whether a specific block node supports inline comments.
107
+ * This is additive to `supportedBlockNodes`; a node is supported when either configuration
108
+ * matches it.
109
+ */
110
+ isBlockNodeSupported?: (node: PMNode) => boolean;
102
111
  isToolbarAbove?: boolean;
103
112
  onCommentButtonMount?: () => void;
104
113
  /** Checks whether the active inline comment can be safely closed. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-annotation",
3
- "version": "19.1.0",
3
+ "version": "19.2.0",
4
4
  "description": "Annotation plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -48,6 +48,10 @@
48
48
  "wait-for-expect": "^1.2.0"
49
49
  },
50
50
  "platform-feature-flags": {
51
+ "cc_maui_annotations_on_extensions": {
52
+ "type": "boolean",
53
+ "referenceOnly": true
54
+ },
51
55
  "platform_editor_comments_api_manager": {
52
56
  "type": "boolean",
53
57
  "referenceOnly": true