Skip to main content

TextSegment Class

This API is provided for existing users, but is not recommended for new users.

To use, import via @fluidframework/merge-tree/legacy.

For more information about our API support guarantees, see here.

Signature

export declare class TextSegment extends BaseSegment

Extends: BaseSegment

Constructors

ConstructorAlertsDescription
(constructor)(text, props)BetaConstructs a new instance of the TextSegment class

Static Properties

PropertyAlertsModifiersTypeDescription
typeBetareadonly

Static Methods

MethodAlertsReturn TypeDescription
fromJSONObject(spec)BetaTextSegment | undefined
is(segment)Betasegment is TextSegment
make(text, props)BetaTextSegment

Properties

PropertyAlertsModifiersTypeDescription
textBetastring
typeBetareadonly

Methods

MethodAlertsReturn TypeDescription
append(segment)Betavoid
canAppend(segment)Betaboolean
clone(start, end)BetaTextSegment
createSplitSegmentAt(pos)BetaTextSegment | undefined
toJSONObject()BetaIJSONTextSegment | string
toString()Betastring

Constructor Details

(constructor)

Constructs a new instance of the TextSegment class

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

constructor(text: string, props?: PropertySet);

Parameters

ParameterModifiersTypeDescription
textstring
propsoptionalPropertySet

Property Details

text

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

text: string;

Type: string

type

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

readonly type = "TextSegment";

type

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

static readonly type = "TextSegment";

Method Details

append

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

append(segment: ISegment): void;

Parameters

ParameterTypeDescription
segmentISegment

canAppend

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

canAppend(segment: ISegment): boolean;

Parameters

ParameterTypeDescription
segmentISegment

Returns

Return type: boolean

clone

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

clone(start?: number, end?: number): TextSegment;

Parameters

ParameterModifiersTypeDescription
startoptionalnumber
endoptionalnumber

Returns

Return type: TextSegment

createSplitSegmentAt

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

protected createSplitSegmentAt(pos: number): TextSegment | undefined;

Parameters

ParameterTypeDescription
posnumber

Returns

Return type: TextSegment | undefined

fromJSONObject

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

static fromJSONObject(spec: string | IJSONSegment): TextSegment | undefined;

Parameters

ParameterTypeDescription
specstring | IJSONSegment

Returns

Return type: TextSegment | undefined

is

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

static is(segment: ISegment): segment is TextSegment;

Parameters

ParameterTypeDescription
segmentISegment

Returns

Return type: segment is TextSegment

make

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

static make(text: string, props?: PropertySet): TextSegment;

Parameters

ParameterModifiersTypeDescription
textstring
propsoptionalPropertySet

Returns

Return type: TextSegment

toJSONObject

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

toJSONObject(): IJSONTextSegment | string;

Returns

Return type: IJSONTextSegment | string

toString

This API is provided for existing users, but is not recommended for new users.

For more information about our API support guarantees, see here.

Signature

toString(): string;

Returns

Return type: string