function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var ShowHtmlButton = /*#__PURE__*/function () {
  function ShowHtmlButton(showHtml, onChange) {
    _classCallCheck(this, ShowHtmlButton);
    _defineProperty(this, "showHtml", void 0);
    _defineProperty(this, "onChange", void 0);
    this.title = 'Html'; // 自定义菜单标题
    this.tag = 'button';
    this.showHtml = showHtml;
    this.onChange = onChange;
  }
  _createClass(ShowHtmlButton, [{
    key: "getValue",
    value: function getValue(editor) {
      // TS 语法
      return editor.getHtml();
    }
    // 菜单是否需要激活（如选中加粗文本，“加粗”菜单会激活），用不到则返回 false
  }, {
    key: "isActive",
    value: function isActive(editor) {
      // TS 语法
      console.log('isActive showHtml:', this.showHtml);
      return this.showHtml.current || false;
    }
    // 菜单是否禁用，用不到则返回 false
  }, {
    key: "isDisabled",
    value: function isDisabled(editor) {
      // TS 语法
      return false;
    }
    // 点击菜单时触发的函数
  }, {
    key: "exec",
    value: function exec(editor, value) {
      // TS 语法
      if (this.isDisabled(editor)) return;
      // editor.insertText(value) // value 即 this.value(editor) 的返回值
      console.log('showHtml:', this.showHtml);
      this.onChange();
      return;
    }
  }]);
  return ShowHtmlButton;
}();
export { ShowHtmlButton as default };