import React, { useContext } from 'react';
import TextEditorService from '../../text-editor-service';
import TextEditorContext from '../../text-editor-context';
import EditorButton from './editor-button';
import { jsx as _jsx } from "react/jsx-runtime";
function ClearFormattingButton({
  icon,
  tooltip = '',
  testId
}) {
  const {
    slate,
    slateReact
  } = useContext(TextEditorContext);
  const textEditorService = new TextEditorService(slate, slateReact);
  const editor = slateReact.useSlate();
  return /*#__PURE__*/_jsx(EditorButton, {
    tooltipText: tooltip,
    icon: icon,
    onClick: () => {
      textEditorService.clearFormatting(editor);
    },
    testId: testId
  });
}
export default ClearFormattingButton;