BlockSuite API Documentation / @blocksuite/store / Text
Class: Text
Constructors
new Text()
new Text(
input
?):Text
Parameters
• input?: string
| Text
| DeltaInsert
[]
Returns
Source
packages/framework/store/src/reactive/text.ts:25
Properties
_yText
private
readonly
_yText:Text
Source
packages/framework/store/src/reactive/text.ts:23
Accessors
length
get
length():number
Returns
number
Source
packages/framework/store/src/reactive/text.ts:15
yText
get
yText():Text
Returns
Source
packages/framework/store/src/reactive/text.ts:19
Methods
_transact()
private
_transact(callback
):void
Parameters
• callback
Returns
void
Source
packages/framework/store/src/reactive/text.ts:45
applyDelta()
applyDelta(
delta
):void
Parameters
• delta: DeltaOperation
[]
Returns
void
Source
packages/framework/store/src/reactive/text.ts:225
clear()
clear():
void
Returns
void
Source
packages/framework/store/src/reactive/text.ts:216
clone()
clone():
Text
Returns
Source
packages/framework/store/src/reactive/text.ts:57
delete()
delete(
index
,length
):void
Parameters
• index: number
• length: number
Returns
void
Source
packages/framework/store/src/reactive/text.ts:174
format()
format(
index
,length
,format
):void
Parameters
• index: number
• length: number
• format: any
Returns
void
Source
packages/framework/store/src/reactive/text.ts:155
insert()
insert(
content
,index
,attributes
?):void
Parameters
• content: string
• index: number
• attributes?: Record
<string
, unknown
>
Returns
void
Source
packages/framework/store/src/reactive/text.ts:123
join()
join(
other
):void
Parameters
• other: Text
Returns
void
Source
packages/framework/store/src/reactive/text.ts:142
replace()
replace(
index
,length
,content
,attributes
?):void
Parameters
• index: number
• length: number
• content: string
• attributes?
• 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/framework/store/src/reactive/text.ts:193
sliceToDelta()
sliceToDelta(
begin
,end
?):DeltaOperation
[]
Parameters
• begin: number
• end?: number
Returns
Source
packages/framework/store/src/reactive/text.ts:235
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/framework/store/src/reactive/text.ts:76
toDelta()
toDelta():
DeltaOperation
[]
Returns
Source
packages/framework/store/src/reactive/text.ts:231
toString()
toString():
string
Returns
string
Source
packages/framework/store/src/reactive/text.ts:289
fromDelta()
static
fromDelta(delta
):Text
Parameters
• delta: DeltaOperation
[]
Returns
Source
packages/framework/store/src/reactive/text.ts:293