UNPKG

reactjs-tiptap-editor

Version:

A modern WYSIWYG rich text editor based on tiptap and shadcn ui for React

62 lines (61 loc) 1.54 kB
import { M as r, m as o } from "./index-CXIIg9Sq.js"; import { A as i } from "./RichTextEditor-iSPxjLdO.js"; const s = r.create({ name: "underline", addOptions() { return { HTMLAttributes: {} }; }, parseHTML() { return [ { tag: "u" }, { style: "text-decoration", consuming: !1, getAttrs: (e) => e.includes("underline") ? {} : !1 } ]; }, renderHTML({ HTMLAttributes: e }) { return ["u", o(this.options.HTMLAttributes, e), 0]; }, addCommands() { return { setUnderline: () => ({ commands: e }) => e.setMark(this.name), toggleUnderline: () => ({ commands: e }) => e.toggleMark(this.name), unsetUnderline: () => ({ commands: e }) => e.unsetMark(this.name) }; }, addKeyboardShortcuts() { return { "Mod-u": () => this.editor.commands.toggleUnderline(), "Mod-U": () => this.editor.commands.toggleUnderline() }; } }), u = /* @__PURE__ */ s.extend({ addOptions() { var e; return { ...(e = this.parent) == null ? void 0 : e.call(this), button({ editor: t, t: n }) { return { component: i, componentProps: { action: () => t.commands.toggleUnderline(), isActive: () => t.isActive("underline") || !1, disabled: !1, icon: "Underline", shortcutKeys: ["mod", "U"], tooltip: n("editor.underline.tooltip") } }; } }; } }); export { u as TextUnderline };