Home Reference Source Test
import {TableEditor} from '@susisu/mte-kernel'
public class | source

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

Checks if the cursor is in a table row.

public

Deletes a column at the current focus.

public

Deletes a row at the current focus.

public

escape(options: Object): undefined

Formats and escapes from the table.

public

format(options: Object): undefined

Formats the table under the cursor.

public

Formats all the tables in the text editor.

public

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

moveFocus(rowOffset: number, columnOffset: number, options: Object): undefined

Moves the focus to another cell.

public

moveRow(offset: number, options: Object): undefined

Moves the focused row by the specified offset.

public

Moves the focus to the next cell.

public

nextRow(options: Object): undefined

Moves the focus to the next row.

public

Moves the focus to the previous cell.

public

Resets the smart cursor.

public

Selects the focused cell content.

Public Constructors

public constructor(textEditor: ITextEditor) source

Creates a new table editor instance.

Params:

NameTypeAttributeDescription
textEditor ITextEditor

A text editor interface.

Test:

Public Methods

public alignColumn(alignment: Alignment, options: Object): undefined source

Alters the alignment of the focused column.

Params:

NameTypeAttributeDescription
alignment Alignment

New alignment.

options Object

See options.

Return:

undefined

Test:

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.

Params:

NameTypeAttributeDescription
options Object

See options.

Return:

boolean

true if the cursor is in a table row.

Test:

public deleteColumn(options: Object): undefined source

Deletes a column at the current focus.

Params:

NameTypeAttributeDescription
options Object

See options.

Return:

undefined

Test:

public deleteRow(options: Object): undefined source

Deletes a row at the current focus.

Params:

NameTypeAttributeDescription
options Object

See options.

Return:

undefined

Test:

public escape(options: Object): undefined source

Formats and escapes from the table.

Params:

NameTypeAttributeDescription
options Object

See options.

Return:

undefined

Test:

public format(options: Object): undefined source

Formats the table under the cursor.

Params:

NameTypeAttributeDescription
options Object

See options.

Return:

undefined

Test:

public formatAll(options: Object): undefined source

Formats all the tables in the text editor.

Params:

NameTypeAttributeDescription
options Object

See options.

Return:

undefined

Test:

public insertColumn(options: Object): undefined source

Inserts an empty column at the current focus.

Params:

NameTypeAttributeDescription
options Object

See options.

Return:

undefined

Test:

public insertRow(options: Object): undefined source

Inserts an empty row at the current focus.

Params:

NameTypeAttributeDescription
options Object

See options.

Return:

undefined

Test:

public moveColumn(offset: number, options: Object): undefined source

Moves the focused column by the specified offset.

Params:

NameTypeAttributeDescription
offset number

An offset the column is moved by.

options Object

See options.

Return:

undefined

Test:

public moveFocus(rowOffset: number, columnOffset: number, options: Object): undefined source

Moves the focus to another cell.

Params:

NameTypeAttributeDescription
rowOffset number

Offset in row.

columnOffset number

Offset in column.

options Object

See options.

Return:

undefined

Test:

public moveRow(offset: number, options: Object): undefined source

Moves the focused row by the specified offset.

Params:

NameTypeAttributeDescription
offset number

An offset the row is moved by.

options Object

See options.

Return:

undefined

Test:

public nextCell(options: Object): undefined source

Moves the focus to the next cell.

Params:

NameTypeAttributeDescription
options Object

See options.

Return:

undefined

Test:

public nextRow(options: Object): undefined source

Moves the focus to the next row.

Params:

NameTypeAttributeDescription
options Object

See options.

Return:

undefined

Test:

public previousCell(options: Object): undefined source

Moves the focus to the previous cell.

Params:

NameTypeAttributeDescription
options Object

See options.

Return:

undefined

Test:

public resetSmartCursor(): undefined source

Resets the smart cursor. Call this method when the table editor is inactivated.

Return:

undefined

Test:

public selectCell(options: Object): undefined source

Selects the focused cell content.

Params:

NameTypeAttributeDescription
options Object

See options.

Return:

undefined

Test: