@atlaskit/editor-plugin-annotation 11.0.14 → 11.0.16

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 (33) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/annotationPlugin/package.json +1 -8
  3. package/annotationPluginType/package.json +1 -8
  4. package/package.json +2 -2
  5. package/pm-plugins/types/package.json +1 -8
  6. package/types/package.json +1 -8
  7. package/dist/types-ts4.5/annotationPlugin.d.ts +0 -2
  8. package/dist/types-ts4.5/annotationPluginType.d.ts +0 -57
  9. package/dist/types-ts4.5/editor-commands/index.d.ts +0 -30
  10. package/dist/types-ts4.5/editor-commands/transform.d.ts +0 -16
  11. package/dist/types-ts4.5/editor-commands/utils.d.ts +0 -5
  12. package/dist/types-ts4.5/entry-points/annotationPlugin.d.ts +0 -1
  13. package/dist/types-ts4.5/entry-points/annotationPluginType.d.ts +0 -1
  14. package/dist/types-ts4.5/entry-points/pm-plugins-types.d.ts +0 -1
  15. package/dist/types-ts4.5/entry-points/types.d.ts +0 -1
  16. package/dist/types-ts4.5/index.d.ts +0 -4
  17. package/dist/types-ts4.5/nodeviews/annotationMark.d.ts +0 -6
  18. package/dist/types-ts4.5/nodeviews/index.d.ts +0 -2
  19. package/dist/types-ts4.5/pm-plugins/annotation-manager-hooks.d.ts +0 -12
  20. package/dist/types-ts4.5/pm-plugins/inline-comment.d.ts +0 -3
  21. package/dist/types-ts4.5/pm-plugins/keymap.d.ts +0 -4
  22. package/dist/types-ts4.5/pm-plugins/plugin-factory.d.ts +0 -16
  23. package/dist/types-ts4.5/pm-plugins/reducer.d.ts +0 -3
  24. package/dist/types-ts4.5/pm-plugins/toolbar.d.ts +0 -49
  25. package/dist/types-ts4.5/pm-plugins/types.d.ts +0 -174
  26. package/dist/types-ts4.5/pm-plugins/utils.d.ts +0 -53
  27. package/dist/types-ts4.5/types/index.d.ts +0 -169
  28. package/dist/types-ts4.5/ui/AnnotationViewWrapper.d.ts +0 -11
  29. package/dist/types-ts4.5/ui/CommentButton/CommentButton.d.ts +0 -10
  30. package/dist/types-ts4.5/ui/CommentButton/hooks.d.ts +0 -12
  31. package/dist/types-ts4.5/ui/CommentButton/utils.d.ts +0 -34
  32. package/dist/types-ts4.5/ui/InlineCommentView.d.ts +0 -15
  33. package/dist/types-ts4.5/ui/toolbar-components.d.ts +0 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-annotation
2
2
 
3
+ ## 11.0.16
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 11.0.15
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 11.0.14
4
16
 
5
17
  ### Patch Changes
@@ -4,12 +4,5 @@
4
4
  "module": "../dist/esm/entry-points/annotationPlugin.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/annotationPlugin.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/annotationPlugin.d.ts",
8
- "typesVersions": {
9
- ">=4.5 <5.9": {
10
- "*": [
11
- "../dist/types-ts4.5/entry-points/annotationPlugin.d.ts"
12
- ]
13
- }
14
- }
7
+ "types": "../dist/types/entry-points/annotationPlugin.d.ts"
15
8
  }
@@ -4,12 +4,5 @@
4
4
  "module": "../dist/esm/entry-points/annotationPluginType.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/annotationPluginType.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/annotationPluginType.d.ts",
8
- "typesVersions": {
9
- ">=4.5 <5.9": {
10
- "*": [
11
- "../dist/types-ts4.5/entry-points/annotationPluginType.d.ts"
12
- ]
13
- }
14
- }
7
+ "types": "../dist/types/entry-points/annotationPluginType.d.ts"
15
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-annotation",
3
- "version": "11.0.14",
3
+ "version": "11.0.16",
4
4
  "description": "Annotation plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -39,7 +39,7 @@
39
39
  "@atlaskit/editor-toolbar-model": "^0.5.0",
40
40
  "@atlaskit/icon": "^35.4.0",
41
41
  "@atlaskit/platform-feature-flags": "^1.1.0",
42
- "@atlaskit/tmp-editor-statsig": "^101.0.0",
42
+ "@atlaskit/tmp-editor-statsig": "^103.0.0",
43
43
  "@babel/runtime": "^7.0.0"
44
44
  },
45
45
  "peerDependencies": {
@@ -4,12 +4,5 @@
4
4
  "module": "../../dist/esm/entry-points/pm-plugins-types.js",
5
5
  "module:es2019": "../../dist/es2019/entry-points/pm-plugins-types.js",
6
6
  "sideEffects": false,
7
- "types": "../../dist/types/entry-points/pm-plugins-types.d.ts",
8
- "typesVersions": {
9
- ">=4.5 <5.9": {
10
- "*": [
11
- "../../dist/types-ts4.5/entry-points/pm-plugins-types.d.ts"
12
- ]
13
- }
14
- }
7
+ "types": "../../dist/types/entry-points/pm-plugins-types.d.ts"
15
8
  }
@@ -4,12 +4,5 @@
4
4
  "module": "../dist/esm/entry-points/types.js",
5
5
  "module:es2019": "../dist/es2019/entry-points/types.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/entry-points/types.d.ts",
