TextSegment Class
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
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
For more information about our API support guarantees, see here.
Signature
text: string;
Type: string
type
For more information about our API support guarantees, see here.
Signature
readonly type = "TextSegment";
type
For more information about our API support guarantees, see here.
Signature
static readonly type = "TextSegment";
Method Details
append
For more information about our API support guarantees, see here.
Signature
append(segment: ISegment): void;
Parameters
| Parameter | Type | Description |
|---|---|---|
| segment | ISegment |
canAppend
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
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
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
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
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
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
For more information about our API support guarantees, see here.
Signature
toJSONObject(): IJSONTextSegment | string;
Returns
Return type: IJSONTextSegment | string
toString
For more information about our API support guarantees, see here.
Signature
toString(): string;
Returns
Return type: string