TableEditor
The TableEditor
class is at the center of the markdown-table-editor.
When a command is executed, it reads a table from the text editor, does some operation on the
table, and then apply the result to the text editor.
To use this class, the text editor (or an interface to it) must implement ITextEditor.
Test:
Constructor Summary
Public Constructor | ||
public |
constructor(textEditor: ITextEditor) Creates a new table editor instance. |
Method Summary
Public Methods | ||
public |
alignColumn(alignment: Alignment, options: Object): undefined Alters the alignment of the focused column. |
|
public |
cursorIsInTable(options: Object): boolean Checks if the cursor is in a table row. |
|
public |
deleteColumn(options: Object): undefined Deletes a column at the current focus. |
|
public |
Deletes a row at the current focus. |
|
public |
Formats and escapes from the table. |
|
public |
Formats the table under the cursor. |
|
public |
Formats all the tables in the text editor. |
|
public |
insertColumn(options: Object): undefined Inserts an empty column at the current focus. |
|
public |
Inserts an empty row at the current focus. |
|
public |
moveColumn(offset: number, options: Object): undefined Moves the focused column by the specified offset. |
|
public |
Moves the focus to another cell. |
|
public |
Moves the focused row by the specified offset. |
|
public |
Moves the focus to the next cell. |
|
public |
Moves the focus to the next row. |
|
public |
previousCell(options: Object): undefined Moves the focus to the previous cell. |
|
public |
Resets the smart cursor. |
|
public |
selectCell(options: Object): undefined Selects the focused cell content. |
Public Constructors
public constructor(textEditor: ITextEditor) source
Creates a new table editor instance.
Params:
Name | Type | Attribute | Description |
textEditor | ITextEditor | A text editor interface. |
Public Methods
public alignColumn(alignment: Alignment, options: Object): undefined source
Alters the alignment of the focused column.
public cursorIsInTable(options: Object): boolean source
Checks if the cursor is in a table row. This is useful to check whether the table editor should be activated or not.
public insertColumn(options: Object): undefined source
Inserts an empty column at the current focus.
public moveColumn(offset: number, options: Object): undefined source
Moves the focused column by the specified offset.
public moveFocus(rowOffset: number, columnOffset: number, options: Object): undefined source
Moves the focus to another cell.
public moveRow(offset: number, options: Object): undefined source
Moves the focused row by the specified offset.