"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireWildcard(require("react"));
var _textEditorService = _interopRequireDefault(require("../../text-editor-service"));
var _textEditorContext = _interopRequireDefault(require("../../text-editor-context"));
var _editorButton = _interopRequireDefault(require("./editor-button"));
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
function ClearFormattingButton({
  icon,
  tooltip = '',
  testId
}) {
  const {
    slate,
    slateReact
  } = (0, _react.useContext)(_textEditorContext.default);
  const textEditorService = new _textEditorService.default(slate, slateReact);
  const editor = slateReact.useSlate();
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_editorButton.default, {
    tooltipText: tooltip,
    icon: icon,
    onClick: () => {
      textEditorService.clearFormatting(editor);
    },
    testId: testId
  });
}
var _default = exports.default = ClearFormattingButton;