src/js/wysiwygCommands/tableAlignCol.js
function setAlignAttributeToTableCells($table, alignDirection, selectionInformation) {
  const isDivided = selectionInformation.isDivided || false;
  const start = selectionInformation.startColumnIndex;
  const end = selectionInformation.endColumnIndex;
  const columnLength = $table.find('tr').eq(0).find('td,th').length;

  $table.find('tr').each((n, tr) => {
    $(tr).children('td,th').each((index, cell) => {
      if (isDivided &&
                ((start <= index && index <= columnLength) || (index <= end))
      ) {
        $(cell).attr('align', alignDirection);
      } else if ((start <= index && index <= end)) {
        $(cell).attr('align', alignDirection);
      }
    });
  });
}
function setAlignAttributeToTableCells($table, alignDirection, selectionInformation) {
  const isDivided = selectionInformation.isDivided || false;
  const start = selectionInformation.startColumnIndex;
  const end = selectionInformation.endColumnIndex;
  const columnLength = $table.find('tr').eq(0).find('td,th').length;

  $table.find('tr').each((n, tr) => {
    $(tr).children('td,th').each((index, cell) => {
      if (isDivided &&
                ((start <= index && index <= columnLength) || (index <= end))
      ) {
        $(cell).attr('align', alignDirection);
      } else if ((start <= index && index <= end)) {
        $(cell).attr('align', alignDirection);
      }
    });
  });
}
function setAlignAttributeToTableCells ( $table , alignDirection , selectionInformation ) { const isDivided = selectionInformation . isDivided || false ; const start = selectionInformation . startColumnIndex ; const end = selectionInformation . endColumnIndex ; const columnLength = $table . find ( 'tr' ) . eq ( 0 ) . find ( 'td,th' ) . length ; $table . find ( 'tr' ) . each ( ( n , tr ) => { $ ( tr ) . children ( 'td,th' ) . each ( ( index , cell ) => { if ( isDivided && ( ( start <= index && index <= columnLength ) || ( index <= end ) ) ) { $ ( cell ) . attr ( 'align' , alignDirection ) ; } else if ( ( start <= index && index <= end ) ) { $ ( cell ) . attr ( 'align' , alignDirection ) ; } } ) ; } ) ; }
Set Column align
@param {jQuery} $table jQuery wrapped TABLE
@param {string} alignDirection 'left' or 'center' or 'right'
@param {{
startColumnIndex: number,
endColumnIndex: number,
isDivided: boolean
}} selectionInformation start, end column index and boolean value for whether range divided or not
Set Column align