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