import { Fragment as ProseMirrorFragment, Mark as ProseMirrorMark, Node as ProseMirrorNode, NodeType, Schema } from 'prosemirror-model'; import { Transaction } from 'prosemirror-state'; /** * Build a text-or-fragment suitable for insertion, splitting on '\t' and '\n' * and inserting schema `tab` / `lineBreak` nodes at each split. * * A tab split produces a `tab` node; a newline split produces a `lineBreak` * node. Each is only performed when the schema exposes the matching node type * (and, for tabs, when the parent admits them; see {@link parentAllowsNodeAt}). * A control character that cannot be materialized stays literal inside the * surrounding text node so exporters and readers still see it. * * Newlines must become `lineBreak` nodes (not raw '\n' inside a text node): * a literal newline inside `` is whitespace that Word collapses on open * (it is not the OOXML representation of a line break), so it would drop the * visible break while SuperDoc still renders it. The `lineBreak` node * round-trips to a Word-native ``. See SD-3278. * * Returns a plain text node when the text contains no splittable control * character (the common case). Callers are responsible for ensuring `text` is * non-empty (ProseMirror's `schema.text` throws on empty input). */ export declare function buildTextWithTabs(schema: Schema, text: string, marks: readonly ProseMirrorMark[] | undefined, opts?: { parentAllowsTab?: boolean; parentAllowsLineBreak?: boolean; }): ProseMirrorNode | ProseMirrorFragment; /** * Check whether the parent node at `absPos` in `tr.doc` admits a node of * `nodeType` according to its content expression. * * Returns `true` when the parent cannot be probed (e.g. mocked test docs), * preserving pre-existing behavior for call sites that lack a full PM schema. */ export declare function parentAllowsNodeAt(tr: Transaction, absPos: number, nodeType: NodeType): boolean; /** * Tab-aware analogue of ProseMirror's `Node.textBetween`. * * The built-in `textBetween` cannot surface `tab` nodes because the tab node * schema defines `content: 'inline*'` (on purpose, to stop PM from auto- * inserting a separator after it during export), which means `isLeaf` is * `false` and any `leafText` callback is never invoked for tabs. This helper * walks the range directly, emitting a literal '\t' for every tab node so * reads round-trip with the input text. * * Non-tab inline leaves fall back to `leafFallback`, matching the placeholder * that the caller would have passed to `textBetween` (e.g. '' for plain text * extraction, '\ufffc' for offset-preserving reads, '\n' for get-text-adapter). */ export declare function textBetweenWithTabs(doc: ProseMirrorNode, from: number, to: number, blockSeparator: string, leafFallback: string, options?: { textModel?: 'raw' | 'visible'; }): string; //# sourceMappingURL=text-with-tabs.d.ts.map