BlockSuite API Documentation / @blocksuite/store / Text
Class: Text
Constructors
new Text(input)
new Text(
input
?):Text
Parameters
• input?: string
| Text
| DeltaInsert
[]
Returns
Source
packages/framework/store/src/reactive/text.ts:19
Properties
_yText
private
readonly
_yText:Text
Source
packages/framework/store/src/reactive/text.ts:17
Accessors
length
get
length():number
Returns
number
Source
packages/framework/store/src/reactive/text.ts:45
yText
get
yText():Text
Returns
Source
packages/framework/store/src/reactive/text.ts:49
Methods
_transact()
private
_transact(callback
):void
Parameters
• callback
Returns
void
Source
packages/framework/store/src/reactive/text.ts:53
applyDelta()
applyDelta(
delta
):void
Parameters
• delta: DeltaOperation
[]
Returns
void
Source
packages/framework/store/src/reactive/text.ts:233
clear()
clear():
void
Returns
void
Source
packages/framework/store/src/reactive/text.ts:224
clone()
clone():
Text
Returns
Source
packages/framework/store/src/reactive/text.ts:65
delete()
delete(
index
,length
):void
Parameters
• index: number
• length: number
Returns
void
Source
packages/framework/store/src/reactive/text.ts:182
format()
format(
index
,length
,format
):void
Parameters
• index: number
• length: number
• format: any
Returns
void
Source
packages/framework/store/src/reactive/text.ts:163
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:131
join()
join(
other
):void
Parameters
• other: Text
Returns
void
Source
packages/framework/store/src/reactive/text.ts:150
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:201
sliceToDelta()
sliceToDelta(
begin
,end
?):DeltaOperation
[]
Parameters
• begin: number
• end?: number
Returns
Source
packages/framework/store/src/reactive/text.ts:243
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:84
toDelta()
toDelta():
DeltaOperation
[]
Returns
Source
packages/framework/store/src/reactive/text.ts:239
toString()
toString():
string
Returns
string
Source
packages/framework/store/src/reactive/text.ts:297
fromDelta()
static
fromDelta(delta
):Text
Parameters
• delta: DeltaOperation
[]
Returns
Source
packages/framework/store/src/reactive/text.ts:39