Wiki Table Editor API
Contents |
[edit]
API : Classes
[edit]
Class SimileWikiToolbox
Static methods
-
editTable(wikiTable, onDone, onCancel, row, column)shows a dialog box for editing the given wiki table. Ifrowandcolumnare provided, focus on that cell at the beginning.onDoneis a function that will be called when the user finishes editing and clicks OK (or Save or whatever);onCancelis called when the user cancels. -
editTableInText(text, cursor, onDone, onCancel)shows a dialog box for editing the wiki table surrounding the given cursor position. When the dialog box shows up, focus on the cell that corresponds to where the cursor is in the original text.onDoneis called with the resulting text when the user commits the edit;onCancelis called with no argument when the user cancels. -
createTable(text, cursor, onDone, onCancel)shows a dialog box for editing a new table. When the user commits, the new table gets turned into wikitext, and inserted back into the original text where the cursor was; thenonDoneis called with the resulting wikitext. If the user cancels,onCancelis called.
[edit]
Class SimileWikiToolbox.WikiTable
Static methods
-
createTable()returns an empty table in the form of aSimileWikiToolbox.WikiTableobject. -
findTable(text, cursor)returns an object with two fields:tableStartandtableEnd, which are character indices into thetextargument specifying where to find the beginning and ending of the table surroundingcursor. -
parseTable(text, cursor)parses the wikitext table encoded in the giventextreturns an object with three fields:-
table, an object of typenew SimileWikiToolbox.WikiTable(text) -
rowandcolumn, numbers identifying the cell that corresponds to wherecursorwas.
-
Constructor
-
new SimileWikiToolbox.WikiTable(text), wheretextis optional, returns aSimileWikiToolbox.WikiTableobject.
Methods
-
getRowCount()returns the number of rows. -
getColumnCount()returns the number of rows.
-
insertRow(index)inserts a row at the given index and returns the new row in the form of aSimileWikiToolbox.WikiTableRowobject. -
removeRow(index)removes the row at the given index. -
moveRow(fromIndex, toIndex)moves a row. -
getRow(rowIndex)returns the rowIndex'th row in the form of aSimileWikiToolbox.WikiTableRowobject.
-
insertColumn(index)inserts a column at the given index. -
removeColumn(index)removes the column at the given index. -
moveColumn(fromIndex, toIndex)moves a column. -
forEachCellInColumn(columnIndex, f)callsfon each cell in the given column.fis a function that takes aSimileWikiToolbox.WikiTableCellargument.
-
mergeCells(startRow, endRow, startColumn, endColumn)merges several cells together.
-
getSettings()returns the settings of the whole table in the form of aSimileWikiToolbox.WikiTableSettingsobject. -
toWikiTextreturns the wikitext serialization of this table.
[edit]
Class SimileWikiToolbox.WikiTableRow
Methods
-
isHeaderRow()returns true or false. -
getCellCount()returns the number of cells. -
getCell(cellIndex)returns the cellIndex'th cell in the form of aSimileWikiToolbox.WikiTableCellobject. -
getSettings()returns the settings of the row in the form of aSimileWikiToolbox.WikiTableRowSettingsobject. -
toWikiTextreturns the wikitext serialization of this row.
[edit]
Class SimileWikiToolbox.WikiTableCell
-
getContent()returns the text inside the cell. -
setContent(text)sets the text inside the cell.
-
getRowSpan()returns the number of rows this cell spans. -
getColumnSpan()returns the number of columns this cell spans.
-
getSettings()returns the settings of the cell in the form of aSimileWikiToolbox.WikiTableCellSettingsobject. -
toWikiTextreturns the wikitext serialization of this cell.
[edit]
Class SimileWikiToolbox.WikiTableSettings
-
toWikiTextreturns the wikitext serialization of these settings.
Other methods depend on what settings are possible on a wikitext table.
[edit]
Class SimileWikiToolbox.WikiTableRowSettings
-
toWikiTextreturns the wikitext serialization of these settings.
Other methods depend on what settings are possible on a wikitext table row.
[edit]
Class SimileWikiToolbox.WikiTableCellSettings
-
toWikiTextreturns the wikitext serialization of these settings.
Other methods depend on what settings are possible on a wikitext table cell.
Go back to Main Wiki Table Editor Page.

