UNPKG

@atlaskit/editor-common

Version:

A package that contains common classes and components for editor and renderer

17 lines (16 loc) 1.15 kB
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model'; import { type EditorState } from '@atlaskit/editor-prosemirror/state'; import { type NodeWithPos } from '@atlaskit/editor-prosemirror/utils'; export declare const defaultWordWrapState = false; export declare const codeBlockWrappedStates: WeakMap<PmNode, boolean | undefined>; export declare const isCodeBlockWordWrapEnabled: (codeBlockNode: PmNode) => boolean; /** * Swap the old node key with the new node key in the wrapped states WeakMap. */ export declare const transferCodeBlockWrappedValue: (oldCodeBlockNode: PmNode, newCodeBlockNode: PmNode) => void; /** * As the code block node is used as the wrapped state key, there is instances where the node will be destroyed & recreated and is no longer a valid key. * In these instances, we must get the value from that old node and set it to the value of the new node. * This function takes all the given nodes, finds their old nodes from the old state and updates these old node keys. */ export declare const updateCodeBlockWrappedStateNodeKeys: (newCodeBlockNodes: NodeWithPos[], oldState: EditorState) => void;