UNPKG

substance

Version:

Substance is a JavaScript library for web-based content editing. It provides building blocks for realizing custom text editors and web-based publishing systems.

37 lines (31 loc) 836 B
import { Component, TextPropertyEditor } from '../../ui' class TableCellComponent extends Component { render($$) { let node = this.props.node let el = $$('td').addClass('sc-table-cell') el.append( $$(TextPropertyEditor, { path: node.getTextPath(), disabled: this.props.disabled }).ref('editor') ) if (node.rowspan > 0) { el.attr('rowspan', node.rowspan) } if (node.colspan > 0) { el.attr('colspan', node.colspan) } return el } grabFocus() { let node = this.props.node this.context.editorSession.setSelection({ type: 'property', path: node.getPath(), startOffset: node.getLength(), surfaceId: this.refs.editor.id }) } } TableCellComponent.prototype._isTableCellComponent = true export default TableCellComponent