import { RTEFilterStylesStrategy, } from '../../../../dto/filter-styles-strategies/filter-styles-strategy.abstract';
import { RTETableAnnotation } from '../../annotations/table-annotation';
/**
 * A strategy defines how to filter and refill styles for table elements.
 */
export class TableBlockFilterStylesStrategy extends RTEFilterStylesStrategy {
  constructor() {
    super(...arguments);
    this.stylesToBeFiltered = RTETableAnnotation.getDefaultStyles();
    this.elementTagName = 'table';
  }
  /**
   * @inheritDoc
   */
  canFilter(blockOrNodeInstance) {
    return this.isTableBlock(blockOrNodeInstance.dtoName);
  }
  /**
   * @inheritDoc
   */
  canRefill(blockOrNodeClassName, element) {
    return (this.isTableBlock(blockOrNodeClassName) && element.tagName.toLowerCase() === this.elementTagName);
  }
  /**
   * @inheritDoc
   */
  toCssText() {
    return this.buildCssTextForStyles(this.elementTagName, this.classNameToBeAdded);
  }
  /**
   * Checks if the given class name corresponds to a table block.
   *
   * @param {string} className - The class name to check.
   * @returns {boolean} - True if it's a table block, false otherwise.
   */
  isTableBlock(className) {
    return className === 'RTETableBlock';
  }
}
