table/utils/common
Functions
-
createEmptyTableCell( writer, insertPosition, attributes ) → ModelElement
internalmodule:table/utils/common~createEmptyTableCell
A common method to create an empty table cell. It creates a proper model structure as a table cell must have at least one block inside.
Parameters
writer : ModelWriter
The model writer.
insertPosition : ModelPosition
The position at which the table cell should be inserted.
attributes : Record<string, unknown>
The element attributes.
Defaults to
{}
Returns
ModelElement
Created table cell.
-
enableProperty( schema, conversion, options = { [options.attributeName], [options.attributeType], options.defaultValue, options.modelAttribute, [options.reduceBoxSides], options.styleName } ) → void
internalmodule:table/utils/common~enableProperty
Enables conversion for an attribute for simple view-model mappings.
Parameters
schema : ModelSchema
conversion : Conversion
options : object
-
Properties
[ options.attributeName ] : string
[ options.attributeType ] : 'length' | 'color'
options.defaultValue : string
The default value for the specified
modelAttribute
.options.modelAttribute : string
[ options.reduceBoxSides ] : boolean
options.styleName : string
Returns
void
-
getSelectionAffectedTable( selection ) → ModelElement
internalmodule:table/utils/common~getSelectionAffectedTable
Depending on the position of the selection we either return the table under cursor or look for the table higher in the hierarchy.
Parameters
selection : ModelDocumentSelection
Returns
-
isHeadingColumnCell( tableUtils, tableCell ) → boolean
internalmodule:table/utils/common~isHeadingColumnCell
Checks if a table cell belongs to the heading column section.
Parameters
tableUtils : TableUtils
tableCell : ModelElement
Returns
boolean
-
updateNumericAttribute( key, value, item, writer, defaultValue ) → void
internalmodule:table/utils/common~updateNumericAttribute
A common method to update the numeric value. If a value is the default one, it will be unset.
Parameters
key : string
An attribute key.
value : unknown
The new attribute value.
item : ModelItem
A model item on which the attribute will be set.
writer : ModelWriter
defaultValue : unknown
The default attribute value. If a value is lower or equal, it will be unset.
Defaults to
1
Returns
void