Skip to content
Document Authoring DA  API Docs v1.15.1
npmGitHub

InsertContentAtCursorOptionsNEW

InsertContentAtCursorOptions:

type InsertContentAtCursorOptions =
| { format?: "text"; content: string }
| { format: "fragment"; content: object; inlineFormatting?: boolean };

Options for DocAuthEditor.insertContentAtCursor, a discriminated union keyed by format. When format is omitted, defaults to 'text'.

{ format?: "text"; content: string; }

optional format: "text"

Inserts the given string at the cursor. Default when format is omitted.

content: string

{ format: "fragment"; content: object; inlineFormatting?: boolean; }

format: "fragment"

Inserts a structured fragment at the cursor. Use a value obtained from DocAuthEditor.getSelectionContent with format: 'fragment', or one round-tripped through JSON.

content: object

The fragment object to insert. Opaque JSON-serializable data; don’t depend on its internal shape.

optional inlineFormatting: boolean

Controls whether inserted content keeps its source formatting or takes the destination’s. Defaults to true.

It affects two things: the character formatting that inserted text got from its source paragraph or paragraph style (bold, italic, font, size, colour), and the padding, shading and borders of inserted table cells when a range of cells is inserted over another range. Formatting set directly on the text itself is always kept, whichever value you pass.

  • true inlines the source formatting: the character formatting the text inherited from its paragraph or style is written directly onto the inserted text, and each inserted cell takes the source cell’s padding, shading and borders. The destination paragraph still keeps its own alignment, indent, style and list, and the destination table keeps its row and column spans.
  • false takes the destination’s formatting. Inserted text falls back to the destination paragraph’s formatting, and inserted cells keep the destination cells’ padding, shading and borders.

For text, this only applies when inserting into the middle of a paragraph; inserting whole paragraphs always keeps the source paragraph’s formatting.