BlockSuite API Documentation / @blocksuite/store / Text
Class: Text ​
Contents ​
Constructors ​
new Text(input) ​
new Text(
input
?):Text
Parameters ​
• input?: string
| Text
Returns ​
Source ​
packages/store/src/reactive/text.ts:19
Properties ​
_yText ​
private
readonly
_yText:Text
Source ​
packages/store/src/reactive/text.ts:17
Accessors ​
length ​
get
length():number
Returns ​
number
Source ​
packages/store/src/reactive/text.ts:35
yText ​
get
yText():Text
Returns ​
Source ​
packages/store/src/reactive/text.ts:39
Methods ​
_transact() ​
private
_transact(callback
):void
Parameters ​
• callback: () => void
Returns ​
void
Source ​
packages/store/src/reactive/text.ts:43
applyDelta() ​
applyDelta(
delta
):void
Parameters ​
• delta: DeltaOperation
[]
Returns ​
void
Source ​
packages/store/src/reactive/text.ts:242
clear() ​
clear():
void
Returns ​
void
Source ​
packages/store/src/reactive/text.ts:233
clone() ​
clone():
Text
Returns ​
Source ​
packages/store/src/reactive/text.ts:55
delete() ​
delete(
index
,length
):void
Parameters ​
• index: number
• length: number
Returns ​
void
Source ​
packages/store/src/reactive/text.ts:191
format() ​
format(
index
,length
,format
):void
Parameters ​
• index: number
• length: number
• format: any
Returns ​
void
Source ​
packages/store/src/reactive/text.ts:172
insert() ​
insert(
content
,index
,attributes
?):void
Parameters ​
• content: string
• index: number
• attributes?: Record
<string
, unknown
>
Returns ​
void
Source ​
packages/store/src/reactive/text.ts:121
insertList() ​
insertList(
insertTexts
,index
):void
Parameters ​
• insertTexts: DeltaOperation
[]
• index: number
Returns ​
void
Deprecated ​
Use insert or applyDelta instead.
Source ​
packages/store/src/reactive/text.ts:143
join() ​
join(
other
):void
Parameters ​
• other: Text
Returns ​
void
Source ​
packages/store/src/reactive/text.ts:159
replace() ​
replace(
index
,length
,content
,attributes
?):void
Parameters ​
• index: number
• length: number
• content: string
• attributes?: Object
• attributes.bold?: null
| true
• attributes.code?: null
| true
• attributes.italic?: null
| true
• attributes.link?: null
| string
• attributes.strike?: null
| true
• attributes.underline?: null
| true
Returns ​
void
Source ​
packages/store/src/reactive/text.ts:210
sliceToDelta() ​
sliceToDelta(
begin
,end
?):DeltaOperation
[]
Parameters ​
• begin: number
• end?: number
Returns ​
Source ​
packages/store/src/reactive/text.ts:252
split() ​
split(
index
,length
):Text
NOTE: The string included in [index, index + length) will be deleted.
Here are three cases for point position(index + length): [{insert: 'abc', ...}, {insert: 'def', ...}, {insert: 'ghi', ...}]
- abc|de|fghi left: [{insert: 'abc', ...}] right: [{insert: 'f', ...}, {insert: 'ghi', ...}]
- abc|def|ghi left: [{insert: 'abc', ...}] right: [{insert: 'ghi', ...}]
- abc|defg|hi left: [{insert: 'abc', ...}] right: [{insert: 'hi', ...}]
Parameters ​
• index: number
• length: number
= 0
Returns ​
Source ​
packages/store/src/reactive/text.ts:74
toDelta() ​
toDelta():
DeltaOperation
[]
Returns ​
Source ​
packages/store/src/reactive/text.ts:248
toString() ​
toString():
string
Returns ​
string
Source ​
packages/store/src/reactive/text.ts:302
fromDelta() ​
static
fromDelta(delta
):Text
Parameters ​
• delta: DeltaOperation
[]
Returns ​
Source ​
packages/store/src/reactive/text.ts:29
Generated using typedoc-plugin-markdown and TypeDoc