TextManager
Table of contents
class TextManager {}Constructor
Constructs a new instance of the TextManager class
Parameters
| Name | Description |
|---|---|
|
Properties
editor
editor: Editor;Methods
dispose( )
dispose(): void;measureElementTextNodeSpans( )
Given an html element, measure the position of each span of unbroken word/white-space characters within any text nodes it contains.
measureElementTextNodeSpans(
element: HTMLElement,
{
shouldTruncateToFirstLine,
}?: {
shouldTruncateToFirstLine?: boolean;
},
): {
didTruncate: boolean;
spans: {
box: BoxModel;
text: string;
}[];
};Parameters
| Name | Description |
|---|---|
| |
| |
Returns
{
didTruncate: boolean;
spans: {
box: BoxModel;
text: string;
}[];
};measureHtml( )
measureHtml(html: string, opts: TLMeasureTextOpts): TLMeasuredTextSize;Parameters
| Name | Description |
|---|---|
| |
|
Returns
measureHtmlBatch( )
measureHtmlBatch(requests: BatchMeasurementRequest[]): TLMeasuredTextSize[];Parameters
| Name | Description |
|---|---|
|
Returns
measureText( )
measureText(
textToMeasure: string,
opts: TLMeasureTextOpts,
): TLMeasuredTextSize;Parameters
| Name | Description |
|---|---|
| |
|
Returns
measureTextSpans( )
Measure text into individual spans. Spans are created by rendering the text, then dividing it up according to line breaks and word boundaries.
It works by having the browser render the text, then measuring the position of each character. You can use this to replicate the text-layout algorithm of the current browser in e.g. an SVG export.
measureTextSpans(
textToMeasure: string,
opts: TLMeasureTextSpanOpts,
): {
box: BoxModel;
text: string;
}[];Parameters
| Name | Description |
|---|---|
| |
|
Returns
{
box: BoxModel;
text: string;
}[];Prev
StateNodeNext
TransformedGeometry2d