import { Edit } from "@wix/wix-ui-icons-common";
import React, { useContext, useState } from "react";
import { RicosContext } from "./../../ricos-context/index.js";
import { getIsModalOpen, useModalState } from "./../../ricos-modals/modal-service-provider.js";
import { ToolbarButton } from "./../../_shared/toolbar-button/toolbar-button.js";
const EditHtmlButton = ({ toolbarItem, dataHook, id }) => {
  const [referenceElement, setReferenceElement] = useState(null);
  const { t } = useContext(RicosContext) || {};
  const isModalOpen = useModalState(getIsModalOpen(id));
  return /* @__PURE__ */ React.createElement(
    ToolbarButton,
    {
      active: isModalOpen,
      dataHook,
      label: t("HtmlPlugin_EditHtml_Tooltip"),
      prefix: Edit,
      ariaLabel: t("HtmlPlugin_EditHtml_Tooltip"),
      onClick: () => toolbarItem.commands?.click({ referenceElement }),
      ref: setReferenceElement,
      tabIndex: toolbarItem.presentation.tabIndex
    }
  );
};
export {
  EditHtmlButton
};
//# sourceMappingURL=edit-html-button.js.map
