@atlaskit/editor-plugin-layout
Version:
Layout plugin for @atlaskit/editor-core
29 lines (28 loc) • 2.08 kB
TypeScript
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
import type { Command, TOOLBAR_MENU_TYPE } from '@atlaskit/editor-common/types';
import type { Node } from '@atlaskit/editor-prosemirror/model';
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
import type { Change, PresetLayout } from '../types';
export declare const ONE_COL_LAYOUTS: PresetLayout[];
export declare const TWO_COL_LAYOUTS: PresetLayout[];
export declare const THREE_COL_LAYOUTS: PresetLayout[];
/**
* Finds layout preset based on the width attrs of all the layoutColumn nodes
* inside the layoutSection node
*/
export declare const getPresetLayout: (section: Node) => PresetLayout | undefined;
export declare const getSelectedLayout: (maybeLayoutSection: Node | undefined, current: PresetLayout) => PresetLayout;
export declare const createMultiColumnLayoutSection: (state: EditorState, numberOfColumns?: number) => Node;
export declare const createDefaultLayoutSection: (state: EditorState) => Node;
export declare const insertLayoutColumns: Command;
export declare const insertLayoutColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: TOOLBAR_MENU_TYPE) => Command;
/**
* Forces a layout section node to match the given preset layout by adjusting
* its column structure and widths, then restoring the original selection.
*/
export declare function forceSectionToPresetLayout(state: EditorState, node: Node, pos: number, presetLayout: PresetLayout): Transaction;
export declare const setPresetLayout: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (layout: PresetLayout) => Command;
export declare const fixColumnSizes: (changedTr: Transaction, state: EditorState) => Change | undefined;
export declare const fixColumnStructure: (state: EditorState) => Transaction | undefined;
export declare const deleteActiveLayoutNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, inputMethod?: INPUT_METHOD.FLOATING_TB) => Command;