Expand all

ve.dm.TableSelection

Extends

Constructor

new ve.dm.TableSelection(tableRange, fromCol, fromRow, [toCol], [toRow]) #

Parameters:

Name Type Attributes Description
tableRange ve.Range

Table range

fromCol number

Starting column

fromRow number

Starting row

toCol number optional

End column

toRow number optional

End row

Source:

Properties

collapseToEnd #

Get a new selection at the end point of this one

Overrides:
Source:
Get a new selection at the end point of this one

collapseToFrom #

Get a new selection at the 'from' point of this one

Overrides:
Source:
Get a new selection at the 'from' point of this one

collapseToStart #

Get a new selection at the start point of this one

Overrides:
Source:
Get a new selection at the start point of this one

collapseToTo #

Get a new selection at the 'to' point of this one

Overrides:
Source:
Get a new selection at the 'to' point of this one

equals #

Check if two selections are equal

Overrides:
Source:
Check if two selections are equal

getCoveringRange #

Get the covering linear range for this selection

Overrides:
Source:
Get the covering linear range for this selection

getDescription #

Get a textual description of this selection, for debugging purposes

Overrides:
Source:
Get a textual description of this selection, for debugging purposes

getRanges #

Get the content ranges for this selection

Overrides:
Source:
Get the content ranges for this selection

isCollapsed #

Check if a selection is collapsed

Overrides:
Source:
Check if a selection is collapsed

toJSON #

Get a JSON serialization of this selection

Overrides:
Source:
Get a JSON serialization of this selection

translateByTransaction #

Apply translations from a transaction

Overrides:
Source:
Apply translations from a transaction

translateByTransactionWithAuthor #

Apply translations from a transaction, with bias depending on author ID comparison

Overrides:
Source:
Apply translations from a transaction, with bias depending on author ID comparison

Methods

containsCell(cell) → {boolean} #

Check if a given cell is within this selection

Parameters:

Name Type Description
cell ve.dm.TableMatrixCell

Table matrix cell

Source:

Returns:

Cell is within this selection

Type
boolean
Check if a given cell is within this selection

expand(doc) → {ve.dm.TableSelection}private #

Expand the selection to cover all merged cells

Parameters:

Name Type Description
doc ve.dm.Document

The document to which this selection applies

Source:

Returns:

Expanded table selection

Type
ve.dm.TableSelection
Expand the selection to cover all merged cells

getColCount() → {number} #

Get the number of columns covered by the selection

Source:

Returns:

Number of columns covered

Type
number
Get the number of columns covered by the selection

getMatrixCells(doc, [includePlaceholders]) → {Array.<ve.dm.TableMatrixCell>} #

Retrieves all cells within a given selection.

Parameters:

Name Type Attributes Description
doc ve.dm.Document

The document to which this selection applies

includePlaceholders boolean optional

Include placeholders in result

Source:

Returns:

List of table cells

Type
Array.<ve.dm.TableMatrixCell>
Retrieves all cells within a given selection.

getName() → {string} #

Get the name of the selection type

Inherited from:
Source:

Returns:

Selection type name

Type
string
Get the name of the selection type

getOuterRanges(doc) → {Array.<ve.Range>} #

Get outer ranges of the selected cells

Parameters:

Name Type Description
doc ve.dm.Document

The document to which this selection applies

Source:

Returns:

Outer ranges

Type
Array.<ve.Range>
Get outer ranges of the selected cells

getRowCount() → {number} #

Get the number of rows covered by the selection

Source:

Returns:

Number of rows covered

Type
number
Get the number of rows covered by the selection

getTableNode(doc) → {ve.dm.TableNode} #

Get the selection's table node

Parameters:

Name Type Description
doc ve.dm.Document

The document to which this selection applies

Source:

Returns:

Table node

Type
ve.dm.TableNode
Get the selection's table node

getTableSliceRanges(doc) → {Array.<ve.Range>} #

Get all the ranges required to build a table slice from the selection

In addition to the outer ranges of the cells, this also includes the start and end tags of table rows, sections and the table itself.

