UNPKG

mind-elixir

Version:

Mind elixir is a free open source mind map core.

47 lines (46 loc) • 2.35 kB
import type MindElixir from '../index'; import type { Topic, Wrapper, Parent, Children, Expander } from '../types/dom'; import { DirectionClass, type NodeObj } from '../types/index'; export declare const findEle: (this: MindElixir, id: string, el?: HTMLElement) => Topic<any>; export declare const shapeTpc: (this: MindElixir, tpc: Topic, nodeObj: NodeObj) => void; export declare const createWrapper: (this: MindElixir, nodeObj: NodeObj, omitChildren?: boolean) => { grp: Wrapper; top: Parent; tpc: Topic<any>; }; export declare const createParent: (this: MindElixir, nodeObj: NodeObj) => { p: Parent; tpc: Topic<any>; }; export declare const createChildren: (this: MindElixir, wrappers: Wrapper[]) => Children; export declare const createTopic: (this: MindElixir, nodeObj: NodeObj) => Topic<any>; export declare const createMain: (directionClass: DirectionClass) => HTMLElement; export declare const directionOf: (el: Element) => DirectionClass; export declare function selectText(div: HTMLElement): void; /** * Open the map's inline editor over `host`: a contenteditable div that replaces * the visible content while editing. Shared mechanism of node-topic editing * ({@link editTopic}) and SVG-label editing (`editSvgText`); the caller * positions and styles the div and keeps the commit POLICY, this wires the * shared MECHANISM: * * - `#input-box` identity, plaintext-only content, initial text, selection * - the IME-guarded keymap (see {@link bindEditorKeydown}) * - `host` is hidden while editing and unhidden on blur * - blur: read the trimmed content (innerText — Safari maps `<br>` to `\n` * there; read before remove, innerText degrades on detached elements), then * hand the RAW content to `onCommit`. Empty and unchanged input are NOT * filtered here: the topic editor treats both as no-ops, the label editor * treats empty as a revert. */ export declare const openInlineEditor: (options: { mei: MindElixir; editor: HTMLDivElement; host: HTMLElement; original: string; onCommit: (content: string) => void; /** Extra blur-time restore (e.g. the topic selection outline). */ onRestore?: () => void; }) => void; export declare const editTopic: (this: MindElixir, el: Topic) => void; export declare const createExpander: (expanded: boolean | undefined) => Expander;