@atlaskit/editor-plugin-local-id
Version:
LocalId plugin for @atlaskit/editor-core
33 lines (32 loc) • 1.36 kB
TypeScript
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
import type { LocalIdPlugin, LocalIdStatusCode } from '../localIdPluginType';
/**
* Plugin state tracking all localIds in the document
*/
export type LocalIdWatchmenState = {
/**
* This flag controls whether or not the watchmen plugin will process transactions. Caution! disabling and then re-enabling
* this plugin will cause the watchment to rescan the whole document to sync the localId state.
*/
enabled: boolean;
/**
* This is the initial count of localIds when the plugin was first initialized.
*/
initLocalIdSize: number;
/**
* Timestamp of last state update for debugging
*/
lastUpdated: number;
/**
* This is a list of all localIds which have ever existed in the document and whether or not they're currently
* on the page (ie "active") or not.
*/
localIdStatus: Map<string, LocalIdStatusCode>;
};
export declare const localIdWatchmenPluginKey: PluginKey<LocalIdWatchmenState>;
/**
* Creates the localId watchmen plugin
*/
export declare const createWatchmenPlugin: (api: ExtractInjectionAPI<LocalIdPlugin> | undefined) => SafePlugin<LocalIdWatchmenState>;