Parameters:

Name Type Description
doc ve.dm.Document

The document to which this selection applies

Source:

Returns:

Ranges

Type
Array.<ve.Range>

Get all the ranges required to build a table slice from the selection

In addition to the outer ranges of the cells, this also includes the start and end tags of table rows, sections and the table itself.

isEditable(doc) → {boolean} #

Check the selected cells are all editable

Parameters:

Name Type Description
doc ve.dm.Document

The document to which this selection applies

Source:

Returns:

Cells are all editable

Type
boolean
Check the selected cells are all editable

isFullCol(doc) → {boolean} #

Check if the table selection covers one or more full columns

Parameters:

Name Type Description
doc ve.dm.Document

The document to which this selection applies

Source:

Returns:

The table selection covers one or more full columns

Type
boolean
Check if the table selection covers one or more full columns

isFullRow(doc) → {boolean} #

Check if the table selection covers one or more full rows

Parameters:

Name Type Description
doc ve.dm.Document

The document to which this selection applies

Source:

Returns:

The table selection covers one or more full rows

Type
boolean
Check if the table selection covers one or more full rows

isMergeable(doc) → {boolean} #

Check if the selection is mergeable or unmergeable

The selection must span more than one matrix cell, but only one table section.

Parameters:

Name Type Description
doc ve.dm.Document

The document to which this selection applies

Source:

Returns:

The selection is mergeable or unmergeable

Type
boolean

Check if the selection is mergeable or unmergeable

The selection must span more than one matrix cell, but only one table section.

isNull() → {boolean} #

Check if this selection is null

Inherited from:
Source:

Returns:

The selection is null

Type
boolean
Check if this selection is null

isSingleCell(doc) → {boolean} #

Check if the selection spans a single cell

Parameters:

Name Type Description
doc ve.dm.Document

The document to which this selection applies

Source:

Returns:

The selection spans a single cell

Type
boolean
Check if the selection spans a single cell

newFromAdjustment(doc, fromColOffset, fromRowOffset, [toColOffset], [toRowOffset], [wrap]) → {ve.dm.TableSelection} #

Get a new selection with adjusted row and column positions

Placeholder cells are skipped over so this method can be used for cursoring.

Parameters:

Name Type Attributes Description
doc ve.dm.Document

The document to which this selection applies

fromColOffset number

Starting column offset

fromRowOffset number

Starting row offset

toColOffset number optional

End column offset

toRowOffset number optional

End row offset

wrap number optional

Wrap to the next/previous row if column limits are exceeded

Source:

Returns:

Adjusted selection

Type
ve.dm.TableSelection

Get a new selection with adjusted row and column positions

Placeholder cells are skipped over so this method can be used for cursoring.

translateByChange(change, authorId) → {ve.dm.Selection} #

Apply translations from a change

Parameters:

Name Type Description
change ve.dm.Change
authorId number

The author ID of this selection

Inherited from:
Source:

Returns:

A new translated selection

Type
ve.dm.Selection
Apply translations from a change

translateByTransactions(txs, [excludeInsertion]) → {ve.dm.Selection} #

Apply translations from a set of transactions

Parameters:

Name Type Attributes Description
txs Array.<ve.dm.Transaction>

Transactions

excludeInsertion boolean optional

Do not grow to cover insertions at boundaries

Inherited from:
Source:

Returns:

A new translated selection

Type
ve.dm.Selection
Apply translations from a set of transactions

getTableMatrixCells(matrix, selectionOffsets, [includePlaceholders]) → {Array.<ve.dm.TableMatrixCell>}static #

Retrieves all cells within a given selection.

Parameters:

Name Type Attributes Description
matrix ve.dm.TableMatrix

The table matrix

selectionOffsets Object

Selection col/row offsets (startRow/endRow/startCol/endCol)

includePlaceholders boolean optional

Include placeholders in result

Source:

Returns:

List of table cells

Type
Array.<ve.dm.TableMatrixCell>
Retrieves all cells within a given selection.

newFromHash()static #