Table

Table block editing helpers.

Access:

app.table
app.getModule('table')
app.invoke('table.method', …)

observe#

Rewrites toolbar button command to table.open when table option enabled.

Parameters:

  • btn (HTMLElement | string) — toolbar or dropdown button element
  • type (string) — block or entity type name
  • dropdown (any) — dropdown instance

Returns: object|false

app.table.observe(btn, 'toolbar');

open#

Opens table operations dropdown.

Parameters:

  • params (object) — command or form parameters
  • button (HTMLElement | string) — toolbar or UI button element
  • el (HTMLElement | string) — DOM element
app.table.open({}, { button });

openCellSetting#

Opens cell width/nowrap settings form.

Parameters:

  • params (object) — command or form parameters
  • button (HTMLElement | string) — toolbar or UI button element
  • el (HTMLElement | string) — DOM element
app.table.openCellSetting({}, { button });

setCell#

Applies cell width and nowrap from form without closing dropdown.

Parameters:

  • params (object) — command or form parameters
  • form (any) — form module instance from dropdown
app.table.setCell({ width: '120px', nowrap: true });

saveCell#

Closes dropdown and saves cell settings.

Parameters:

  • params (object) — command or form parameters
  • form (any) — form module instance from dropdown
app.table.saveCell(params);

remove#

Removes the current table block.

app.table.remove();

removeRow#

Deletes selected or current row(s) from table.

app.table.removeRow();

removeColumn#

Deletes selected or current column(s) from table.

app.table.removeColumn();

removeCaption#

Removes table caption element and block.

app.table.removeCaption();

removeHead#

Removes thead section and its blocks.

app.table.removeHead();

removeHeadVertical#

Converts first-column th cells to td (removes vertical head).

app.table.removeHeadVertical();

addCaption#

Inserts caption block before table.

app.table.addCaption();

addHead#

Adds thead with a new header row.

app.table.addHead();

addHeadVertical#

Converts first-column td cells to th.

app.table.addHeadVertical();

addColumnBefore#

Inserts a column before current cell.

app.table.addColumnBefore();

addColumnAfter#

Inserts a column after current cell.

app.table.addColumnAfter();

addRowAbove#

Inserts a row above current cell row.

app.table.addRowAbove();

addRowBelow#

Inserts a row below current cell row.

app.table.addRowBelow();

mergeCells#

Merges selected rectangular cell range into one cell.

app.table.mergeCells();

splitIntoColumns#

Splits merged cell into multiple columns.

app.table.splitIntoColumns();

splitIntoRows#

Splits merged cell into multiple rows.

app.table.splitIntoRows();

getSelectedCells#

Returns DOM elements of cells with rx-cell-selected class.

Returns: HTMLElement[]

app.table.getSelectedCells();

hasSelectedCell#

Returns whether any table cells are selected.

Returns: boolean

app.table.hasSelectedCell();

clearSelection#

Clears table cell selection state and classes.

app.table.clearSelection();