@atlaskit/editor-plugin-metrics
Version:
Metrics plugin for @atlaskit/editor-core
35 lines (34 loc) • 1.47 kB
TypeScript
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
import type { UserPreferencesProvider, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
import type { Fragment } from '@atlaskit/editor-prosemirror/model';
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
import type { Selection } from '@atlaskit/editor-prosemirror/state';
import type { MetricsPlugin } from '../metricsPluginType';
import type { TrActionType } from './utils/check-tr-actions/types';
export declare const metricsKey: PluginKey;
export type MetricsState = {
actionTypeCount: ActionByType;
activeSessionTime: number;
contentSizeChanged: number;
initialContent?: Fragment;
intentToStartEditTime?: number;
lastSelection?: Selection;
previousTrType?: TrActionType;
repeatedActionCount: number;
safeInsertCount: number;
shouldPersistActiveSession?: boolean;
timeOfLastTextInput?: number;
totalActionCount: number;
};
export type ActionByType = {
contentDeletedCount: number;
contentMovedCount: number;
markChangeCount: number;
nodeAttributeChangeCount: number;
nodeDeletionCount: number;
nodeInsertionCount: number;
textInputCount: number;
undoCount: number;
};
export declare const initialPluginState: MetricsState;
export declare const createPlugin: (api: ExtractInjectionAPI<MetricsPlugin> | undefined, userPreferencesProvider?: UserPreferencesProvider) => SafePlugin<MetricsState>;