@atlaskit/editor-plugin-synced-block
Version:
SyncedBlock plugin for @atlaskit/editor-core
42 lines (41 loc) • 2.06 kB
TypeScript
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal';
import type { getPosHandler } from '@atlaskit/editor-common/react-node-view';
import type { ExtractInjectionAPI, getPosHandlerNode, PMPluginFactoryParams } from '@atlaskit/editor-common/types';
import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
import type { SyncBlockStoreManager } from '@atlaskit/editor-synced-block-provider';
import type { SyncedBlockPlugin, SyncedBlockPluginOptions } from '../syncedBlockPluginType';
export interface BodiedSyncBlockNodeViewProperties {
api?: ExtractInjectionAPI<SyncedBlockPlugin>;
pluginOptions: SyncedBlockPluginOptions | undefined;
pmPluginFactoryParams: PMPluginFactoryParams;
syncBlockStore?: SyncBlockStoreManager;
}
export declare class BodiedSyncBlock implements NodeView {
dom: HTMLElement;
contentDOM: HTMLElement;
node: PMNode;
view: EditorView;
getPos: getPosHandlerNode;
nodeViewPortalProviderAPI: PortalProviderAPI;
private api?;
private cleanupConnectivityModeListener?;
private cleanupViewModeListener?;
private labelKey;
constructor(node: PMNode, view: EditorView, getPos: getPosHandlerNode, api: ExtractInjectionAPI<SyncedBlockPlugin> | undefined, nodeViewPortalProviderAPI: PortalProviderAPI);
private updateContentEditable;
private handleConnectivityModeChange;
private handleViewModeChange;
/**
* Marks the block as empty so the source placeholder can be shown purely from document state.
* See `isEmptySourceSyncBlock` for why the DOM is not used to decide this.
*/
private updateEmptyClass;
update(node: PMNode): boolean;
ignoreMutation(mutation: MutationRecord | {
target: Node;
type: 'selection';
}): boolean;
destroy(): void;
}
export declare const bodiedSyncBlockNodeView: (props: BodiedSyncBlockNodeViewProperties) => ((node: PMNode, view: EditorView, getPos: getPosHandler) => NodeView);