@atlaskit/editor-plugin-block-controls
Version:
Block controls plugin for @atlaskit/editor-core
22 lines (21 loc) • 1.1 kB
TypeScript
import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types/next-editor-plugin';
import type { EditorState, PluginKey } from '@atlaskit/editor-prosemirror/state';
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
import type { BlockControlsPlugin } from '../blockControlsPluginType';
import type { SparseSurfacesState } from '../pm-plugins/utils/sparse-surfaces-state';
type Api = ExtractInjectionAPI<BlockControlsPlugin> | undefined;
type SparseSurfacesPluginView = {
destroy: () => void;
update: (view: EditorView, previousState: EditorState) => void;
};
/**
* Sparse surfaces plugin view for the CLS fix. Each animation frame reconciles which blocks have
* surfaces, commits their anchor decorations, and publishes the surfaces React renders through
* `SurfaceLifecycle`, which retains anchors until React commits their replacement.
*/
export declare const createSparseSurfacesViewWithLifecycle: ({ api, pluginKey, view, }: {
api: Api;
pluginKey: PluginKey<SparseSurfacesState>;
view: EditorView;
}) => SparseSurfacesPluginView;
export {};