@atlaskit/editor-common 103.2.0 → 103.3.1

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 +21 -0
  2. package/dist/cjs/analytics/types/alignment-events.js +5 -0
  3. package/dist/cjs/analytics/types/enums.js +1 -0
  4. package/dist/cjs/annotation/index.js +16 -1
  5. package/dist/cjs/annotation/manager.js +243 -0
  6. package/dist/cjs/monitoring/error.js +1 -1
  7. package/dist/cjs/ui/DropList/index.js +1 -1
  8. package/dist/es2019/analytics/types/alignment-events.js +1 -0
  9. package/dist/es2019/analytics/types/enums.js +1 -0
  10. package/dist/es2019/annotation/index.js +22 -0
  11. package/dist/es2019/annotation/manager.js +196 -0
  12. package/dist/es2019/monitoring/error.js +1 -1
  13. package/dist/es2019/ui/DropList/index.js +1 -1
  14. package/dist/esm/analytics/types/alignment-events.js +1 -0
  15. package/dist/esm/analytics/types/enums.js +1 -0
  16. package/dist/esm/annotation/index.js +23 -1
  17. package/dist/esm/annotation/manager.js +236 -0
  18. package/dist/esm/monitoring/error.js +1 -1
  19. package/dist/esm/ui/DropList/index.js +1 -1
  20. package/dist/types/analytics/types/alignment-events.d.ts +8 -0
  21. package/dist/types/analytics/types/enums.d.ts +2 -1
  22. package/dist/types/analytics/types/events.d.ts +2 -1
  23. package/dist/types/annotation/index.d.ts +132 -0
  24. package/dist/types/annotation/manager.d.ts +32 -0
  25. package/dist/types/types/annotation/index.d.ts +2 -0
  26. package/dist/types-ts4.5/analytics/types/alignment-events.d.ts +8 -0
  27. package/dist/types-ts4.5/analytics/types/enums.d.ts +2 -1
  28. package/dist/types-ts4.5/analytics/types/events.d.ts +2 -1
  29. package/dist/types-ts4.5/annotation/index.d.ts +132 -0
  30. package/dist/types-ts4.5/annotation/manager.d.ts +32 -0
  31. package/dist/types-ts4.5/types/annotation/index.d.ts +2 -0
  32. package/package.json +1 -1
@@ -0,0 +1,32 @@
1
+ import type { AnnotationId } from '@atlaskit/adf-schema';
2
+ import type { AnnotationDraftStartedData, AnnotationManager, AnnotationManagerEvents, AnnotationManagerMethods, AnnotationSelectedChangeData, ApplyDraftResult, ClearAnnotationResult, ClearDraftResult, GetDraftResult, HoverAnnotationResult, SelectAnnotationResult, StartDraftResult } from './index';
3
+ export declare class SharedAnnotationManager implements AnnotationManager {
4
+ /**
5
+ * This is the event emitter that is used to emit events from the manager. It is used to communicate with
6
+ * other parts of the application.
7
+ */
8
+ private emitter;
9
+ /**
10
+ * This is the map of hooks that can be added to the manager. Hooks are a 1:1 mapping of methods that can be
11
+ * called on the manager. They are used to extend the functionality of the manager.
12
+ */
13
+ private hooks;
14
+ private preemptiveGate;
15
+ setPreemptiveGate(handler: () => Promise<boolean>): AnnotationManager;
16
+ checkPreemptiveGate(): Promise<boolean>;
17
+ onDraftAnnotationStarted(handler: (data: AnnotationDraftStartedData) => void): AnnotationManager;
18
+ offDraftAnnotationStarted(handler: (data: AnnotationDraftStartedData) => void): AnnotationManager;
19
+ onAnnotationSelectionChange(handler: (data: AnnotationSelectedChangeData) => void): AnnotationManager;
20
+ offAnnotationSelectionChange(handler: (data: AnnotationSelectedChangeData) => void): AnnotationManager;
21
+ emit(event: AnnotationManagerEvents): AnnotationManager;
22
+ hook<H extends keyof AnnotationManagerMethods>(method: H, handler: AnnotationManagerMethods[H]): AnnotationManager;
23
+ unhook<H extends keyof AnnotationManagerMethods>(method: H, handler: AnnotationManagerMethods[H]): AnnotationManager;
24
+ allowAnnotation(): boolean;
25
+ startDraft(): StartDraftResult;
26
+ clearDraft(): ClearDraftResult;
27
+ applyDraft(id: AnnotationId): ApplyDraftResult;
28
+ getDraft(): GetDraftResult;
29
+ setIsAnnotationSelected(id: string, isSelected: boolean): SelectAnnotationResult;
30
+ setIsAnnotationHovered(id: string, isHovered: boolean): HoverAnnotationResult;
31
+ clearAnnotation(id: AnnotationId): ClearAnnotationResult;
32
+ }
@@ -2,6 +2,7 @@
2
2
  import type { AnnotationId, AnnotationTypes } from '@atlaskit/adf-schema';
3
3
  import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
4
4
  import type { Step } from '@atlaskit/editor-prosemirror/transform';
5
+ import type { AnnotationManager } from '../../annotation';
5
6
  import type { AnnotationState, AnnotationUpdateEmitter } from './emitter';
6
7
  export type AnnotationByMatches = {
7
8
  originalSelection: string;
@@ -141,5 +142,6 @@ export type InlineCommentAnnotationProvider = AnnotationTypeProvider<AnnotationT
141
142
  };
142
143
  export type AnnotationProviders = {
143
144
  inlineComment: InlineCommentAnnotationProvider;
145
+ annotationManager?: AnnotationManager;
144
146
  };
145
147
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "103.2.0",
3
+ "version": "103.3.1",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"