import { ElementToRTEImageBlockStrategyAbstract } from './element-to-rte-image-block-strategy.abstract';
/** Transform img element to image block DTO */
export class ImgToRTEImageBlockStrategy extends ElementToRTEImageBlockStrategyAbstract {
  /**
   * Can be handle.
   *
   * @param {HTMLElement[]} elementsArray - Current elements.
   * @param {number} currentIndex - Current element index.
   * @returns {number} - can be handled element count.
   */
  canHandle(elementsArray, currentIndex) {
    return elementsArray[currentIndex].tagName === 'IMG' ? 1 : 0;
  }
  /**
   * Parse to a image block.
   *
   * @param {HTMLElement[]} elementsArray - Current elements.
   * @param {VegaRTETransformOptions} [options] - Options for transformation.
   * @returns {Nullable<RTEContentBlock>} - Image block.
   */
  handle(elementsArray, options) {
    const element = elementsArray[0];
    return this.createRTEImageBlock(element, options);
  }
  /* istanbul ignore next */
  /**
   * Append child blocks.
   */
  // eslint-disable-next-line @typescript-eslint/no-empty-function
  appendChildBlocks() { }
  /**
   * Should continue process to child elements.
   *
   * @returns {boolean} - boolean.
   */
  shouldProceedToElementChildren() {
    return false;
  }
}
