import { InsertChildrenAfterAction } from '../../actions/insert-children-after-block';
import { ActionHandleStrategy } from '../action-handle-strategy.abstract';
/**
 * Insert image behind after code block strategy.
 */
export class CodeBlockInsertImageStrategy extends ActionHandleStrategy {
  /**
   * Insert image block at behind of the RTE code block.
   *
   * @param {InsertImageToBlockAction} action - The insert image action instance.
   * @param {RTECodeBlock} target - The code block.
   */
  handleAction(action, target) {
    const imageBlock = action.imageBlockToBeInserted;
    target.parent.apply(new InsertChildrenAfterAction(target, imageBlock));
  }
}
