"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var click_handler_exports = {};
__export(click_handler_exports, {
  clickHandler: () => clickHandler
});
module.exports = __toCommonJS(click_handler_exports);
var import_core = require("./../../../tiptap/core/index.js");
var import_state = require("./../../../tiptap/pm/state.js");
function clickHandler(options) {
  return new import_state.Plugin({
    key: new import_state.PluginKey("handleClickLink"),
    props: {
      handleClick: (view, pos, event) => {
        const attrs = (0, import_core.getAttributes)(view.state, options.type.name);
        const link = event.target?.closest("a");
        if (link && attrs.href) {
          window.open(attrs.href, attrs.target);
          return true;
        }
        return false;
      }
    }
  });
}
//# sourceMappingURL=click-handler.js.map
