"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); // src/index.ts var index_exports = {}; __export(index_exports, { HardBreak: () => HardBreak, default: () => index_default }); module.exports = __toCommonJS(index_exports); // src/hard-break.ts var import_core = require("@tiptap/core"); var HardBreak = import_core.Node.create({ name: "hardBreak", markdownTokenName: "br", addOptions() { return { keepMarks: true, HTMLAttributes: {} }; }, inline: true, group: "inline", selectable: false, linebreakReplacement: true, parseHTML() { return [{ tag: "br" }]; }, renderHTML({ HTMLAttributes }) { return ["br", (0, import_core.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes)]; }, renderText() { return "\n"; }, renderMarkdown: () => ` `, parseMarkdown: () => { return { type: "hardBreak" }; }, addCommands() { return { setHardBreak: () => ({ commands, chain, state, editor }) => { return commands.first([ () => commands.exitCode(), () => commands.command(() => { const { selection, storedMarks } = state; if (selection.$from.parent.type.spec.isolating) { return false; } const { keepMarks } = this.options; const { splittableMarks } = editor.extensionManager; const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks(); return chain().insertContent({ type: this.name }).command(({ tr, dispatch }) => { if (dispatch && marks && keepMarks) { const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name)); tr.ensureMarks(filteredMarks); } return true; }).run(); }) ]); } }; }, addKeyboardShortcuts() { return { "Mod-Enter": () => this.editor.commands.setHardBreak(), "Shift-Enter": () => this.editor.commands.setHardBreak() }; } }); // src/index.ts var index_default = HardBreak; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { HardBreak }); //# sourceMappingURL=index.cjs.map