@atlaskit/editor-common
Version:
A package that contains common classes and components for editor and renderer
34 lines (33 loc) • 2.18 kB
TypeScript
import type { AnnotationId } from '@atlaskit/adf-schema';
import type { AnnotationDraftStartedData, AnnotationManager, AnnotationManagerEvents, AnnotationManagerMethods, AnnotationSelectedChangeData, ApplyDraftResult, ClearAnnotationResult, ClearDraftResult, GetDraftResult, HoverAnnotationResult, SelectAnnotationResult, StartDraftResult } from './index';
export declare class SharedAnnotationManager implements AnnotationManager {
/**
* This is the event emitter that is used to emit events from the manager. It is used to communicate with
* other parts of the application.
*/
private emitter;
/**
* This is the map of hooks that can be added to the manager. Hooks are a 1:1 mapping of methods that can be
* called on the manager. They are used to extend the functionality of the manager.
*/
private hooks;
private preemptiveGate;
private activePreemptiveGate;
setPreemptiveGate(handler: () => Promise<boolean>): AnnotationManager;
checkPreemptiveGate(): Promise<boolean>;
onDraftAnnotationStarted(handler: (data: AnnotationDraftStartedData) => void): AnnotationManager;
offDraftAnnotationStarted(handler: (data: AnnotationDraftStartedData) => void): AnnotationManager;
onAnnotationSelectionChange(handler: (data: AnnotationSelectedChangeData) => void): AnnotationManager;
offAnnotationSelectionChange(handler: (data: AnnotationSelectedChangeData) => void): AnnotationManager;
emit(event: AnnotationManagerEvents): AnnotationManager;
hook<H extends keyof AnnotationManagerMethods>(method: H, handler: AnnotationManagerMethods[H]): AnnotationManager;
unhook<H extends keyof AnnotationManagerMethods>(method: H, handler: AnnotationManagerMethods[H]): AnnotationManager;
allowAnnotation(): boolean;
startDraft(): StartDraftResult;
clearDraft(): ClearDraftResult;
applyDraft(id: AnnotationId): ApplyDraftResult;
getDraft(): GetDraftResult;
setIsAnnotationSelected(id: string, isSelected: boolean): SelectAnnotationResult;
setIsAnnotationHovered(id: string, isHovered: boolean): HoverAnnotationResult;
clearAnnotation(id: AnnotationId): ClearAnnotationResult;
}