var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
  return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { ToolbarButtonSlimmer } from './toolbar-button-slimmer.abstract';
import { MapToComponentField } from 'vega-slimmer/core';
import { ActionHandleStrategyRegistry } from '../../../dto/action-handle-strategies/action-handle-strategy-registry';
/**
 * Abstract class for visual mode toolbar buttons, except for the source edit button.
 */
export class VisualModeToolbarButtonSlimmer extends ToolbarButtonSlimmer {
  constructor(config) {
    super(config);
  }
  /**
   * Determines if the button should be hidden.
   * Hide the button when the editor is in source view mode, except for the source edit button.
   *
   * @returns {boolean} - True if the button is hidden, false otherwise.
   */
  isHidden() {
    return this.sourceView;
  }
  /**
   * Determines if the button should be disabled.
   * Determines whether should disable the button or not when the editor is not in source view mode, except for the source edit button.
   *
   * @returns {boolean} - True if the button is disabled, false otherwise.
   */
  isDisabled() {
    return super.isDisabled() && !this.sourceView;
  }
  /**
   * Check if the node support text annotation
   *
   * @param {Nullable< RTENode| RTEBlock>} node - The RTE node to check
   * @param {string} annotationActionName - The annotation name to check
   * @returns {boolean} - True if the node support text annotation, false otherwise
   */
  shouldDisabledToolbar(node, annotationActionName) {
    return node && !ActionHandleStrategyRegistry.canHandle(annotationActionName, node);
  }
}
__decorate([
  MapToComponentField()
], VisualModeToolbarButtonSlimmer.prototype, "sourceView", void 0);
