@atlaskit/editor-plugin-code-block
Version:
Code block plugin for @atlaskit/editor-core
28 lines (27 loc) • 1.02 kB
TypeScript
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
import type { FormatResult } from '../types';
import type { LanguageSource } from '../utils/format-code/formatter';
export type PendingFormatRequest = {
languageSource: LanguageSource;
pos: number;
requestId: string;
};
export type ResolveFormatCodeOutcome = 'failed' | 'formatted' | 'unchanged';
export type FormatCodeErrorState = {
errorType: Extract<FormatResult, {
status: 'failed';
}>['errorType'];
languageSource: LanguageSource;
localId: string;
};
export type CodeBlockState = {
contentCopied: boolean;
decorations: DecorationSet;
formatCodeErrors: Record<string, FormatCodeErrorState>;
isNodeSelected: boolean;
pendingFormats: Record<string, PendingFormatRequest>;
pos: number | null;
shouldIgnoreFollowingMutations: boolean;
};
export declare const getPluginState: (state: EditorState) => CodeBlockState;