YText

Classes

ItemTextListPosition

YText

YTextEvent

Members

static, constant cleanupYTextFormatting

This function is experimental and subject to change / be removed.

Ideally, we don't need this function at all. Formatting attributes should be cleaned up automatically after each change. This function iterates twice over the complete YText type and removes unnecessary formatting attributes. This is also helpful for testing.

This function won't be exported anymore as soon as there is confidence that the YText type works as intended.

static parent :Item

Methods

inner cleanupContextlessFormattingGap(transaction, item)

Parameters:
Name Type Description
transaction Transaction
item Item | null

inner cleanupFormattingGap(transaction, start, end, startAttributes, endAttributes) → {number}

Call this function after string content has been deleted in order to clean up formatting Items.

Parameters:
Name Type Description
transaction Transaction
start Item
end Item | null

exclusive end, automatically iterates to the next Content Item

startAttributes Map.<string, any>
endAttributes Map.<string, any>

This attribute is modified!

Returns:
number -

The amount of formatting Items deleted.

inner equalAttrs(a, b) → {boolean}

Parameters:
Name Type Description
a any
b any
Returns:
boolean

Type Definitions

DeltaItem

Properties:
Name Type Description
DeltaItem.delete number | undefined
DeltaItem.retain number | undefined
DeltaItem.insert string | undefined
DeltaItem.attributes Object.<string, any>

TextAttributes

Attributes that can be assigned to a selection of text.

Example
{
    bold: true,
    font-size: '40px'
  }