Extends
Constructor
new ve.ui.TableAction(surface, [source])
#
Hierarchy
Table action.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
surface |
ve.ui.Surface | Surface to act on |
|
source |
string |
optional |
Methods
changeCellStyle(style) → {boolean}
#
Change cell style
Parameters:
Name | Type | Description |
---|---|---|
style |
string | Cell style; 'header' or 'data' |
Returns:
Action was executed
- Type
- boolean
create([options]) → {boolean}
#
Creates a new table.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
optional |
Table creation options Properties:
|
Returns:
Action was executed
- Type
- boolean
decrementSpan(cell, mode, minIndex, maxIndex) → {function}
#
Decreases the span of a cell so that the given interval is removed.
Parameters:
Name | Type | Description |
---|---|---|
cell |
ve.dm.TableMatrixCell | Table matrix cell |
mode |
string | Span to decrement 'row' or 'col' |
minIndex |
number | Smallest row or column index (inclusive) |
maxIndex |
number | Largest row or column index (inclusive) |
Returns:
Zero-argument function returning a ve.dm
.Transaction
- Type
- function
delete(mode) → {boolean}
#
Deletes selected rows, columns, or the whole table.
Parameters:
Name | Type | Description |
---|---|---|
mode |
string | Deletion mode; 'row' to delete rows, 'col' for columns, 'table' to remove the whole table |
Returns:
Action was executed
- Type
- boolean
deleteRowsOrColumns(matrix, mode, minIndex, maxIndex) → {Array.<Object>}
#
Deletes rows or columns within a given range.
e.g. rows 2-4 can be deleted using
ve.ui.TableAction.deleteRowsOrColumns( matrix, 'row', 1, 3 );
Parameters:
Name | Type | Description |
---|---|---|
matrix |
ve.dm.TableMatrix | Table matrix |
mode |
string | 'row' or 'col' |
minIndex |
number | Smallest row or column index to be deleted |
maxIndex |
number | Largest row or column index to be deleted (inclusive) |
Returns:
Plain sub-matrix of items removed. In column mode this matrix is transposed.
deleteTable(tableNode)
#
enterTableCell() → {boolean}
#
Enter a table cell for editing
Returns:
Action was executed
- Type
- boolean
exitTableCell() → {boolean}
#
Exit a table cell for table-structure-editing
Returns:
Action was executed
- Type
- boolean
findClosestTableNode() → {ve.dm.TableNode|null
}
#
null
}
#
Find the closest table node to the current selection
This method is model-only.
Returns:
The closest table node, null if not found
- Type
-
ve.dm.TableNode
|
null
Find the closest table node to the current selection
This method is model-only.
findClosestTableViewNode() → {ve.ce.TableNode|null
}
#
null
}
#
Find the closest table view node to the current selection
Returns:
The closest table view, null if not found
- Type
-
ve.ce.TableNode
|
null
getTableSelectionFromSelection() → {ve.dm.TableSelection|null
}
#
null
}
#
Get a TableSelection that contains the current selection
This method is model-only.
Returns:
The closest TableSelection, null if not found
- Type
-
ve.dm.TableSelection
|
null
Get a TableSelection that contains the current selection
This method is model-only.
importTable(importedTableNode, importInternalList) → {boolean}
#
Import a table at the current selection, overwriting data cell by cell
Parameters:
Name | Type | Description |
---|---|---|
importedTableNode |
ve.dm.TableNode | Table node to import |
importInternalList |
boolean | Import the table document's internalLiist |
Returns:
Action was executed
- Type
- boolean
incrementSpan(cell, mode) → {function}
#
Increase the span of a cell by one.
Parameters:
Name | Type | Description |
---|---|---|
cell |
ve.dm.TableMatrixCell | Table matrix cell |
mode |
string | Span to increment; 'row' or 'col' |
Returns:
Zero-argument function returning a ve.dm
.Transaction
- Type
- function
insert(mode, position) → {boolean}
#
Inserts a new row or column into the currently focused table.
Parameters:
Name | Type | Description |
---|---|---|
mode |
string | Insertion mode; 'row' to insert a new row, 'col' for a new column |
position |
string | Insertion position; 'before' to insert before the current selection, 'after' to insert after it |
Returns:
Action was executed
- Type
- boolean
insertRowOrCol(tableNode, mode, index, position, [selection], [dataMatrixLine])
#
Inserts a new row or column.
Example: a new row can be inserted after the 2nd row using
insertRowOrCol( table, 'row', 1, 'after' );
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tableNode |
ve.dm.TableNode | Table node |
|||||||||||||
mode |
string | Insertion mode; 'row' or 'col' |
|||||||||||||
index |
number | Row or column index of the base row or column. |
|||||||||||||
position |
string | Insertion position; 'before' or 'after' |
|||||||||||||
selection |
ve.dm.TableSelection |
optional |
Selection to move to after insertion |
||||||||||||
dataMatrixLine |
Object |
optional |
Data to insert Properties:
|
mergeCells() → {boolean}
#
Merge multiple cells into one, or split a merged cell.
Returns:
Action was executed
- Type
- boolean
move(mode, index) → {boolean}
#
Move a column or row.
Parameters:
Name | Type | Description |
---|---|---|
mode |
string | Move mode; 'col' or 'row' |
index |
number | Row or column index to move to |
Returns:
Action was executed
- Type
- boolean
moveRelative(mode, direction) → {boolean}
#
Move a column or row relative to its current position
Parameters:
Name | Type | Description |
---|---|---|
mode |
string | Move mode; 'col' or 'row' |
direction |
string | Direction; 'before' or 'after' |
Returns:
Action was executed
- Type
- boolean
replacePlaceholder(matrix, placeholder, [options]) → {function}
#
Inserts a new cell for an orphaned placeholder.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
matrix |
ve.dm.TableMatrix | Table matrix |
|
placeholder |
ve.dm.TableMatrixCell | Placeholder cell to replace |
|
options |
Object |
optional |
Options to pass to |
Returns:
Zero-argument function returning a ve.dm
.Transaction
- Type
- function
unmergeCell(matrix, ownerCell)
#
Unmerge a cell
Parameters:
Name | Type | Description |
---|---|---|
matrix |
ve.dm.TableMatrix | Table matrix the cell is in |
ownerCell |
ve.dm.TableMatrixCell | The cell to unmerge |