@atlaskit/editor-core 190.1.19 → 190.1.23

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 (123) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/afm-cc/tsconfig.json +3 -0
  3. package/dist/cjs/create-editor/ErrorBoundary.js +9 -5
  4. package/dist/cjs/index.js +1 -1
  5. package/dist/cjs/plugins/index.js +0 -7
  6. package/dist/cjs/plugins/paste/pm-plugins/main.js +14 -10
  7. package/dist/cjs/presets/default.js +2 -2
  8. package/dist/cjs/presets/universal.js +2 -1
  9. package/dist/cjs/utils/index.js +12 -18
  10. package/dist/cjs/utils/performance/measure-enum.js +1 -2
  11. package/dist/cjs/version-wrapper.js +1 -1
  12. package/dist/es2019/create-editor/ErrorBoundary.js +10 -7
  13. package/dist/es2019/index.js +14 -1
  14. package/dist/es2019/plugins/index.js +0 -1
  15. package/dist/es2019/plugins/paste/pm-plugins/main.js +11 -5
  16. package/dist/es2019/presets/default.js +1 -1
  17. package/dist/es2019/presets/universal.js +2 -1
  18. package/dist/es2019/utils/index.js +0 -7
  19. package/dist/es2019/utils/performance/measure-enum.js +1 -2
  20. package/dist/es2019/version-wrapper.js +1 -1
  21. package/dist/esm/create-editor/ErrorBoundary.js +10 -7
  22. package/dist/esm/index.js +14 -1
  23. package/dist/esm/plugins/index.js +0 -1
  24. package/dist/esm/plugins/paste/pm-plugins/main.js +9 -5
  25. package/dist/esm/presets/default.js +1 -1
  26. package/dist/esm/presets/universal.js +2 -1
  27. package/dist/esm/utils/index.js +0 -5
  28. package/dist/esm/utils/performance/measure-enum.js +1 -2
  29. package/dist/esm/version-wrapper.js +1 -1
  30. package/dist/types/index.d.ts +15 -2
  31. package/dist/types/plugins/index.d.ts +0 -1
  32. package/dist/types/plugins/paste/pm-plugins/main.d.ts +2 -0
  33. package/dist/types/presets/default.d.ts +1 -1
  34. package/dist/types/types/editor-props.d.ts +1 -1
  35. package/dist/types/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
  36. package/dist/types/ui/ContentStyles/index.d.ts +2 -2
  37. package/dist/types/utils/index.d.ts +0 -1
  38. package/dist/types/utils/performance/measure-enum.d.ts +0 -1
  39. package/dist/types-ts4.5/index.d.ts +15 -2
  40. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  41. package/dist/types-ts4.5/plugins/paste/pm-plugins/main.d.ts +2 -0
  42. package/dist/types-ts4.5/presets/default.d.ts +1 -1
  43. package/dist/types-ts4.5/types/editor-props.d.ts +1 -1
  44. package/dist/types-ts4.5/ui/Appearance/FullPage/StyledComponents.d.ts +2 -2
  45. package/dist/types-ts4.5/ui/ContentStyles/index.d.ts +2 -2
  46. package/dist/types-ts4.5/utils/index.d.ts +0 -1
  47. package/dist/types-ts4.5/utils/performance/measure-enum.d.ts +0 -1
  48. package/package.json +10 -4
  49. package/dist/cjs/plugins/annotation/commands/index.js +0 -150
  50. package/dist/cjs/plugins/annotation/commands/transform.js +0 -86
  51. package/dist/cjs/plugins/annotation/index.js +0 -130
  52. package/dist/cjs/plugins/annotation/nodeviews/index.js +0 -59
  53. package/dist/cjs/plugins/annotation/pm-plugins/inline-comment.js +0 -243
  54. package/dist/cjs/plugins/annotation/pm-plugins/keymap.js +0 -15
  55. package/dist/cjs/plugins/annotation/pm-plugins/plugin-factory.js +0 -107
  56. package/dist/cjs/plugins/annotation/pm-plugins/reducer.js +0 -84
  57. package/dist/cjs/plugins/annotation/pm-plugins/types.js +0 -17
  58. package/dist/cjs/plugins/annotation/toolbar.js +0 -59
  59. package/dist/cjs/plugins/annotation/types.js +0 -20
  60. package/dist/cjs/plugins/annotation/ui/AnnotationViewWrapper.js +0 -38
  61. package/dist/cjs/plugins/annotation/ui/InlineCommentView.js +0 -149
  62. package/dist/cjs/plugins/annotation/update-provider.js +0 -36
  63. package/dist/cjs/plugins/annotation/utils.js +0 -372
  64. package/dist/es2019/plugins/annotation/commands/index.js +0 -123
  65. package/dist/es2019/plugins/annotation/commands/transform.js +0 -64
  66. package/dist/es2019/plugins/annotation/index.js +0 -125
  67. package/dist/es2019/plugins/annotation/nodeviews/index.js +0 -31
  68. package/dist/es2019/plugins/annotation/pm-plugins/inline-comment.js +0 -178
  69. package/dist/es2019/plugins/annotation/pm-plugins/keymap.js +0 -9
  70. package/dist/es2019/plugins/annotation/pm-plugins/plugin-factory.js +0 -108
  71. package/dist/es2019/plugins/annotation/pm-plugins/reducer.js +0 -94
  72. package/dist/es2019/plugins/annotation/pm-plugins/types.js +0 -11
  73. package/dist/es2019/plugins/annotation/toolbar.js +0 -53
  74. package/dist/es2019/plugins/annotation/types.js +0 -14
  75. package/dist/es2019/plugins/annotation/ui/AnnotationViewWrapper.js +0 -14
  76. package/dist/es2019/plugins/annotation/ui/InlineCommentView.js +0 -147
  77. package/dist/es2019/plugins/annotation/update-provider.js +0 -9
  78. package/dist/es2019/plugins/annotation/utils.js +0 -334
  79. package/dist/esm/plugins/annotation/commands/index.js +0 -143
  80. package/dist/esm/plugins/annotation/commands/transform.js +0 -80
  81. package/dist/esm/plugins/annotation/index.js +0 -118
  82. package/dist/esm/plugins/annotation/nodeviews/index.js +0 -52
  83. package/dist/esm/plugins/annotation/pm-plugins/inline-comment.js +0 -236
  84. package/dist/esm/plugins/annotation/pm-plugins/keymap.js +0 -9
  85. package/dist/esm/plugins/annotation/pm-plugins/plugin-factory.js +0 -101
  86. package/dist/esm/plugins/annotation/pm-plugins/reducer.js +0 -77
  87. package/dist/esm/plugins/annotation/pm-plugins/types.js +0 -11
  88. package/dist/esm/plugins/annotation/toolbar.js +0 -52
  89. package/dist/esm/plugins/annotation/types.js +0 -14
  90. package/dist/esm/plugins/annotation/ui/AnnotationViewWrapper.js +0 -31
  91. package/dist/esm/plugins/annotation/ui/InlineCommentView.js +0 -144
  92. package/dist/esm/plugins/annotation/update-provider.js +0 -29
  93. package/dist/esm/plugins/annotation/utils.js +0 -345
  94. package/dist/types/plugins/annotation/commands/index.d.ts +0 -15
  95. package/dist/types/plugins/annotation/commands/transform.d.ts +0 -11
  96. package/dist/types/plugins/annotation/index.d.ts +0 -15
  97. package/dist/types/plugins/annotation/nodeviews/index.d.ts +0 -11
  98. package/dist/types/plugins/annotation/pm-plugins/inline-comment.d.ts +0 -3
  99. package/dist/types/plugins/annotation/pm-plugins/keymap.d.ts +0 -3
  100. package/dist/types/plugins/annotation/pm-plugins/plugin-factory.d.ts +0 -2
  101. package/dist/types/plugins/annotation/pm-plugins/reducer.d.ts +0 -3
  102. package/dist/types/plugins/annotation/pm-plugins/types.d.ts +0 -78
  103. package/dist/types/plugins/annotation/toolbar.d.ts +0 -5
  104. package/dist/types/plugins/annotation/types.d.ts +0 -86
  105. package/dist/types/plugins/annotation/ui/AnnotationViewWrapper.d.ts +0 -10
  106. package/dist/types/plugins/annotation/ui/InlineCommentView.d.ts +0 -13
  107. package/dist/types/plugins/annotation/update-provider.d.ts +0 -12
  108. package/dist/types/plugins/annotation/utils.d.ts +0 -45
  109. package/dist/types-ts4.5/plugins/annotation/commands/index.d.ts +0 -15
  110. package/dist/types-ts4.5/plugins/annotation/commands/transform.d.ts +0 -11
  111. package/dist/types-ts4.5/plugins/annotation/index.d.ts +0 -17
  112. package/dist/types-ts4.5/plugins/annotation/nodeviews/index.d.ts +0 -11
  113. package/dist/types-ts4.5/plugins/annotation/pm-plugins/inline-comment.d.ts +0 -3
  114. package/dist/types-ts4.5/plugins/annotation/pm-plugins/keymap.d.ts +0 -3
  115. package/dist/types-ts4.5/plugins/annotation/pm-plugins/plugin-factory.d.ts +0 -2
  116. package/dist/types-ts4.5/plugins/annotation/pm-plugins/reducer.d.ts +0 -3
  117. package/dist/types-ts4.5/plugins/annotation/pm-plugins/types.d.ts +0 -78
  118. package/dist/types-ts4.5/plugins/annotation/toolbar.d.ts +0 -5
  119. package/dist/types-ts4.5/plugins/annotation/types.d.ts +0 -86
  120. package/dist/types-ts4.5/plugins/annotation/ui/AnnotationViewWrapper.d.ts +0 -10
  121. package/dist/types-ts4.5/plugins/annotation/ui/InlineCommentView.d.ts +0 -13
  122. package/dist/types-ts4.5/plugins/annotation/update-provider.d.ts +0 -12
  123. package/dist/types-ts4.5/plugins/annotation/utils.d.ts +0 -45
