@atlaskit/editor-plugin-content-insertion
Version:
Content insertion plugin for @atlaskit/editor-core
39 lines (38 loc) • 1.41 kB
TypeScript
import type { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics';
import type { CommandDispatch, EditorCommand } from '@atlaskit/editor-common/types';
import type { Fragment, Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
import type { EditorState, Selection } from '@atlaskit/editor-prosemirror/state';
export type InsertNodeActionConfig = {
dispatch: CommandDispatch | undefined;
node: PMNode | Fragment;
options: {
analyticsPayload?: AnalyticsEventPayload;
insertAt?: Selection;
selectNodeInserted: boolean;
};
state: EditorState | undefined | null;
};
export type InsertNodeConfig = {
node: PMNode | Fragment;
options: {
analyticsPayload?: AnalyticsEventPayload;
insertAt?: Selection;
selectNodeInserted: boolean;
};
};
export type InsertNodeAPI = {
actions: {
/**
* @private
* @deprecated The insert action should not be used. Use the insert command instead. (To be removed with feature gate: `platform_editor_use_nested_table_pm_nodes` as editor-plugin-table is the only consumer)
*/
insert: (props: InsertNodeActionConfig) => boolean;
};
commands: {
insert: (props: InsertNodeConfig) => EditorCommand;
};
};
export type CreateNodeHandler = ({ nodeName, schema, }: {
nodeName: string;
schema: Schema;
}) => PMNode;