@univerjs/core v0.4.2 • Docs
Class: TextX
Constructors
new TextX()
new TextX(): TextX
Returns
Properties
Property | Modifier | Type | Default value | Defined in |
---|---|---|---|---|
id | static | string | 'text-x' | submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:35 (opens in a new tab) |
uri | static | string | 'https://github.com/dream-num/univer#text-x' | submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:37 (opens in a new tab) |
Methods
delete()
delete(len): this
Parameters
Parameter | Type |
---|---|
len | number |
Returns
this
Defined in
submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:311 (opens in a new tab)
empty()
empty(): this
Returns
this
Defined in
submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:322 (opens in a new tab)
insert()
insert(len, body): this
Parameters
Parameter | Type |
---|---|
len | number |
body | IDocumentBody |
Returns
this
Defined in
submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:281 (opens in a new tab)
push()
push(...args): this
Parameters
Parameter | Type |
---|---|
...args | TextXAction [] |
Returns
this
Defined in
submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:332 (opens in a new tab)
retain()
retain(
len,
body?,
coverType?): this
Parameters
Parameter | Type |
---|---|
len | number |
body ? | IDocumentBody |
coverType ? | UpdateDocsAttributeType |
Returns
this
Defined in
submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:292 (opens in a new tab)
serialize()
serialize(): TextXAction[]
Returns
Defined in
submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:327 (opens in a new tab)
trimEndUselessRetainAction()
protected trimEndUselessRetainAction(): this
Returns
this
Defined in
submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:397 (opens in a new tab)
_transform()
static _transform(
thisActions,
otherActions,
priority): TextXAction[]
Parameters
Parameter | Type | Default value |
---|---|---|
thisActions | TextXAction [] | undefined |
otherActions | TextXAction [] | undefined |
priority | TPriority | 'right' |
Returns
Defined in
submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:126 (opens in a new tab)
apply()
static apply(doc, actions): IDocumentBody
Parameters
Parameter | Type |
---|---|
doc | IDocumentBody |
actions | TextXAction [] |
Returns
Defined in
submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:39 (opens in a new tab)
compose()
static compose(thisActions, otherActions): TextXAction[]
Parameters
Parameter | Type |
---|---|
thisActions | TextXAction [] |
otherActions | TextXAction [] |
Returns
Defined in
submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:43 (opens in a new tab)
invert()
static invert(actions): TextXAction[]
Parameters
Parameter | Type |
---|---|
actions | TextXAction [] |
Returns
Defined in
submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:205 (opens in a new tab)
isNoop()
static isNoop(actions): boolean
Parameters
Parameter | Type |
---|---|
actions | TextXAction [] |
Returns
boolean
Defined in
submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:201 (opens in a new tab)
makeInvertible()
static makeInvertible(actions, doc): TextXAction[]
Parameters
Parameter | Type |
---|---|
actions | TextXAction [] |
doc | IDocumentBody |
Returns
Defined in
submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:247 (opens in a new tab)
transform()
static transform(
thisActions,
otherActions,
priority): TextXAction[]
(this↓ | other→) | insert | retain | delete |
---|---|---|---|
insert | Case 1 | Case 2 | Case 2 |
retain | Case 1 | Case 5 | Case 4 |
delete | Case 1 | Case 3 | Case 3 |
Case 1: When the other action type is an insert operation, the insert operation is retained regardless of the type of action this action Case 2: When this action type is an insert operation and the other action type is a non-insert operation, you need to retain the length of this action insert Case 3: When this action is a delete operation, there are two scenarios: 1) When other is a delete operation, since it is a delete operation, this has already been deleted, so the target does not need to be in delete, and it can be continued directly 2) When other is the retain operation, although this action delete occurs first, the delete priority is higher, so the delete operation is retained, and the origin delete has been applied, so it is directly continued Case 4: other is the delete operation, this is the retain operation, and the target delete operation is kept Case 5: When both other and this are retain operations 1) If the other body attribute does not exist, directly retain length 2) If the other body property exists, then execute the TransformBody logic to override it
Parameters
Parameter | Type | Default value |
---|---|---|
thisActions | TextXAction [] | undefined |
otherActions | TextXAction [] | undefined |
priority | TPriority | 'right' |
Returns
Defined in
submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:122 (opens in a new tab)
transformPosition()
static transformPosition(
thisActions,
index,
priority): number
Used to transform selection. Why not named transformSelection? Because Univer Doc supports multiple Selections in one document, user need to encapsulate transformSelections at the application layer.
Parameters
Parameter | Type | Default value |
---|---|---|
thisActions | TextXAction [] | undefined |
index | number | undefined |
priority | boolean | false |
Returns
number
Defined in
submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:179 (opens in a new tab)