@@ -1,11 +0,0 @@
1
- /// <reference types="react" />
2
- import { ForwardRef } from '../../../nodeviews';
3
- import ReactNodeView from '@atlaskit/editor-common/react-node-view';
4
- export declare class AnnotationNodeView extends ReactNodeView {
5
- createDomRef(): HTMLSpanElement;
6
- getContentDOM(): {
7
- dom: HTMLSpanElement;
8
- };
9
- render(_props: {}, forwardRef: ForwardRef): JSX.Element;
10
- }
11
- export declare const getAnnotationViewClassname: (isUnresolved: boolean, hasFocus: boolean) => string | undefined;
@@ -1,3 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { InlineCommentPluginState, InlineCommentPluginOptions } from './types';
3
- export declare const inlineCommentPlugin: (options: InlineCommentPluginOptions) => SafePlugin<InlineCommentPluginState>;
@@ -1,3 +0,0 @@
1
- import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
- export declare function keymapPlugin(editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin;
@@ -1,2 +0,0 @@
1
- import type { InlineCommentPluginState } from './types';
2
- export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch<any>, initialState: InlineCommentPluginState | ((state: import("prosemirror-state").EditorState) => InlineCommentPluginState)) => import("prosemirror-state").SafeStateField<InlineCommentPluginState>, createCommand: <A = import("./types").InlineCommentAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").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,78 +0,0 @@
1
- import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
2
- import type { EditorState, SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
3
- import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
4
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
5
- import type { Dispatch, EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
6
- import type { InlineCommentAnnotationProvider, AnnotationInfo } from '../types';
7
- export declare enum ACTIONS {
8
- UPDATE_INLINE_COMMENT_STATE = 0,
9
- SET_INLINE_COMMENT_DRAFT_STATE = 1,
10
- INLINE_COMMENT_UPDATE_MOUSE_STATE = 2,
11
- INLINE_COMMENT_CLEAR_DIRTY_MARK = 3,
12
- ADD_INLINE_COMMENT = 4,
13
- INLINE_COMMENT_SET_VISIBLE = 5,
14
- CLOSE_COMPONENT = 6,
15
- SET_SELECTED_ANNOTATION = 7
16
- }
17
- export interface InlineCommentPluginOptions {
18
- dispatch: Dispatch;
19
- eventDispatcher: EventDispatcher;
20
- portalProviderAPI: PortalProviderAPI;
21
- provider: InlineCommentAnnotationProvider;
22
- editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
23
- }
24
- export interface InlineCommentMouseData {
25
- isSelecting: boolean;
26
- }
27
- export type InlineCommentMap = {
28
- [key: string]: boolean;
29
- };
30
- export type InlineCommentAction = {
31
- type: ACTIONS.UPDATE_INLINE_COMMENT_STATE;
32
- data: InlineCommentMap;
33
- } | {
34
- type: ACTIONS.SET_INLINE_COMMENT_DRAFT_STATE;
35
- data: {
36
- drafting: boolean;
37
- editorState: EditorState;
38
- };
39
- } | {
40
- type: ACTIONS.INLINE_COMMENT_UPDATE_MOUSE_STATE;
41
- data: {
42
- mouseData: InlineCommentMouseData;
43
- };
44
- } | {
45
- type: ACTIONS.INLINE_COMMENT_CLEAR_DIRTY_MARK;
46
- } | {
47
- type: ACTIONS.CLOSE_COMPONENT;
48
- } | {
49
- type: ACTIONS.ADD_INLINE_COMMENT;
50
- data: {
51
- drafting: boolean;
52
- inlineComments: InlineCommentMap;
53
- editorState: EditorState;
54
- selectedAnnotations: AnnotationInfo[];
55
- };
56
- } | {
57
- type: ACTIONS.INLINE_COMMENT_SET_VISIBLE;
58
- data: {
59
- isVisible: boolean;
60
- };
61
- } | {
62
- type: ACTIONS.SET_SELECTED_ANNOTATION;
63
- data: {
64
- selectedAnnotations: AnnotationInfo[];
65
- };
66
- };
67
- export type InlineCommentPluginState = {
68
- annotations: InlineCommentMap;
69
- selectedAnnotations: AnnotationInfo[];
70
- dirtyAnnotations?: boolean;
71
- mouseData: InlineCommentMouseData;
72
- draftDecorationSet?: DecorationSet;
73
- bookmark?: SelectionBookmark;
74
- disallowOnWhitespace: boolean;
75
- isInlineCommentViewClosed: boolean;
76
- isVisible: boolean;
77
- skipSelectionHandling: boolean;
78
- };
@@ -1,5 +0,0 @@
1
- import type { IntlShape } from 'react-intl-next';
2
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
- import type { FloatingToolbarConfig } from '@atlaskit/editor-common/types';
4
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
5
- export declare const buildToolbar: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (state: EditorState, intl: IntlShape, isToolbarAbove?: boolean) => FloatingToolbarConfig | undefined;
@@ -1,86 +0,0 @@
1
- import type React from 'react';
2
- import type { AnnotationTypes } from '@atlaskit/adf-schema';
3
- import type { AnnotationUpdateEmitter } from './update-provider';
4
- export type AnnotationInfo = {
5
- id: string;
6
- type: AnnotationTypes.INLINE_COMMENT;
7
- };
8
- type AnnotationComponentProps = {
9
- /**
10
- * Selected text (can be used when creating a comment)
11
- */
12
- textSelection?: string;
13
- /**
14
- * DOM element around selected text (for positioning)
15
- */
16
- dom?: HTMLElement;
17
- /**
18
- * Indicates that a draft comment was discarded/cancelled
19
- */
20
- onClose?: () => void;
21
- };
22
- export type InlineCommentCreateComponentProps = AnnotationComponentProps & {
23
- /**
24
- * Creates an annotation mark in the document with the given id.
25
- */
26
- onCreate: (id: string) => void;
27
- };
28
- export type InlineCommentViewComponentProps = AnnotationComponentProps & {
29
- /**
30
- * Existing annotations where the cursor is placed.
31
- * These are provided in order, inner-most first.
32
- */
33
- annotations: Array<AnnotationInfo>;
34
- /**
35
- * Resolves an annotation with the given ID around the selection.
36
- */
37
- onResolve: (id: string) => void;
38
- /**
39
- * Removes the annotation from the document
40
- */
41
- onDelete?: (id: string) => void;
42
- /**
43
- * Ordered list of annotation ids as shown in the document
44
- */
45
- annotationsList?: string[];
46
- };
47
- export interface AnnotationState<Type, State> {
48
- annotationType: Type;
49
- id: string;
50
- state: State;
51
- }
52
- export interface AnnotationTypeProvider<Type, State> {
53
- getState: (annotationIds: string[]) => Promise<AnnotationState<Type, State>[]>;
54
- updateSubscriber?: AnnotationUpdateEmitter;
55
- disallowOnWhitespace?: boolean;
56
- }
57
- export type InlineCommentState = {
58
- resolved: boolean;
59
- };
60
- export type InlineCommentAnnotationProvider = AnnotationTypeProvider<AnnotationTypes.INLINE_COMMENT, InlineCommentState> & {
61
- createComponent?: React.ComponentType<InlineCommentCreateComponentProps>;
62
- viewComponent?: React.ComponentType<InlineCommentViewComponentProps>;
63
- isToolbarAbove?: boolean;
64
- };
65
- export interface AnnotationProviders {
66
- inlineComment: InlineCommentAnnotationProvider;
67
- }
68
- export declare enum AnnotationSelectionType {
69
- INVALID = "invalid",
70
- DISABLED = "disabled",
71
- VALID = "valid"
72
- }
73
- export declare const AnnotationTestIds: {
74
- prefix: string;
75
- floatingComponent: string;
76
- floatingToolbarCreateButton: string;
77
- componentSave: string;
78
- componentClose: string;
79
- };
80
- export type CoordsAtPos = {
81
- top: number;
82
- bottom: number;
83
- left: number;
84
- right: number;
85
- };
86
- export {};
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- export type AnnotationViewWrapperProps = {
3
- children: React.ReactNode;
4
- onViewed?: () => void;
5
- annotationText?: string;
6
- };
7
- export declare class AnnotationViewWrapper extends React.PureComponent<AnnotationViewWrapperProps> {
8
- componentDidMount(): void;
9
- render(): React.ReactNode;
10
- }
@@ -1,13 +0,0 @@
1
- /// <reference types="react" />
2
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
- import type { AnnotationProviders } from '../types';
5
- import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
6
- interface InlineCommentViewProps {
7
- providers: AnnotationProviders;
8
- editorView: EditorView;
9
- editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
10
- dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
11
- }
12
- export declare function InlineCommentView({ providers, editorView, editorAnalyticsAPI, dispatchAnalyticsEvent, }: InlineCommentViewProps): JSX.Element | null;
13
- export {};
@@ -1,12 +0,0 @@
1
- /// <reference types="node" />
2
- import { EventEmitter } from 'events';
3
- export type UpdateEvent = 'create' | 'delete' | 'resolve' | 'unresolve' | 'setselectedannotation';
4
- export type VisibilityEvent = 'setvisibility';
5
- type AnnotationCallback = (params: string) => void;
6
- type VisibilityCallback = (params: boolean) => void;
7
- export declare class AnnotationUpdateEmitter extends EventEmitter {
8
- on(event: VisibilityEvent, listener: (isVisible: boolean) => void): this;
9
- on(event: UpdateEvent, listener: (annotationId: string) => void): this;
10
- off(event: string, listener: AnnotationCallback | VisibilityCallback): this;
11
- }
12
- export {};
@@ -1,45 +0,0 @@
1
- import type { ResolvedPos, Mark, Node, Slice, Schema } from '@atlaskit/editor-prosemirror/model';
2
- import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
3
- import { PluginKey, TextSelection, AllSelection } from '@atlaskit/editor-prosemirror/state';
4
- import { Decoration } from '@atlaskit/editor-prosemirror/view';
5
- import { hasAnnotationMark, containsAnyAnnotations } from '@atlaskit/editor-common/utils';
6
- import type { AnnotationInfo } from './types';
7
- import { AnnotationSelectionType } from './types';
8
- import type { InlineCommentPluginState } from './pm-plugins/types';
9
- import type { AnalyticsEventPayloadCallback } from '@atlaskit/editor-common/analytics';
10
- import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
11
- export { hasAnnotationMark, containsAnyAnnotations };
12
- /**
13
- * Finds the marks in the nodes to the left and right.
14
- * @param $pos Position to center search around
15
- */
16
- export declare const surroundingMarks: ($pos: ResolvedPos) => (readonly Mark[])[];
17
- export declare const getAllAnnotations: (doc: Node) => string[];
18
- export declare const addDraftDecoration: (start: number, end: number) => Decoration;
19
- export declare const getAnnotationViewKey: (annotations: AnnotationInfo[]) => string;
20
- export declare const findAnnotationsInSelection: (selection: Selection, doc: Node) => AnnotationInfo[];
21
- /**
22
- * get selection from position to apply new comment for
23
- * @return bookmarked positions if they exists, otherwise current selection positions
24
- */
25
- export declare function getSelectionPositions(editorState: EditorState, inlineCommentState?: InlineCommentPluginState | null | undefined): Selection;
26
- export declare const inlineCommentPluginKey: PluginKey<InlineCommentPluginState>;
27
- export declare const getPluginState: (state: EditorState) => InlineCommentPluginState | undefined;
28
- /**
29
- * get payload for the open/close analytics event
30
- */
31
- export declare const getDraftCommandAnalyticsPayload: (drafting: boolean, inputMethod: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT) => AnalyticsEventPayloadCallback;
32
- export declare const isSelectionValid: (state: EditorState) => AnnotationSelectionType;
33
- export declare const hasInvalidNodes: (state: EditorState) => boolean;
34
- /**
35
- * Checks if any of the nodes in a given selection are completely whitespace
36
- * This is to conform to Confluence annotation specifications
37
- */
38
- export declare function hasInvalidWhitespaceNode(selection: TextSelection | AllSelection, schema: Schema): boolean;
39
- export declare function annotationExists(annotationId: string, state: EditorState): boolean;
40
- export declare function stripNonExistingAnnotations(slice: Slice, state: EditorState): false | undefined;
41
- /**
42
- * Compares two sets of annotationInfos to see if the annotations have changed
43
- * This function assumes annotations will have unique id's for simplicity
44
- */
45
- export declare function isSelectedAnnotationsChanged(oldSelectedAnnotations: AnnotationInfo[], newSelectedAnnotations: AnnotationInfo[]): boolean;
@@ -1,15 +0,0 @@
1
- import type { EditorAnalyticsAPI, RESOLVE_METHOD } from '@atlaskit/editor-common/analytics';
2
- import type { Command } from '../../../types';
3
- import { AnnotationTypes } from '@atlaskit/adf-schema';
4
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
- import type { InlineCommentMap, InlineCommentMouseData } from '../pm-plugins/types';
6
- export declare const updateInlineCommentResolvedState: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (partialNewState: InlineCommentMap, resolveMethod?: RESOLVE_METHOD) => Command;
7
- export declare const closeComponent: () => Command;
8
- export declare const clearDirtyMark: () => Command;
9
- export declare const removeInlineCommentNearSelection: (id: string) => Command;
10
- export declare const setInlineCommentDraftState: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (drafting: boolean, inputMethod?: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT) => Command;
11
- export declare const addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (id: string) => Command;
12
- export declare const updateMouseState: (mouseData: InlineCommentMouseData) => Command;
13
- export declare const setSelectedAnnotation: (id: string) => Command;
14
- export declare const createAnnotation: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (id: string, annotationType?: AnnotationTypes) => Command;
15
- export declare const setInlineCommentsVisibility: (isVisible: boolean) => Command;
@@ -1,11 +0,0 @@
1
- import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
2
- import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
- import type { RESOLVE_METHOD, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
- declare const _default: {
5
- addAnnotationMark: (id: string) => (transaction: Transaction, state: EditorState) => Transaction;
6
- addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (id: string) => (transaction: Transaction, state: EditorState) => Transaction;
7
- addOpenCloseAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (drafting: boolean, method?: INPUT_METHOD.SHORTCUT | INPUT_METHOD.TOOLBAR) => (transaction: Transaction, state: EditorState) => Transaction;
8
- addInsertAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (transaction: Transaction, state: EditorState) => Transaction;
9
- addResolveAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (method?: RESOLVE_METHOD | undefined) => (transaction: Transaction, state: EditorState) => Transaction;
10
- };
11
- export default _default;
@@ -1,17 +0,0 @@
1
- import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
- import type { AnnotationProviders, InlineCommentAnnotationProvider, AnnotationInfo, AnnotationState, InlineCommentState, InlineCommentCreateComponentProps, InlineCommentViewComponentProps, AnnotationTypeProvider } from './types';
3
- import type { UpdateEvent } from './update-provider';
4
- import { AnnotationUpdateEmitter } from './update-provider';
5
- import type { InlineCommentPluginState } from './pm-plugins/types';
6
- import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
7
- export type AnnotationPlugin = NextEditorPlugin<'annotation', {
8
- pluginConfiguration: AnnotationProviders | undefined;
9
- sharedState: InlineCommentPluginState | undefined;
10
- dependencies: [
11
- OptionalPlugin<AnalyticsPlugin>
12
- ];
13
- }>;
14
- declare const annotationPlugin: AnnotationPlugin;
15
- export default annotationPlugin;
16
- export { AnnotationUpdateEmitter };
17
- export type { AnnotationProviders, InlineCommentAnnotationProvider, InlineCommentCreateComponentProps, InlineCommentViewComponentProps, AnnotationTypeProvider, AnnotationInfo, AnnotationState, InlineCommentState, UpdateEvent, };
@@ -1,11 +0,0 @@
1
- /// <reference types="react" />
2
- import { ForwardRef } from '../../../nodeviews';
3
- import ReactNodeView from '@atlaskit/editor-common/react-node-view';
4
- export declare class AnnotationNodeView extends ReactNodeView {
5
- createDomRef(): HTMLSpanElement;
6
- getContentDOM(): {
7
- dom: HTMLSpanElement;
8
- };
9
- render(_props: {}, forwardRef: ForwardRef): JSX.Element;
10
- }
11
- export declare const getAnnotationViewClassname: (isUnresolved: boolean, hasFocus: boolean) => string | undefined;
@@ -1,3 +0,0 @@
1
- import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { InlineCommentPluginState, InlineCommentPluginOptions } from './types';
3
- export declare const inlineCommentPlugin: (options: InlineCommentPluginOptions) => SafePlugin<InlineCommentPluginState>;
@@ -1,3 +0,0 @@
1
- import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
3
- export declare function keymapPlugin(editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin;
@@ -1,2 +0,0 @@
1
- import type { InlineCommentPluginState } from './types';
2
- export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch<any>, initialState: InlineCommentPluginState | ((state: import("prosemirror-state").EditorState) => InlineCommentPluginState)) => import("prosemirror-state").SafeStateField<InlineCommentPluginState>, createCommand: <A = import("./types").InlineCommentAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").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,78 +0,0 @@
1
- import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
2
- import type { EditorState, SelectionBookmark } from '@atlaskit/editor-prosemirror/state';
3
- import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
4
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
5
- import type { Dispatch, EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
6
- import type { InlineCommentAnnotationProvider, AnnotationInfo } from '../types';
7
- export declare enum ACTIONS {
8
- UPDATE_INLINE_COMMENT_STATE = 0,
9
- SET_INLINE_COMMENT_DRAFT_STATE = 1,
10
- INLINE_COMMENT_UPDATE_MOUSE_STATE = 2,
11
- INLINE_COMMENT_CLEAR_DIRTY_MARK = 3,
12
- ADD_INLINE_COMMENT = 4,
13
- INLINE_COMMENT_SET_VISIBLE = 5,
14
- CLOSE_COMPONENT = 6,
15
- SET_SELECTED_ANNOTATION = 7
16
- }
17
- export interface InlineCommentPluginOptions {
18
- dispatch: Dispatch;
19
- eventDispatcher: EventDispatcher;
20
- portalProviderAPI: PortalProviderAPI;
21
- provider: InlineCommentAnnotationProvider;
22
- editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
23
- }
24
- export interface InlineCommentMouseData {
25
- isSelecting: boolean;
26
- }
27
- export type InlineCommentMap = {
28
- [key: string]: boolean;
29
- };
30
- export type InlineCommentAction = {
31
- type: ACTIONS.UPDATE_INLINE_COMMENT_STATE;
32
- data: InlineCommentMap;
33
- } | {
34
- type: ACTIONS.SET_INLINE_COMMENT_DRAFT_STATE;
35
- data: {
36
- drafting: boolean;
37
- editorState: EditorState;
38
- };
39
- } | {
40
- type: ACTIONS.INLINE_COMMENT_UPDATE_MOUSE_STATE;
41
- data: {
42
- mouseData: InlineCommentMouseData;
43
- };
44
- } | {
45
- type: ACTIONS.INLINE_COMMENT_CLEAR_DIRTY_MARK;
46
- } | {
47
- type: ACTIONS.CLOSE_COMPONENT;
48
- } | {
49
- type: ACTIONS.ADD_INLINE_COMMENT;
50
- data: {
51
- drafting: boolean;
52
- inlineComments: InlineCommentMap;
53
- editorState: EditorState;
54
- selectedAnnotations: AnnotationInfo[];
55
- };
56
- } | {
57
- type: ACTIONS.INLINE_COMMENT_SET_VISIBLE;
58
- data: {
59
- isVisible: boolean;
60
- };
61
- } | {
62
- type: ACTIONS.SET_SELECTED_ANNOTATION;
63
- data: {
64
- selectedAnnotations: AnnotationInfo[];
65
- };
66
- };
67
- export type InlineCommentPluginState = {
68
- annotations: InlineCommentMap;
69
- selectedAnnotations: AnnotationInfo[];
70
- dirtyAnnotations?: boolean;
71
- mouseData: InlineCommentMouseData;
72
- draftDecorationSet?: DecorationSet;
73
- bookmark?: SelectionBookmark;
74
- disallowOnWhitespace: boolean;
75
- isInlineCommentViewClosed: boolean;
76
- isVisible: boolean;
77
- skipSelectionHandling: boolean;
78
- };
@@ -1,5 +0,0 @@
1
- import type { IntlShape } from 'react-intl-next';
2
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
- import type { FloatingToolbarConfig } from '@atlaskit/editor-common/types';
4
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
5
- export declare const buildToolbar: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (state: EditorState, intl: IntlShape, isToolbarAbove?: boolean) => FloatingToolbarConfig | undefined;
@@ -1,86 +0,0 @@
1
- import type React from 'react';
2
- import type { AnnotationTypes } from '@atlaskit/adf-schema';
3
- import type { AnnotationUpdateEmitter } from './update-provider';
4
- export type AnnotationInfo = {
5
- id: string;
6
- type: AnnotationTypes.INLINE_COMMENT;
7
- };
8
- type AnnotationComponentProps = {
9
- /**
10
- * Selected text (can be used when creating a comment)
11
- */
12
- textSelection?: string;
13
- /**
14
- * DOM element around selected text (for positioning)
15
- */
16
- dom?: HTMLElement;
17
- /**
18
- * Indicates that a draft comment was discarded/cancelled
19
- */
20
- onClose?: () => void;
21
- };
22
- export type InlineCommentCreateComponentProps = AnnotationComponentProps & {
23
- /**
24
- * Creates an annotation mark in the document with the given id.
25
- */
26
- onCreate: (id: string) => void;
27
- };
28
- export type InlineCommentViewComponentProps = AnnotationComponentProps & {
29
- /**
30
- * Existing annotations where the cursor is placed.
31
- * These are provided in order, inner-most first.
32
- */
33
- annotations: Array<AnnotationInfo>;
34
- /**
35
- * Resolves an annotation with the given ID around the selection.
36
- */
37
- onResolve: (id: string) => void;
38
- /**
39
- * Removes the annotation from the document
40
- */
41
- onDelete?: (id: string) => void;
42
- /**
43
- * Ordered list of annotation ids as shown in the document
44
- */
45
- annotationsList?: string[];
46
- };
47
- export interface AnnotationState<Type, State> {
48
- annotationType: Type;
49
- id: string;
50
- state: State;
51
- }
52
- export interface AnnotationTypeProvider<Type, State> {
53
- getState: (annotationIds: string[]) => Promise<AnnotationState<Type, State>[]>;
54
- updateSubscriber?: AnnotationUpdateEmitter;
55
- disallowOnWhitespace?: boolean;
56
- }
57
- export type InlineCommentState = {
58
- resolved: boolean;
59
- };
60
- export type InlineCommentAnnotationProvider = AnnotationTypeProvider<AnnotationTypes.INLINE_COMMENT, InlineCommentState> & {
61
- createComponent?: React.ComponentType<InlineCommentCreateComponentProps>;
62
- viewComponent?: React.ComponentType<InlineCommentViewComponentProps>;
63
- isToolbarAbove?: boolean;
64
- };
65
- export interface AnnotationProviders {
66
- inlineComment: InlineCommentAnnotationProvider;
67
- }
68
- export declare enum AnnotationSelectionType {
69
- INVALID = "invalid",
70
- DISABLED = "disabled",
71
- VALID = "valid"
72
- }
73
- export declare const AnnotationTestIds: {
74
- prefix: string;
75
- floatingComponent: string;
76
- floatingToolbarCreateButton: string;
77
- componentSave: string;
78
- componentClose: string;
79
- };
80
- export type CoordsAtPos = {
81
- top: number;
82
- bottom: number;
83
- left: number;
84
- right: number;
85
- };
86
- export {};
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- export type AnnotationViewWrapperProps = {
3
- children: React.ReactNode;
4
- onViewed?: () => void;
5
- annotationText?: string;
6
- };
7
- export declare class AnnotationViewWrapper extends React.PureComponent<AnnotationViewWrapperProps> {
8
- componentDidMount(): void;
9
- render(): React.ReactNode;
10
- }
@@ -1,13 +0,0 @@
1
- /// <reference types="react" />
2
- import type { EditorView } from '@atlaskit/editor-prosemirror/view';
3
- import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
- import type { AnnotationProviders } from '../types';
5
- import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
6
- interface InlineCommentViewProps {
7
- providers: AnnotationProviders;
8
- editorView: EditorView;
9
- editorAnalyticsAPI: EditorAnalyticsAPI | undefined;
10
- dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
11
- }
12
- export declare function InlineCommentView({ providers, editorView, editorAnalyticsAPI, dispatchAnalyticsEvent, }: InlineCommentViewProps): JSX.Element | null;
13
- export {};
@@ -1,12 +0,0 @@
1
- /// <reference types="node" />
2
- import { EventEmitter } from 'events';
3
- export type UpdateEvent = 'create' | 'delete' | 'resolve' | 'unresolve' | 'setselectedannotation';
4
- export type VisibilityEvent = 'setvisibility';
5
- type AnnotationCallback = (params: string) => void;
6
- type VisibilityCallback = (params: boolean) => void;
7
- export declare class AnnotationUpdateEmitter extends EventEmitter {
8
- on(event: VisibilityEvent, listener: (isVisible: boolean) => void): this;
9
- on(event: UpdateEvent, listener: (annotationId: string) => void): this;
10
- off(event: string, listener: AnnotationCallback | VisibilityCallback): this;
11
- }
12
- export {};
@@ -1,45 +0,0 @@
1
- import type { ResolvedPos, Mark, Node, Slice, Schema } from '@atlaskit/editor-prosemirror/model';
2
- import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
3
- import { PluginKey, TextSelection, AllSelection } from '@atlaskit/editor-prosemirror/state';
4
- import { Decoration } from '@atlaskit/editor-prosemirror/view';
5
- import { hasAnnotationMark, containsAnyAnnotations } from '@atlaskit/editor-common/utils';
6
- import type { AnnotationInfo } from './types';
7
- import { AnnotationSelectionType } from './types';
8
- import type { InlineCommentPluginState } from './pm-plugins/types';
9
- import type { AnalyticsEventPayloadCallback } from '@atlaskit/editor-common/analytics';
10
- import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
11
- export { hasAnnotationMark, containsAnyAnnotations };
12
- /**
13
- * Finds the marks in the nodes to the left and right.
14
- * @param $pos Position to center search around
15
- */
16
- export declare const surroundingMarks: ($pos: ResolvedPos) => (readonly Mark[])[];
17
- export declare const getAllAnnotations: (doc: Node) => string[];
18
- export declare const addDraftDecoration: (start: number, end: number) => Decoration;
19
- export declare const getAnnotationViewKey: (annotations: AnnotationInfo[]) => string;
20
- export declare const findAnnotationsInSelection: (selection: Selection, doc: Node) => AnnotationInfo[];
21
- /**
22
- * get selection from position to apply new comment for
23
- * @return bookmarked positions if they exists, otherwise current selection positions
24
- */
25
- export declare function getSelectionPositions(editorState: EditorState, inlineCommentState?: InlineCommentPluginState | null | undefined): Selection;
26
- export declare const inlineCommentPluginKey: PluginKey<InlineCommentPluginState>;
27
- export declare const getPluginState: (state: EditorState) => InlineCommentPluginState | undefined;
28
- /**
29
- * get payload for the open/close analytics event
30
- */
31
- export declare const getDraftCommandAnalyticsPayload: (drafting: boolean, inputMethod: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT) => AnalyticsEventPayloadCallback;
32
- export declare const isSelectionValid: (state: EditorState) => AnnotationSelectionType;
33
- export declare const hasInvalidNodes: (state: EditorState) => boolean;
34
- /**
35
- * Checks if any of the nodes in a given selection are completely whitespace
36
- * This is to conform to Confluence annotation specifications
37
- */
38
- export declare function hasInvalidWhitespaceNode(selection: TextSelection | AllSelection, schema: Schema): boolean;
39
- export declare function annotationExists(annotationId: string, state: EditorState): boolean;
40
- export declare function stripNonExistingAnnotations(slice: Slice, state: EditorState): false | undefined;
41
- /**
42
- * Compares two sets of annotationInfos to see if the annotations have changed
43
- * This function assumes annotations will have unique id's for simplicity
44
- */
45
- export declare function isSelectedAnnotationsChanged(oldSelectedAnnotations: AnnotationInfo[], newSelectedAnnotations: AnnotationInfo[]): boolean;