@univerjscoreclassesTextx

@univerjs/core v0.5.0-beta.1Docs


Class: TextX

Constructors

new TextX()

new TextX(): TextX

Returns

TextX

Properties

PropertyModifierTypeDefault valueDefined in
idstaticstring'text-x'packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:36
uristaticstring'https://github.com/dream-num/univer#text-x'packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:38

Methods

delete()

delete(len): this

Parameters

ParameterType
lennumber

Returns

this

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:323


empty()

empty(): this

Returns

this

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:334


insert()

insert(len, body): this

Parameters

ParameterType
lennumber
bodyIDocumentBody

Returns

this

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:293


push()

push(...args): this

Parameters

ParameterType
argsTextXAction[]

Returns

this

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:344


retain()

retain(
   len, 
   body?, 
   coverType?): this

Parameters

ParameterType
lennumber
body?IDocumentBody
coverType?UpdateDocsAttributeType

Returns

this

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:304


serialize()

serialize(): TextXAction[]

Returns

TextXAction[]

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:339


trimEndUselessRetainAction()

protected trimEndUselessRetainAction(): this

Returns

this

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:409


_transform()

static _transform(
   thisActions, 
   otherActions, 
   priority): TextXAction[]

Parameters

ParameterTypeDefault value
thisActionsTextXAction[]undefined
otherActionsTextXAction[]undefined
priorityTPriority'right'

Returns

TextXAction[]

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:135


apply()

static apply(doc, actions): IDocumentBody

Parameters

ParameterType
docIDocumentBody
actionsTextXAction[]

Returns

IDocumentBody

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:40


compose()

static compose(thisActions, otherActions): TextXAction[]

Parameters

ParameterType
thisActionsTextXAction[]
otherActionsTextXAction[]

Returns

TextXAction[]

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:45


invert()

static invert(actions): TextXAction[]

Parameters

ParameterType
actionsTextXAction[]

Returns

TextXAction[]

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:217


isNoop()

static isNoop(actions): boolean

Parameters

ParameterType
actionsTextXAction[]

Returns

boolean

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:213


makeInvertible()

static makeInvertible(actions, doc): TextXAction[]

Parameters

ParameterType
actionsTextXAction[]
docIDocumentBody

Returns

TextXAction[]

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:259


transform()

static transform(
   thisActions, 
   otherActions, 
   priority): TextXAction[]
(this↓ | other→)insertretaindelete
insertCase 1Case 2Case 2
retainCase 1Case 5Case 4
deleteCase 1Case 3Case 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

ParameterTypeDefault value
thisActionsTextXAction[]undefined
otherActionsTextXAction[]undefined
priorityTPriority'right'

Returns

TextXAction[]

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:130


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

ParameterTypeDefault value
thisActionsTextXAction[]undefined
indexnumberundefined
prioritybooleanfalse

Returns

number

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/docs/data-model/text-x/text-x.ts:191