UNPKG

@rtdui/editor

Version:

React rich text editor based on tiptap

170 lines (167 loc) 7.72 kB
'use client'; import { jsx } from 'react/jsx-runtime'; import { IconBold, IconItalic, IconUnderline, IconStrikethrough, IconClearFormatting, IconUnlink, IconList, IconListNumbers, IconH1, IconH2, IconH3, IconH4, IconH5, IconH6, IconBlockquote, IconAlignLeft, IconAlignRight, IconAlignCenter, IconAlignJustified, IconSubscript, IconSuperscript, IconCode, IconHighlight, IconLineDashed, IconCircleOff, IconPhoto, IconTable } from '@tabler/icons-react'; import createTiptapControl from './createTiptapControl.mjs'; const BoldControl = createTiptapControl({ label: "boldControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconBold, { ...props, stroke: 1.5 }), isActive: { name: "bold" }, operation: { name: "toggleBold" } }); const ItalicControl = createTiptapControl({ label: "italicControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconItalic, { ...props, stroke: 1.5 }), isActive: { name: "italic" }, operation: { name: "toggleItalic" } }); const UnderlineControl = createTiptapControl({ label: "underlineControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconUnderline, { ...props, stroke: 1.5 }), isActive: { name: "underline" }, operation: { name: "toggleUnderline" } }); const StrikeThroughControl = createTiptapControl({ label: "strikeControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconStrikethrough, { ...props, stroke: 1.5 }), isActive: { name: "strike" }, operation: { name: "toggleStrike" } }); const ClearFormattingControl = createTiptapControl({ label: "clearFormattingControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconClearFormatting, { ...props, stroke: 1.5 }), operation: { name: "unsetAllMarks" } }); const UnlinkControl = createTiptapControl({ label: "unlinkControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconUnlink, { ...props, stroke: 1.5 }), operation: { name: "unsetLink" } }); const BulletListControl = createTiptapControl({ label: "bulletListControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconList, { ...props, stroke: 1.5 }), isActive: { name: "bulletList" }, operation: { name: "toggleBulletList" } }); const OrderedListControl = createTiptapControl({ label: "orderedListControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconListNumbers, { ...props, stroke: 1.5 }), isActive: { name: "orderedList" }, operation: { name: "toggleOrderedList" } }); const H1Control = createTiptapControl({ label: "h1ControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconH1, { ...props, stroke: 1.5 }), isActive: { name: "heading", attributes: { level: 1 } }, operation: { name: "toggleHeading", attributes: { level: 1 } } }); const H2Control = createTiptapControl({ label: "h2ControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconH2, { ...props, stroke: 1.5 }), isActive: { name: "heading", attributes: { level: 2 } }, operation: { name: "toggleHeading", attributes: { level: 2 } } }); const H3Control = createTiptapControl({ label: "h3ControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconH3, { ...props, stroke: 1.5 }), isActive: { name: "heading", attributes: { level: 3 } }, operation: { name: "toggleHeading", attributes: { level: 3 } } }); const H4Control = createTiptapControl({ label: "h4ControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconH4, { ...props, stroke: 1.5 }), isActive: { name: "heading", attributes: { level: 4 } }, operation: { name: "toggleHeading", attributes: { level: 4 } } }); const H5Control = createTiptapControl({ label: "h5ControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconH5, { ...props, stroke: 1.5 }), isActive: { name: "heading", attributes: { level: 5 } }, operation: { name: "toggleHeading", attributes: { level: 5 } } }); const H6Control = createTiptapControl({ label: "h6ControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconH6, { ...props, stroke: 1.5 }), isActive: { name: "heading", attributes: { level: 6 } }, operation: { name: "toggleHeading", attributes: { level: 6 } } }); const BlockquoteControl = createTiptapControl({ label: "blockquoteControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconBlockquote, { ...props, stroke: 1.5 }), isActive: { name: "blockquote" }, operation: { name: "toggleBlockquote" } }); const AlignLeftControl = createTiptapControl({ label: "alignLeftControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconAlignLeft, { ...props, stroke: 1.5 }), operation: { name: "setTextAlign", attributes: "left" } }); const AlignRightControl = createTiptapControl({ label: "alignRightControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconAlignRight, { ...props, stroke: 1.5 }), operation: { name: "setTextAlign", attributes: "right" } }); const AlignCenterControl = createTiptapControl({ label: "alignCenterControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconAlignCenter, { ...props, stroke: 1.5 }), operation: { name: "setTextAlign", attributes: "center" } }); const AlignJustifyControl = createTiptapControl({ label: "alignJustifyControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconAlignJustified, { ...props, stroke: 1.5 }), operation: { name: "setTextAlign", attributes: "justify" } }); const SubscriptControl = createTiptapControl({ label: "subscriptControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconSubscript, { ...props, stroke: 1.5 }), isActive: { name: "subscript" }, operation: { name: "toggleSubscript" } }); const SuperscriptControl = createTiptapControl({ label: "superscriptControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconSuperscript, { ...props, stroke: 1.5 }), isActive: { name: "superscript" }, operation: { name: "toggleSuperscript" } }); const CodeControl = createTiptapControl({ label: "codeControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconCode, { ...props, stroke: 1.5 }), isActive: { name: "code" }, operation: { name: "toggleCode" } }); const CodeBlockControl = createTiptapControl({ label: "codeBlockControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconCode, { ...props, stroke: 1.5 }), isActive: { name: "codeBlock" }, operation: { name: "toggleCodeBlock" } }); const HighlightControl = createTiptapControl({ label: "highlightControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconHighlight, { ...props, stroke: 1.5 }), isActive: { name: "highlight" }, operation: { name: "toggleHighlight" } }); const HrControl = createTiptapControl({ label: "hrControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconLineDashed, { ...props, stroke: 1.5 }), operation: { name: "setHorizontalRule" } }); const UnsetColorControl = createTiptapControl({ label: "unsetColorControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconCircleOff, { ...props, stroke: 1.5 }), operation: { name: "unsetColor" } }); const ImageControl = createTiptapControl({ label: "ImageControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconPhoto, { ...props, stroke: 1.5 }), operation: { name: "uploadImage", attributes: {} } }); const TableControl = createTiptapControl({ label: "TableControlLabel", icon: (props) => /* @__PURE__ */ jsx(IconTable, { ...props, stroke: 1.5 }), operation: { name: "insertTable", attributes: { rows: 3, cols: 3, withHeaderRow: true } } }); export { AlignCenterControl, AlignJustifyControl, AlignLeftControl, AlignRightControl, BlockquoteControl, BoldControl, BulletListControl, ClearFormattingControl, CodeBlockControl, CodeControl, H1Control, H2Control, H3Control, H4Control, H5Control, H6Control, HighlightControl, HrControl, ImageControl, ItalicControl, OrderedListControl, StrikeThroughControl, SubscriptControl, SuperscriptControl, TableControl, UnderlineControl, UnlinkControl, UnsetColorControl }; //# sourceMappingURL=tiptapControls.mjs.map