8
- "typesVersions": {
9
- ">=4.5 <5.9": {
10
- "*": [
11
- "../dist/types-ts4.5/entry-points/types.d.ts"
12
- ]
13
- }
14
- }
7
+ "types": "../dist/types/entry-points/types.d.ts"
15
8
  }
@@ -1,2 +0,0 @@
1
- import type { AnnotationPlugin } from './annotationPluginType';
2
- export declare const annotationPlugin: AnnotationPlugin;
@@ -1,57 +0,0 @@
1
- import type { Command, ExtractInjectionAPI, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
- import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
- import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
4
- import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
5
- import type { EditorViewModeEffectsPlugin } from '@atlaskit/editor-plugin-editor-viewmode-effects';
6
- import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
7
- import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
8
- import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
9
- import type { Slice } from '@atlaskit/editor-prosemirror/model';
10
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
11
- import type { showInlineCommentForBlockNode } from './editor-commands';
12
- import type { InlineCommentPluginState } from './pm-plugins/types';
13
- import type { AnnotationProviders, InlineCommentInputMethod, TargetType } from './types';
14
- type StripNonExistingAnnotations = (slice: Slice, state: EditorState) => boolean | undefined;
15
- type SetInlineCommentDraftState = (drafting: boolean, inputMethod: InlineCommentInputMethod,
16
- /** @default 'inline' */
17
- targetType?: TargetType, targetNodeId?: string, isOpeningMediaCommentFromToolbar?: boolean) => Command;
18
- export type AnnotationPluginDependencies = [
19
- OptionalPlugin<AnalyticsPlugin>,
20
- OptionalPlugin<EditorViewModeEffectsPlugin>,
21
- OptionalPlugin<EditorViewModePlugin>,
22
- OptionalPlugin<FeatureFlagsPlugin>,
23
- OptionalPlugin<ConnectivityPlugin>,
24
- OptionalPlugin<ToolbarPlugin>,
25
- OptionalPlugin<UserIntentPlugin>
26
- ];
27
- export type AnnotationPluginOptions = AnnotationProviders;
28
- export type AnnotationPlugin = NextEditorPlugin<'annotation', {
29
- actions: {
30
- hasAnyUnResolvedAnnotationInPage: (state: EditorState) => boolean;
31
- setInlineCommentDraftState: SetInlineCommentDraftState;
32
- /**
33
- * Sets a pending selected annotation, opening its comment popup or panel.
34
- * Equivalent to clicking the annotation mark in the WYSIWYG view.
35
- * Use when the annotation manager (comments panel) IS enabled.
36
- */
37
- setPendingSelectedAnnotation: (annotationId: string) => Command;
38
- /**
39
- * Selects the given annotation, opening its comment popup or panel.
40
- * Equivalent to clicking the annotation mark in the WYSIWYG view.
41
- * Use when the annotation manager (comments panel) is NOT enabled.
42
- */
43
- setSelectedAnnotation: (annotationId: string) => Command;
44
- /**
45
- * This function attempts to display the inline comment popup for a given node.
46
- * @returns A command function that returns true if the given node is supported and has resolved annotation mark(s);
47
- * otherwise, it will return false.
48
- */
49
- showCommentForBlockNode: ReturnType<typeof showInlineCommentForBlockNode>;
50
- stripNonExistingAnnotations: StripNonExistingAnnotations;
51
- };
52
- dependencies: AnnotationPluginDependencies;
53
- pluginConfiguration: AnnotationPluginOptions | undefined;
54
- sharedState: InlineCommentPluginState | undefined;
55
- }>;
56
- export type AnnotationPluginInjectionAPI = ExtractInjectionAPI<AnnotationPlugin> | undefined;
57
- export {};
@@ -1,30 +0,0 @@
1
- import { AnnotationTypes } from '@atlaskit/adf-schema';
2
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
- import { RESOLVE_METHOD, type VIEW_METHOD } from '@atlaskit/editor-common/analytics';
4
- import type { Command, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
- import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
6
- import type { AnnotationPlugin } from '../annotationPluginType';
7
- import type { InlineCommentMap, InlineCommentMouseData } from '../pm-plugins/types';
8
- import type { InlineCommentInputMethod, TargetType } from '../types';
9
- export declare const updateInlineCommentResolvedState: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (partialNewState: InlineCommentMap, resolveMethod?: RESOLVE_METHOD) => Command;
10
- export declare const closeComponent: () => Command;
11
- export declare const clearDirtyMark: () => Command;
12
- export declare const setInlineCommentsFetched: () => Command;
13
- export declare const flushPendingSelections: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (canSetAsSelectedAnnotations: boolean, errorReason?: string) => Command;
14
- export declare const setPendingSelectedAnnotation: (id: string) => Command;
15
- export declare const removeInlineCommentNearSelection: (id: string, supportedNodes?: string[]) => Command;
16
- export declare const removeInlineCommentFromDoc: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (id: string, supportedNodes?: string[]) => Command;
17
- /**
18
- * Show active inline comments for a given block node, otherwise,
19
- * return false if the node has no comments or no unresolved comments.
20
- * @param supportedBlockNodes
21
- * @example
22
- */
23
- export declare const showInlineCommentForBlockNode: (supportedBlockNodes?: string[]) => (node: PMNode | null, viewMethod?: VIEW_METHOD, isOpeningMediaCommentFromToolbar?: boolean) => Command;
24
- export declare const setInlineCommentDraftState: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, supportedBlockNodes?: string[], api?: ExtractInjectionAPI<AnnotationPlugin>) => (drafting: boolean, inputMethod?: InlineCommentInputMethod, targetType?: TargetType, targetNodeId?: string | undefined, isOpeningMediaCommentFromToolbar?: boolean) => Command;
25
- export declare const addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, editorAPI?: ExtractInjectionAPI<AnnotationPlugin> | undefined) => (id: string, supportedBlockNodes?: string[]) => Command;
26
- export declare const updateMouseState: (mouseData: InlineCommentMouseData) => Command;
27
- export declare const setSelectedAnnotation: (id: string) => Command;
28
- export declare const setHoveredAnnotation: (id: string) => Command;
29
- export declare const createAnnotation: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, editorAPI?: ExtractInjectionAPI<AnnotationPlugin> | undefined) => (id: string, annotationType?: AnnotationTypes, supportedBlockNodes?: string[]) => Command;
30
- export declare const setInlineCommentsVisibility: (isVisible: boolean) => Command;
@@ -1,16 +0,0 @@
1
- import type { EditorAnalyticsAPI, RESOLVE_METHOD } from '@atlaskit/editor-common/analytics';
2
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
4
- import type { AnnotationPlugin } from '../annotationPluginType';
5
- import type { InlineCommentInputMethod } from '../types';
6
- declare const _default_1: {
7
- addAnnotationMark: (id: string, supportedBlockNodes?: string[]) => (transaction: Transaction, state: EditorState) => Transaction;
8
- addDeleteAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (transaction: Transaction, state: EditorState) => Transaction;
9
- addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, editorAPI: ExtractInjectionAPI<AnnotationPlugin> | undefined) => (id: string, supportedBlockNodes?: string[]) => (transaction: Transaction, state: EditorState) => Transaction;
10
- addInsertAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (transaction: Transaction, state: EditorState) => Transaction;
11
- addOpenCloseAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (drafting: boolean, method?: InlineCommentInputMethod) => (transaction: Transaction, state: EditorState) => Transaction;
12
- addPreemptiveGateErrorAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (errorReason?: string) => (transaction: Transaction, state: EditorState) => Transaction;
13
- addResolveAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (method?: RESOLVE_METHOD) => (transaction: Transaction, state: EditorState) => Transaction;
14
- handleDraftState: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (drafting: boolean, method?: InlineCommentInputMethod) => (transaction: Transaction, state: EditorState) => Transaction;
15
- };
16
- export default _default_1;
@@ -1,5 +0,0 @@
1
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { Transaction } from '@atlaskit/editor-prosemirror/state';
3
- import type { AnnotationPlugin } from '../annotationPluginType';
4
- export declare const setUserIntent: (api: ExtractInjectionAPI<AnnotationPlugin> | undefined, tr: Transaction) => Transaction | null | undefined;
5
- export declare const resetUserIntent: (api: ExtractInjectionAPI<AnnotationPlugin> | undefined, tr: Transaction) => Transaction | null | undefined;
@@ -1 +0,0 @@
1
- export { annotationPlugin } from '../annotationPlugin';
@@ -1 +0,0 @@
1
- export type { AnnotationPlugin, AnnotationPluginOptions, AnnotationPluginDependencies, } from '../annotationPluginType';
@@ -1 +0,0 @@
1
- export type { InlineCommentMap, InlineCommentPluginState, InlineCommentPluginOptions, InlineCommentAction, } from '../pm-plugins/types';
@@ -1 +0,0 @@
1
- export type { AnnotationInfo, AnnotationProviders, AnnotationState, AnnotationTypeProvider, InlineCommentAnnotationProvider, InlineCommentCreateComponentProps, InlineCommentInputMethod, InlineCommentState, InlineCommentViewComponentProps, TargetType, } from '../types/index';
@@ -1,4 +0,0 @@
1
- export { annotationPlugin } from './annotationPlugin';
2
- export type { AnnotationPlugin, AnnotationPluginOptions, AnnotationPluginDependencies, } from './annotationPluginType';
3
- export type { AnnotationInfo, AnnotationProviders, AnnotationState, AnnotationTypeProvider, InlineCommentAnnotationProvider, InlineCommentCreateComponentProps, InlineCommentInputMethod, InlineCommentState, InlineCommentViewComponentProps, TargetType, } from './types';
4
- export type { InlineCommentMap, InlineCommentPluginState, InlineCommentPluginOptions, InlineCommentAction, } from './pm-plugins/types';
@@ -1,6 +0,0 @@
1
- import type { MarkSpec } from '@atlaskit/editor-prosemirror/model';
2
- /**
3
- * Annotation mark lifted from adf-schema with modified `toDOM` to work with
4
- * existing nodeview
5
- */
6
- export declare const annotationWithToDOMFix: MarkSpec;
@@ -1,2 +0,0 @@
1
- export declare const getAnnotationViewClassname: (isUnresolved: boolean, hasFocus: boolean, isHovered: boolean) => string | undefined;
2
- export declare const getBlockAnnotationViewClassname: (isUnresolved: boolean, hasFocus: boolean) => string | undefined;
@@ -1,12 +0,0 @@
1
- import { type AnnotationId } from '@atlaskit/adf-schema';
2
- import type { ApplyDraftResult, ClearAnnotationResult, ClearDraftResult, GetDraftResult, HoverAnnotationResult, SelectAnnotationResult, StartDraftResult } from '@atlaskit/editor-common/annotation';
3
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
- import type { InlineCommentPluginOptions } from './types';
5
- export declare const allowAnnotation: (editorView: EditorView, _options: InlineCommentPluginOptions) => () => boolean;
6
- export declare const startDraft: (editorView: EditorView, options: InlineCommentPluginOptions) => () => StartDraftResult;
7
- export declare const clearDraft: (editorView: EditorView, options: InlineCommentPluginOptions) => () => ClearDraftResult;
8
- export declare const applyDraft: (editorView: EditorView, options: InlineCommentPluginOptions) => (id: AnnotationId) => ApplyDraftResult;
9
- export declare const getDraft: (editorView: EditorView, _options: InlineCommentPluginOptions) => () => GetDraftResult;
10
- export declare const setIsAnnotationSelected: (editorView: EditorView, options: InlineCommentPluginOptions) => (id: AnnotationId, isSelected: boolean) => SelectAnnotationResult;
11
- export declare const setIsAnnotationHovered: (editorView: EditorView, _options: InlineCommentPluginOptions) => (id: AnnotationId, isHovered: boolean) => HoverAnnotationResult;
12
- export declare const clearAnnotation: (editorView: EditorView, options: InlineCommentPluginOptions) => (id: AnnotationId) => ClearAnnotationResult;
@@ -1,3 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { InlineCommentPluginOptions, InlineCommentPluginState } from './types';
3
- export declare const inlineCommentPlugin: (options: InlineCommentPluginOptions) => SafePlugin<InlineCommentPluginState>;
@@ -1,4 +0,0 @@
1
- import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import type { AnnotationPlugin } from '../annotationPluginType';
4
- export declare function keymapPlugin(api: ExtractInjectionAPI<AnnotationPlugin> | undefined): SafePlugin;
@@ -1,16 +0,0 @@
1
- import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
2
- import type { Command } from '@atlaskit/editor-common/types';
3
- import { type EditorState, type ReadonlyTransaction, type SafeStateField, type SelectionBookmark, type Transaction } from '@atlaskit/editor-prosemirror/state';
4
- import type { InlineCommentPluginState, InlineCommentAction } from './types';
5
- /**
6
- * We clear bookmark on the following conditions:
7
- * 1. if current selection is an empty selection, or
8
- * 2. if the current selection and bookmark selection are different
9
- * @param tr
10
- * @param editorState
11
- * @param bookmark
12
- * @example
13
- */
14
- export declare const shouldClearBookMarkCheck: (tr: ReadonlyTransaction | Transaction, editorState: EditorState, bookmark?: SelectionBookmark) => boolean;
15
- export declare const createPluginState: (dispatch: Dispatch, initialState: InlineCommentPluginState | ((state: EditorState) => InlineCommentPluginState)) => SafeStateField<InlineCommentPluginState>;
16
- export declare const createCommand: <A = InlineCommentAction>(action: A | ((state: Readonly<EditorState>) => false | A), transform?: (tr: Transaction, state: EditorState) => Transaction) => Command;
@@ -1,3 +0,0 @@
1
- import type { InlineCommentAction, InlineCommentPluginState } from './types';
2
- declare const _default: (pluginState: InlineCommentPluginState, action: InlineCommentAction) => InlineCommentPluginState;
3
- export default _default;
@@ -1,49 +0,0 @@
1
- import type { IntlShape } from 'react-intl';
2
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
- import type { Command, ExtractInjectionAPI, FloatingToolbarButton } from '@atlaskit/editor-common/types';
4
- import type { PopupPosition } from '@atlaskit/editor-common/ui';
5
- import type { NodeType } from '@atlaskit/editor-prosemirror/model';
6
- import type { SelectionBookmark, EditorState } from '@atlaskit/editor-prosemirror/state';
7
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
8
- import type { AnnotationPlugin } from '../annotationPluginType';
9
- import { type AnnotationProviders } from '../types';
10
- interface BuildToolbarOptions {
11
- _supportedNodes?: string[];
12
- annotationManager?: AnnotationProviders['annotationManager'];
13
- api?: ExtractInjectionAPI<AnnotationPlugin>;
14
- contentType?: string;
15
- createCommentExperience?: AnnotationProviders['createCommentExperience'];
16
- getCanAddComments?: () => boolean;
17
- intl: IntlShape;
18
- isCommentOnMediaOn?: boolean;
19
- isToolbarAbove?: boolean;
20
- onCommentButtonMount?: () => void;
21
- state: EditorState;
22
- }
23
- type ShouldSuppressFloatingToolbarOptions = {
24
- bookmark?: SelectionBookmark;
25
- state: EditorState;
26
- };
27
- /**
28
- * Should suppress toolbars when the user is creating an inline comment
29
- * This only applies when the selection range exactly matches the bookmark range
30
- * which should be the case immediately after the comment button is clicked
31
- * if the user creates a different selection range, the floating toolbar should still be shown
32
- * @param root0
33
- * @param root0.state
34
- * @param root0.bookmark
35
- * @example
36
- */
37
- export declare const shouldSuppressFloatingToolbar: ({ state, bookmark, }: ShouldSuppressFloatingToolbarOptions) => boolean;
38
- export declare const buildSuppressedToolbar: (state: EditorState) => {
39
- items: never[];
40
- nodeType: NodeType[];
41
- title: string;
42
- };
43
- export declare const buildToolbar: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ state, intl, isToolbarAbove, _supportedNodes, api, createCommentExperience, annotationManager, onCommentButtonMount, getCanAddComments, contentType, }: BuildToolbarOptions) => {
44
- items: FloatingToolbarButton<Command>[];
45
- nodeType: NodeType[];
46
- onPositionCalculated: (editorView: EditorView, nextPos: PopupPosition) => PopupPosition;
47
- title: string;
48
- } | undefined;
49
- export {};
@@ -1,174 +0,0 @@
1
- import type { EditorAnalyticsAPI, VIEW_METHOD } from '@atlaskit/editor-common/analytics';
2
- import type { AnnotationManager } from '@atlaskit/editor-common/annotation';
3
- import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
4
- import type { FeatureFlags } from '@atlaskit/editor-common/types';
5
- import type { EditorState, SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
6
- import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
7
- import type { AnnotationPluginInjectionAPI } from '../annotationPluginType';
8
- import type { AnnotationInfo, AnnotationProviders, InlineCommentAnnotationProvider, TargetType } from '../types';
9
- export declare enum ACTIONS {
10
- UPDATE_INLINE_COMMENT_STATE = 0,
11
- SET_INLINE_COMMENT_DRAFT_STATE = 1,
12
- INLINE_COMMENT_UPDATE_MOUSE_STATE = 2,
13
- INLINE_COMMENT_CLEAR_DIRTY_MARK = 3,
14
- ADD_INLINE_COMMENT = 4,
15
- INLINE_COMMENT_SET_VISIBLE = 5,
16
- CLOSE_COMPONENT = 6,
17
- SET_SELECTED_ANNOTATION = 7,
18
- SET_HOVERED_ANNOTATION = 8,
19
- FLUSH_PENDING_SELECTIONS = 9,
20
- SET_PENDING_SELECTIONS = 10,
21
- SET_INLINE_COMMENTS_FETCHED = 11
22
- }
23
- export interface InlineCommentPluginOptions {
24
- annotationManager?: AnnotationManager;
25
- api?: AnnotationPluginInjectionAPI;
26
- dispatch: Dispatch;
27
- editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
28
- featureFlagsPluginState?: FeatureFlags;
29
- provider: InlineCommentAnnotationProvider;
30
- selectCommentExperience?: AnnotationProviders['selectCommentExperience'];
31
- viewInlineCommentTraceUFOPress?: AnnotationProviders['viewInlineCommentTraceUFOPress'];
32
- }
33
- export interface InlineCommentMouseData {
34
- isSelecting: boolean;
35
- }
36
- export type InlineCommentMap = {
37
- [key: string]: boolean;
38
- };
39
- export type InlineCommentAction = {
40
- data: InlineCommentMap;
41
- type: ACTIONS.UPDATE_INLINE_COMMENT_STATE;
42
- } | {
43
- data: {
44
- drafting: boolean;
45
- editorState: EditorState;
46
- isOpeningMediaCommentFromToolbar?: boolean;
47
- supportedBlockNodes?: string[];
48
- targetNodeId?: string;
49
- targetType?: TargetType;
50
- };
51
- type: ACTIONS.SET_INLINE_COMMENT_DRAFT_STATE;
52
- } | {
53
- data: {
54
- mouseData: InlineCommentMouseData;
55
- };
56
- type: ACTIONS.INLINE_COMMENT_UPDATE_MOUSE_STATE;
57
- } | {
58
- type: ACTIONS.INLINE_COMMENT_CLEAR_DIRTY_MARK;
59
- } | {
60
- type: ACTIONS.CLOSE_COMPONENT;
61
- } | {
62
- data: {
63
- drafting: boolean;
64
- editorState: EditorState;
65
- inlineComments: InlineCommentMap;
66
- selectedAnnotations: AnnotationInfo[];
67
- };
68
- type: ACTIONS.ADD_INLINE_COMMENT;
69
- } | {
70
- data: {
71
- isVisible: boolean;
72
- };
73
- type: ACTIONS.INLINE_COMMENT_SET_VISIBLE;
74
- } | {
75
- data: {
76
- isOpeningMediaCommentFromToolbar?: boolean;
77
- selectAnnotationMethod?: VIEW_METHOD;
78
- selectedAnnotations: AnnotationInfo[];
79
- };
80
- type: ACTIONS.SET_SELECTED_ANNOTATION;
81
- } | {
82
- data: {
83
- hoveredAnnotations: AnnotationInfo[];
84
- selectAnnotationMethod?: VIEW_METHOD;
85
- };
86
- type: ACTIONS.SET_HOVERED_ANNOTATION;
87
- } | {
88
- data: {
89
- canSetAsSelectedAnnotations: boolean;
90
- };
91
- type: ACTIONS.FLUSH_PENDING_SELECTIONS;
92
- } | {
93
- data: {
94
- selectedAnnotations: AnnotationInfo[];
95
- };
96
- type: ACTIONS.SET_PENDING_SELECTIONS;
97
- } | {
98
- type: ACTIONS.SET_INLINE_COMMENTS_FETCHED;
99
- };
100
- export type InlineCommentPluginState = {
101
- annotationsLoaded: boolean;
102
- /**
103
- * The resolved state of the annotations.
104
- *
105
- * The keys are the annotation ids, and the values are booleans indicating whether the annotation is resolved or not.
106
- *
107
- * The annotation is only considered unresolved if the value is false. An undefined value is treated as resolved.
108
- * This is because the editor does not know yet the resolved state of the annotation, and so it is treated as resolved until
109
- * the editor receives the resolved state from the server. (see dirtyAnnotations for more details)
110
- *
111
- * Example value
112
- * ```
113
- * {
114
- * // resolved comments
115
- * 'annotation-id': true,
116
- * 'annotation-id-3': undefined,
117
- * // unresolved comment
118
- * 'annotation-id-2': false,
119
- * }
120
- * ```
121
- */
122
- annotations: InlineCommentMap;
123
- bookmark?: SelectionBookmark;
124
- /**
125
- * Indicates the document has annotations which it does not currently know the resolved state of.
126
- * This can happen when the annotations are loaded via ncs, and the editor has not received the
127
- * resolved state of the annotations yet (as the resolved state comes from a separate service).
128
- */
129
- dirtyAnnotations?: boolean;
130
- disallowOnWhitespace: boolean;
131
- draftDecorationSet?: DecorationSet;
132
- featureFlagsPluginState?: FeatureFlags;
133
- /**
134
- * Warning: This is not the state of annotations which are currently being hovered over,
135
- * but rather the annotations which have been given a selected like visual state from an
136
- * editor api.
137
- * The Comment consumer does this when browsing comments in the sidebar, where it sets
138
- * a "hovered" state on the annotation, while the comment is hovered in the sidebar.
139
- */
140
- hoveredAnnotations?: AnnotationInfo[];
141
- /**
142
- * A simple toggle to indicate if the annotation manager is enabled.
143
- */
144
- isAnnotationManagerEnabled: boolean;
145
- isDrafting: boolean;
146
- isInlineCommentViewClosed: boolean;
147
- isOpeningMediaCommentFromToolbar?: boolean;
148
- isVisible: boolean;
149
- mouseData: InlineCommentMouseData;
150
- /**
151
- * This is a list of annotations which are to be selected. This is updated all the time when the selection changes, and
152
- * are periodically flushed to selectedAnnotations. This flush event results in the annotations being selected in the editor.
153
- * This functionality has come about due to the fact that the editor can select annotations in 3 different ways. And the fact
154
- * that we need to introduce a preemptive gate check which is async and can block annotations from being selected before they're
155
- * selected.
156
- */
157
- pendingSelectedAnnotations: AnnotationInfo[];
158
- /**
159
- * This is a count of the number of times the pendingSelectedAnnotations has been updated. This can be used to determine
160
- * if the pendingSelectedAnnotations has been updated since the last time it was flushed to selectedAnnotations.
161
- */
162
- pendingSelectedAnnotationsUpdateCount: number;
163
- selectAnnotationMethod?: VIEW_METHOD;
164
- selectCommentExperience?: AnnotationProviders['selectCommentExperience'];
165
- /**
166
- * A list of the annotations at the current selection.
167
- *
168
- * While this is a list, consumers only make use of the first element, and from the
169
- * user perspective, there is only one annotation selected at a time.
170
- */
171
- selectedAnnotations: AnnotationInfo[];
172
- skipSelectionHandling: boolean;
173
- targetNodeId?: string;
174
- };
@@ -1,53 +0,0 @@
1
- import type { AnalyticsEventPayloadCallback } from '@atlaskit/editor-common/analytics';
2
- import type { Mark, Node, ResolvedPos, Schema, Slice } from '@atlaskit/editor-prosemirror/model';
3
- import type { EditorState, Selection, SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
4
- import { AllSelection, NodeSelection, PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
5
- import { Decoration } from '@atlaskit/editor-prosemirror/view';
6
- import type { AnnotationInfo, DraftBookmark, InlineCommentInputMethod, TargetType } from '../types';
7
- import { AnnotationSelectionType } from '../types';
8
- import type { InlineCommentPluginState } from './types';
9
- /**
10
- * Finds the marks in the nodes to the left and right.
11
- * @param $pos Position to center search around
12
- */
13
- export declare const surroundingMarks: ($pos: ResolvedPos) => (readonly Mark[])[];
14
- export declare const getAllAnnotations: (doc: Node) => string[];
15
- export declare const decorationKey: {
16
- block: string;
17
- inline: string;
18
- };
19
- export declare const addDraftDecoration: (start: number, end: number, targetType?: TargetType) => Decoration;
20
- export declare const getAnnotationViewKey: (annotations: AnnotationInfo[]) => string;
21
- export declare const findAnnotationsInSelection: (selection: Selection, doc: Node) => AnnotationInfo[];
22
- export declare const resolveDraftBookmark: (editorState: EditorState, bookmark?: SelectionBookmark, supportedBlockNodes?: string[]) => DraftBookmark;
23
- /**
24
- * get selection from position to apply new comment for
25
- * @returns bookmarked positions if they exists, otherwise current selection positions
26
- */
27
- export declare function getSelectionPositions(editorState: EditorState, bookmark: SelectionBookmark | undefined): Selection;
28
- export declare const inlineCommentPluginKey: PluginKey<InlineCommentPluginState>;
29
- export declare const getPluginState: (state: EditorState) => InlineCommentPluginState | undefined;
30
- /**
31
- * get payload for the open/close analytics event
32
- */
33
- export declare const getDraftCommandAnalyticsPayload: (drafting: boolean, inputMethod: InlineCommentInputMethod) => AnalyticsEventPayloadCallback;
34
- export declare const isSelectionValid: (state: EditorState, _supportedNodes?: string[]) => AnnotationSelectionType;
35
- export declare const hasInvalidNodes: (state: EditorState) => boolean;
36
- export declare const isSupportedBlockNode: (node: Node, supportedBlockNodes?: string[]) => boolean;
37
- /**
38
- * Checks if any of the nodes in a given selection are completely whitespace
39
- * This is to conform to Confluence annotation specifications
40
- */
41
- export declare function hasInvalidWhitespaceNode(selection: TextSelection | AllSelection | NodeSelection, schema: Schema): boolean;
42
- export declare function annotationExists(annotationId: string, state: EditorState): boolean;
43
- export declare function stripNonExistingAnnotations(slice: Slice, state: EditorState): false | undefined;
44
- /**
45
- * Compares two sets of annotationInfos to see if the annotations have changed
46
- * This function assumes annotations will have unique id's for simplicity
47
- */
48
- export declare function isSelectedAnnotationsChanged(oldSelectedAnnotations: AnnotationInfo[], newSelectedAnnotations: AnnotationInfo[]): boolean;
49
- /**
50
- * Checks if the selectedAnnotations are the same as the annotations on the selected block node
51
- */
52
- export declare const isBlockNodeAnnotationsSelected: (selection: Selection, selectedAnnotations?: AnnotationInfo[]) => boolean;
53
- export declare const hasAnyUnResolvedAnnotationInPage: (state: EditorState) => boolean;
@@ -1,169 +0,0 @@
1
- import type React from 'react';
2
- import type { AnnotationTypes } from '@atlaskit/adf-schema';
3
- import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
- import type { AnnotationUpdateEmitter, AnnotationManager } from '@atlaskit/editor-common/annotation';
5
- /**
6
- * type of target that annotation apply to.
7
- * This is used to apply correct decoration to a draft comment
8
- */
9
- export type TargetType = 'block' | 'inline';
10
- /**
11
- * The source of draft comment being created
12
- */
13
- export type InlineCommentInputMethod = INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT | INPUT_METHOD.FLOATING_TB;
14
- export type AnnotationInfo = {
15
- id: string;
16
- type: AnnotationTypes.INLINE_COMMENT;
17
- };
18
- type AnnotationComponentProps = {
19
- /**
20
- * DOM element around selected text (for positioning)
21
- */
22
- dom?: HTMLElement;
23
- /**
24
- * Indicates whether the comment UI is offline and should be disabled
25
- */
26
- isOffline?: boolean;
27
- /**
28
- * Indicates that a draft comment was discarded/cancelled
29
- */
30
- onClose?: () => void;
31
- /**
32
- * Selected text (can be used when creating a comment)
33
- */
34
- textSelection?: string;
35
- };
36
- export type InlineCommentCreateComponentProps = AnnotationComponentProps & {
37
- /** List of inline node types, which are wrapped by the annotation. */
38
- inlineNodeTypes: string[] | undefined;
39
- /**
40
- * Indicates whether we're opening the media comment box from the media toolbar so we can scroll the media into view
41
- */
42
- isOpeningMediaCommentFromToolbar?: boolean;
43
- /**
44
- * Creates an annotation mark in the document with the given id.
45
- */
46
- onCreate: (id: string) => void;
47
- /**
48
- * Deletes an annotation mark in the document with the given id.
49
- */
50
- onCreateError?: (id: string) => void;
51
- };
52
- export type InlineCommentViewComponentProps = AnnotationComponentProps & {
53
- /**
54
- * Existing annotations where the cursor is placed.
55
- * These are provided in order, inner-most first.
56
- */
57
- annotations: Array<AnnotationInfo>;
58
- /**
59
- * Ordered list of annotation ids as shown in the document
60
- */
61
- annotationsList?: string[];
62
- /**
63
- * Return a list of inline node types, which are wrapped by the annotation,
64
- * for annotation with given ID.
65
- *
66
- * The `undefined` will be returned if `editor_inline_comments_on_inline_nodes` is off.
67
- *
68
- * @todo: Do not forget to remove `undefined` when the
69
- * `editor_inline_comments_on_inline_nodes` is removed.
70
- */
71
- getInlineNodeTypes: (annotationId: string) => string[] | undefined;
72
- /**
73
- * Indicates whether we're opening the media comment box from the media toolbar so we can scroll the media into view
74
- */
75
- isOpeningMediaCommentFromToolbar?: boolean;
76
- /**
77
- * Removes the annotation from the document
78
- */
79
- onDelete?: (id: string) => void;
80
- /**
81
- * Resolves an annotation with the given ID around the selection.
82
- */
83
- onResolve: (id: string) => void;
84
- };
85
- export interface AnnotationState<Type, State> {
86
- annotationType: Type;
87
- id: string;
88
- state: State;
89
- }
90
- export interface AnnotationTypeProvider<Type, State> {
91
- disallowOnWhitespace?: boolean;
92
- getState: (annotationIds: string[]) => Promise<AnnotationState<Type, State>[]>;
93
- updateSubscriber?: AnnotationUpdateEmitter;
94
- }
95
- export type InlineCommentState = {
96
- resolved: boolean;
97
- };
98
- export type InlineCommentAnnotationProvider = AnnotationTypeProvider<AnnotationTypes.INLINE_COMMENT, InlineCommentState> & {
99
- contentType?: string;
100
- createComponent?: React.ComponentType<React.PropsWithChildren<InlineCommentCreateComponentProps>>;
101
- getCanAddComments?: () => boolean;
102
- isToolbarAbove?: boolean;
103
- onCommentButtonMount?: () => void;
104
- /**
105
- * @experimental Still under development. Do not use.
106
- *
107
- * A list of supported editor node names for inline comment,
108
- * Note 1: value is the type name of the node, e.g. media, mediaInline
109
- * Invalid node names, nodes does not support annotation
110
- * or nodes not supported by current ADF schema will be ignored.
111
- * Note 2: text is supported by default.
112
- */
113
- supportedBlockNodes?: string[];
114
- viewComponent?: React.ComponentType<React.PropsWithChildren<InlineCommentViewComponentProps>>;
115
- };
116
- export interface AnnotationProviders {
117
- annotationManager?: AnnotationManager;
118
- createCommentExperience?: {
119
- initExperience: {
120
- start: () => void;
121
- };
122
- start: (_: {
123
- attributes: {
124
- annotationId?: undefined;
125
- commentType: 'inline';
126
- entryPoint?: 'highlightActions';
127
- pageClass: 'editor';
128
- } | {
129
- annotationId?: undefined;
130
- blockType: 'media';
131
- commentType: 'block';
132
- entryPoint?: 'highlightActions';
133
- pageClass: 'editor';
134
- };
135
- }) => void;
136
- };
137
- inlineComment: InlineCommentAnnotationProvider;
138
- selectCommentExperience?: {
139
- selectAnnotation: {
140
- complete: (annotationId: string) => void;
141
- };
142
- };
143
- viewInlineCommentTraceUFOPress?: () => void;
144
- }
145
- export declare enum AnnotationSelectionType {
146
- INVALID = "invalid",// Annotation should not be created, toolbar should not be shown
147
- DISABLED = "disabled",// Annotation should not be created, toolbar should be shown, but disabled
148
- VALID = "valid"
149
- }
150
- export declare const AnnotationTestIds: {
151
- componentClose: string;
152
- componentSave: string;
153
- floatingComponent: string;
154
- floatingToolbarCreateButton: string;
155
- prefix: string;
156
- };
157
- export type CoordsAtPos = {
158
- bottom: number;
159
- left: number;
160
- right: number;
161
- top: number;
162
- };
163
- export type DraftBookmark = {
164
- from: number;
165
- head: number;
166
- isBlockNode?: boolean;
167
- to: number;
168
- };
169
- export {};
@@ -1,11 +0,0 @@
1
- import React from 'react';
2
- type AnnotationViewWrapperProps = {
3
- annotationText?: string;
4
- children: React.ReactNode;
5
- onViewed?: () => void;
6
- };
7
- export declare class AnnotationViewWrapper extends React.PureComponent<AnnotationViewWrapperProps> {
8
- componentDidMount(): void;
9
- render(): React.ReactNode;
10
- }
11
- export {};
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
- import type { AnnotationPlugin } from '../../annotationPluginType';
4
- import { type AnnotationProviders } from '../../types';
5
- type CommentButtonProps = {
6
- annotationProviders?: AnnotationProviders;
7
- api?: ExtractInjectionAPI<AnnotationPlugin>;
8
- };
9
- export declare const CommentButton: ({ api, annotationProviders, }: CommentButtonProps) => React.JSX.Element | null;
10
- export {};
@@ -1,12 +0,0 @@
1
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { EditorState, SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
3
- import type { AnnotationPlugin } from '../../annotationPluginType';
4
- import type { AnnotationSelectionType } from '../../types';
5
- import type { AnnotationProviders } from '../../types';
6
- export declare const useCommentButtonMount: ({ state, annotationProviders, api, annotationSelectionType, bookmark, }: {
7
- annotationProviders?: AnnotationProviders;
8
- annotationSelectionType: AnnotationSelectionType;
9
- api?: ExtractInjectionAPI<AnnotationPlugin>;
10
- bookmark?: SelectionBookmark;
11
- state: EditorState | null | undefined;
12
- }) => void;
@@ -1,34 +0,0 @@
1
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
- import type { AnnotationPlugin } from '../../annotationPluginType';
5
- import { AnnotationSelectionType, type AnnotationProviders } from '../../types';
6
- export declare const isButtonDisabled: ({ state, api, canAddComments, }: {
7
- api?: ExtractInjectionAPI<AnnotationPlugin>;
8
- canAddComments: boolean;
9
- state: EditorState | null | undefined;
10
- }) => {
11
- canAddComments: boolean;
12
- isAnnotationSelectionInvalid: boolean;
13
- isDisabled: boolean;
14
- isOffline: boolean;
15
- };
16
- export declare const shouldShowCommentButton: ({ state, isVisible, annotationSelectionType, }: {
17
- annotationSelectionType: AnnotationSelectionType;
18
- isVisible?: boolean;
19
- state: EditorState | null | undefined;
20
- }) => boolean;
21
- export declare const fireOnClickAnalyticsEvent: ({ api, }: {
22
- api: ExtractInjectionAPI<AnnotationPlugin>;
23
- }) => void;
24
- export declare const fireCommentButtonViewedAnalyticsEvent: ({ api, isNonTextInlineNodeInludedInComment, annotationSelectionType, }: {
25
- annotationSelectionType: AnnotationSelectionType;
26
- api?: ExtractInjectionAPI<AnnotationPlugin>;
27
- isNonTextInlineNodeInludedInComment: boolean;
28
- }) => void;
29
- export declare const startCommentExperience: ({ annotationProviders, api, state, dispatch, }: {
30
- annotationProviders: AnnotationProviders;
31
- api: ExtractInjectionAPI<AnnotationPlugin>;
32
- dispatch: EditorView["dispatch"];
33
- state: EditorState;
34
- }) => boolean;
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- import type { DispatchAnalyticsEvent, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
4
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
- import type { AnnotationPlugin } from '../annotationPluginType';
6
- import { type AnnotationProviders } from '../types';
7
- interface InlineCommentViewProps {
8
- dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
9
- editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
10
- editorAPI: ExtractInjectionAPI<AnnotationPlugin> | undefined;
11
- editorView: EditorView;
12
- providers: AnnotationProviders;
13
- }
14
- export declare function InlineCommentView({ providers, editorView, editorAnalyticsAPI, editorAPI, dispatchAnalyticsEvent, }: InlineCommentViewProps): React.JSX.Element | null;
15
- export {};
@@ -1,5 +0,0 @@
1
- import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { RegisterComponent } from '@atlaskit/editor-toolbar-model';
3
- import type { AnnotationPlugin } from '../annotationPluginType';
4
- import type { AnnotationProviders } from '../types';
5
- export declare const getToolbarComponents: (api?: ExtractInjectionAPI<AnnotationPlugin>, annotationProviders?: AnnotationProviders) => RegisterComponent[];