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

Constructor Alerts Description
(constructor)(text, props) Beta Constructs a new instance of the TextSegment class

Static Properties

Property Alerts Modifiers Type Description
type Beta readonly

Static Methods

Method Alerts Return Type Description
fromJSONObject(spec) Beta TextSegment | undefined
is(segment) Beta segment is TextSegment
make(text, props) Beta TextSegment

Properties

Property Alerts Modifiers Type Description
text Beta string
type Beta readonly

Methods

Method Alerts Return Type Description
append(segment) Beta void
canAppend(segment) Beta boolean
clone(start, end) Beta TextSegment
createSplitSegmentAt(pos) Beta TextSegment | undefined
toJSONObject() Beta IJSONTextSegment | string
toString() Beta string

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

Parameter Modifiers Type Description
text string
props optional PropertySet

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

Parameter Type Description
segment ISegment

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

Parameter Type Description
segment ISegment

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

Parameter Modifiers Type Description
start optional number
end optional number

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

Parameter Type Description
pos number

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

Parameter Type Description
spec string | 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

Parameter Type Description
segment ISegment

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

Parameter Modifiers Type Description
text string
props optional PropertySet

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