function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
import { Icon } from "@blueprintjs/core";
import React from "react";
import ToolbarItem from "./ToolbarItem";
import { connectToEditor } from "../withEditorProps";
export default connectToEditor(function (editorState) {
  return {
    readOnly: editorState.readOnly
  };
})(function (_ref) {
  var toolbarItemProps = _ref.toolbarItemProps,
    readOnly = _ref.readOnly,
    toggleReadOnlyMode = _ref.toggleReadOnlyMode,
    disableSetReadOnly = _ref.disableSetReadOnly;
  return /*#__PURE__*/React.createElement(ToolbarItem, _extends({
    disabled: disableSetReadOnly,
    Icon: /*#__PURE__*/React.createElement(Icon, {
      icon: readOnly ? "lock" : "unlock"
    }),
    onIconClick: toggleReadOnlyMode,
    tooltip: readOnly ? /*#__PURE__*/React.createElement("span", null, "Switch to edit mode") : /*#__PURE__*/React.createElement("span", null, "Switch to read only mode")
  }, toolbarItemProps));
});