import { Predicate } from '../predicate';
import { TitleFilterStylesStrategy } from '../text-block/title-filter-styles-strategy';
/**
 * Filters the default title/subtitle styles from customStyle when parsing an RTEListItemBlock that is supposed to be a title/subtitle.
 */
export class ListTitleItemBlockFilterStylesStrategy extends TitleFilterStylesStrategy {
  constructor(type) {
    super(type);
    this.classNameToBeAdded = `v-rte-${type}`;
    this.elementTagName = 'li';
  }
  /**
   * Check the important font-size and line-height for list item block are default styles, and the block is a list item block.
   *
   * @inheritDoc
   */
  canFilter(blockOrNodeInstance) {
    return (Predicate.isListItemBlock(blockOrNodeInstance.constructor.name) &&
      this.isBlockOrNodeStylesMatchFilterStyles(blockOrNodeInstance, ['fontSize', 'lineHeight']));
  }
  /**
   * @inheritDoc
   */
  canRefill(blockOrNodeClassName, element) {
    return (Predicate.isListItemBlock(blockOrNodeClassName) &&
      element.matches(this.elementTagName) &&
      element.classList.contains(this.classNameToBeAdded));
  }
}
