import { RTEFilterStylesStrategy } from '../filter-styles-strategy.abstract';
import { Predicate } from '../predicate';
/**
 * Filter styles strategy for code block, which defines the styles to be filtered and the conditions for filtering and refilling styles for code blocks.
 */
export class CodeBlockFilterStylesStrategy extends RTEFilterStylesStrategy {
  constructor() {
    super(...arguments);
    this.stylesToBeFiltered = CodeBlockFilterStylesStrategy.STYLES;
    this.elementTagName = 'pre';
  }
  /**
   * @inheritDoc
   */
  canFilter(blockOrNodeInstance) {
    return Predicate.isCodeBlock(blockOrNodeInstance.dtoName);
  }
  /**
   * The code block styles is preset and will convert to vega-code-block element so we don't need to to refill styles back to element.
   *
   * @param {string} _blockOrNodeClassName The class name of the block or node.
   * @param {HTMLElement} _element The HTML element to check.
   * @returns {boolean} False, as we don't need to refill styles for code blocks.
   */
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  canRefill(_blockOrNodeClassName, _element) {
    return false;
  }
  /**
   * @inheritDoc
   */
  toCssText() {
    return this.buildCssTextForStyles(this.elementTagName, this.classNameToBeAdded);
  }
}
CodeBlockFilterStylesStrategy.STYLES = {
  backgroundColor: 'rgba(var(--v-bg-secondary, 245, 247, 247, 1))',
  padding: '12px',
};
