Create and manipulate tables with support for merging, splitting, and styling cells
Canvas Editor provides comprehensive table functionality including creation, modification, cell operations, and styling. Tables are rendered on the canvas with full editing capabilities.
// Position cursor inside a table cell first// Insert row above current celleditor.command.executeInsertTableTopRow()// Insert row below current celleditor.command.executeInsertTableBottomRow()// Delete current roweditor.command.executeDeleteTableRow()
// Insert column to the left of current celleditor.command.executeInsertTableLeftCol()// Insert column to the right of current celleditor.command.executeInsertTableRightCol()// Delete current columneditor.command.executeDeleteTableCol()
All row and column operations require the cursor to be positioned inside a table cell.
import { TableBorder } from '@hufe921/canvas-editor'// Set border type for entire tableeditor.command.executeTableBorderType(TableBorder.ALL) // All borderseditor.command.executeTableBorderType(TableBorder.EMPTY) // No borderseditor.command.executeTableBorderType(TableBorder.EXTERNAL) // Only outer bordereditor.command.executeTableBorderType(TableBorder.INTERNAL) // Only inner borders
// Set border color for entire tableeditor.command.executeTableBorderColor('#000000')// Set border for individual celleditor.command.executeTableTdBorderType(/* border configuration */)
// Set background color for current celleditor.command.executeTableTdBackgroundColor('#F0F0F0')// Remove background coloreditor.command.executeTableTdBackgroundColor('')
import { VerticalAlign } from '@hufe921/canvas-editor'// Align to topeditor.command.executeTableTdVerticalAlign(VerticalAlign.TOP)// Align to middleeditor.command.executeTableTdVerticalAlign(VerticalAlign.MIDDLE)// Align to bottomeditor.command.executeTableTdVerticalAlign(VerticalAlign.BOTTOM)