import { c as Mark, s as Extension, y as mergeAttributes } from "./dist-q1wrtxfG.mjs";
//#region ../../../node_modules/.pnpm/@tiptap+extension-text-align@2.27.1_@tiptap+core@2.27.1_@tiptap+pm@2.27.1_/node_modules/@tiptap/extension-text-align/dist/index.js
/**
* This extension allows you to align text.
* @see https://www.tiptap.dev/api/extensions/text-align
*/
const TextAlign = Extension.create({
	name: "textAlign",
	addOptions() {
		return {
			types: [],
			alignments: [
				"left",
				"center",
				"right",
				"justify"
			],
			defaultAlignment: null
		};
	},
	addGlobalAttributes() {
		return [{
			types: this.options.types,
			attributes: { textAlign: {
				default: this.options.defaultAlignment,
				parseHTML: (element) => {
					const alignment = element.style.textAlign;
					return this.options.alignments.includes(alignment) ? alignment : this.options.defaultAlignment;
				},
				renderHTML: (attributes) => {
					if (!attributes.textAlign) return {};
					return { style: `text-align: ${attributes.textAlign}` };
				}
			} }
		}];
	},
	addCommands() {
		return {
			setTextAlign: (alignment) => ({ commands }) => {
				if (!this.options.alignments.includes(alignment)) return false;
				return this.options.types.map((type) => commands.updateAttributes(type, { textAlign: alignment })).every((response) => response);
			},
			unsetTextAlign: () => ({ commands }) => {
				return this.options.types.map((type) => commands.resetAttributes(type, "textAlign")).every((response) => response);
			},
			toggleTextAlign: (alignment) => ({ editor, commands }) => {
				if (!this.options.alignments.includes(alignment)) return false;
				if (editor.isActive({ textAlign: alignment })) return commands.unsetTextAlign();
				return commands.setTextAlign(alignment);
			}
		};
	},
	addKeyboardShortcuts() {
		return {
			"Mod-Shift-l": () => this.editor.commands.setTextAlign("left"),
			"Mod-Shift-e": () => this.editor.commands.setTextAlign("center"),
			"Mod-Shift-r": () => this.editor.commands.setTextAlign("right"),
			"Mod-Shift-j": () => this.editor.commands.setTextAlign("justify")
		};
	}
});
//#endregion
//#region ../../../node_modules/.pnpm/@tiptap+extension-underline@2.27.1_@tiptap+core@2.27.1_@tiptap+pm@2.27.1_/node_modules/@tiptap/extension-underline/dist/index.js
/**
* This extension allows you to create underline text.
* @see https://www.tiptap.dev/api/marks/underline
*/
const Underline = Mark.create({
	name: "underline",
	addOptions() {
		return { HTMLAttributes: {} };
	},
	parseHTML() {
		return [{ tag: "u" }, {
			style: "text-decoration",
			consuming: false,
			getAttrs: (style) => style.includes("underline") ? {} : false
		}];
	},
	renderHTML({ HTMLAttributes }) {
		return [
			"u",
			mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
			0
		];
	},
	addCommands() {
		return {
			setUnderline: () => ({ commands }) => {
				return commands.setMark(this.name);
			},
			toggleUnderline: () => ({ commands }) => {
				return commands.toggleMark(this.name);
			},
			unsetUnderline: () => ({ commands }) => {
				return commands.unsetMark(this.name);
			}
		};
	},
	addKeyboardShortcuts() {
		return {
			"Mod-u": () => this.editor.commands.toggleUnderline(),
			"Mod-U": () => this.editor.commands.toggleUnderline()
		};
	}
});
//#endregion
export { TextAlign as n, Underline as t };

//# sourceMappingURL=dist-DtCehmdR.mjs.map