TextSegment Class
Signature
export declare class TextSegment extends BaseSegment
Extends: BaseSegment
Constructors
| Constructor | Description |
|---|---|
| (constructor)(text) | Constructs a new instance of the TextSegment class |
Static Properties
| Property | Type | Description |
|---|---|---|
| type |
Static Methods
| Method | Return Type | Description |
|---|---|---|
| fromJSONObject(spec) | TextSegment | undefined | |
| is(segment) | segment is TextSegment | |
| make(text, props) | TextSegment |
Properties
| Property | Type | Description |
|---|---|---|
| text | string | |
| type |
Methods
| Method | Return Type | Description |
|---|---|---|
| append(segment) | void | |
| canAppend(segment) | boolean | |
| clone(start, end) | TextSegment | |
| createSplitSegmentAt(pos) | TextSegment | undefined | |
| removeRange(start, end) | boolean | |
| toJSONObject() | string | { text: string; props: PropertySet; } | |
| toString() | string |
Constructor Details
(constructor)
Constructs a new instance of the TextSegment class
Signature
constructor(text: string);
Parameters
| Parameter | Type | Description |
|---|---|---|
| text | string |
Property Details
text
Signature
text: string;
Type: string
type
Signature
readonly type = "TextSegment";
type
Signature
static readonly type = "TextSegment";
Method Details
append
Signature
append(segment: ISegment): void;
Parameters
| Parameter | Type | Description |
|---|---|---|
| segment | ISegment |
canAppend
Signature
canAppend(segment: ISegment): boolean;
Parameters
| Parameter | Type | Description |
|---|---|---|
| segment | ISegment |
Returns
Return type: boolean
clone
Signature
clone(start?: number, end?: number): TextSegment;
Parameters
| Parameter | Modifiers | Type | Description |
|---|---|---|---|
| start | optional | number | |
| end | optional | number |
Returns
Return type: TextSegment
createSplitSegmentAt
Signature
protected createSplitSegmentAt(pos: number): TextSegment | undefined;
Parameters
| Parameter | Type | Description |
|---|---|---|
| pos | number |
Returns
Return type: TextSegment | undefined
fromJSONObject
Signature
static fromJSONObject(spec: any): TextSegment | undefined;