Skip to content

Type Editor


Type Editor / @type-editor/changeset / simplify-changes/get-text / getText

Function: getText()

ts
function getText(fragment, start, end): string;

Defined in: simplify-changes/get-text.ts:16

Extracts text content from a document fragment range.

Converts a range of document nodes into a string representation for character-level analysis. Non-text elements (images, widgets, etc.) are represented as spaces to prevent them from being considered part of words.

Parameters

ParameterTypeDescription
fragmentFragmentThe document fragment to extract text from.
startnumberThe start position of the range (inclusive).
endnumberThe end position of the range (exclusive).

Returns

string

The text content with non-text nodes replaced by spaces.