src/js/extensions/table/mergedTableUI.js
function _bindEvents(popupTableUtils, eventManager, selectionManager) {
  const $popupContent = popupTableUtils.$content;
  const $mergeBtn = $($popupContent[5]);
  const $unmergeBtn = $($popupContent[6]);
  const $separator = $($popupContent[7]);

  popupTableUtils.on('click .te-table-merge', () => {
    eventManager.emit('command', 'MergeCells');
  });

  popupTableUtils.on('click .te-table-unmerge', () => {
    eventManager.emit('command', 'UnmergeCells');
  });

  eventManager.listen('openPopupTableUtils', () => {
    const $selectedCells = selectionManager.getSelectedCells();
    const selectedCellCount = $selectedCells.length;

    if (selectedCellCount) {
      if (selectedCellCount < 2 || selectionManager.hasSelectedBothThAndTd($selectedCells)) {
        $mergeBtn.hide();
      } else {
        $mergeBtn.show();
      }

      if ($selectedCells.is('[rowspan], [colspan]')) {
        $unmergeBtn.show();
      } else {
        $unmergeBtn.hide();
      }
      $separator.show();
    } else {
      $mergeBtn.hide();
      $unmergeBtn.hide();
      $separator.hide();
    }
  });
}
function _bindEvents(popupTableUtils, eventManager, selectionManager) {
  const $popupContent = popupTableUtils.$content;
  const $mergeBtn = $($popupContent[5]);
  const $unmergeBtn = $($popupContent[6]);
  const $separator = $($popupContent[7]);

  popupTableUtils.on('click .te-table-merge', () => {
    eventManager.emit('command', 'MergeCells');
  });

  popupTableUtils.on('click .te-table-unmerge', () => {
    eventManager.emit('command', 'UnmergeCells');
  });

  eventManager.listen('openPopupTableUtils', () => {
    const $selectedCells = selectionManager.getSelectedCells();
    const selectedCellCount = $selectedCells.length;

    if (selectedCellCount) {
      if (selectedCellCount < 2 || selectionManager.hasSelectedBothThAndTd($selectedCells)) {
        $mergeBtn.hide();
      } else {
        $mergeBtn.show();
      }

      if ($selectedCells.is('[rowspan], [colspan]')) {
        $unmergeBtn.show();
      } else {
        $unmergeBtn.hide();
      }
      $separator.show();
    } else {
      $mergeBtn.hide();
      $unmergeBtn.hide();
      $separator.hide();
    }
  });
}
function _bindEvents ( popupTableUtils , eventManager , selectionManager ) { const $popupContent = popupTableUtils . $content ; const $mergeBtn = $ ( $popupContent [ 5 ] ) ; const $unmergeBtn = $ ( $popupContent [ 6 ] ) ; const $separator = $ ( $popupContent [ 7 ] ) ; popupTableUtils . on ( 'click .te-table-merge' , ( ) => { eventManager . emit ( 'command' , 'MergeCells' ) ; } ) ; popupTableUtils . on ( 'click .te-table-unmerge' , ( ) => { eventManager . emit ( 'command' , 'UnmergeCells' ) ; } ) ; eventManager . listen ( 'openPopupTableUtils' , ( ) => { const $selectedCells = selectionManager . getSelectedCells ( ) ; const selectedCellCount = $selectedCells . length ; if ( selectedCellCount ) { if ( selectedCellCount < 2 || selectionManager . hasSelectedBothThAndTd ( $selectedCells ) ) { $mergeBtn . hide ( ) ; } else { $mergeBtn . show ( ) ; } if ( $selectedCells . is ( '[rowspan], [colspan]' ) ) { $unmergeBtn . show ( ) ; } else { $unmergeBtn . hide ( ) ; } $separator . show ( ) ; } else { $mergeBtn . hide ( ) ; $unmergeBtn . hide ( ) ; $separator . hide ( ) ; } } ) ; }
Bind events for merge feature of contextmenu.
@param {object} popupTableUtils - PopupTableUtils instance for managing contextmenu of table
@param {object} eventManager - event manager instance of editor
@param {object} selectionManager - table selection manager instance
@private
Bind events for merge feature of contextmenu .