UNPKG

@mantine/tiptap

Version:

Rich text editor based on tiptap

219 lines (215 loc) 9.69 kB
'use client'; 'use strict'; var jsxRuntime = require('react/jsx-runtime'); var Icons = require('../icons/Icons.cjs'); var RichTextEditorControl = require('./RichTextEditorControl.cjs'); const BoldControl = RichTextEditorControl.createControl({ label: "boldControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconBold, { ...props }), isActive: { name: "bold" }, operation: { name: "toggleBold" } }); const ItalicControl = RichTextEditorControl.createControl({ label: "italicControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconItalic, { ...props }), isActive: { name: "italic" }, operation: { name: "toggleItalic" } }); const UnderlineControl = RichTextEditorControl.createControl({ label: "underlineControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconUnderline, { ...props }), isActive: { name: "underline" }, operation: { name: "toggleUnderline" } }); const StrikeThroughControl = RichTextEditorControl.createControl({ label: "strikeControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconStrikethrough, { ...props }), isActive: { name: "strike" }, operation: { name: "toggleStrike" } }); const ClearFormattingControl = RichTextEditorControl.createControl({ label: "clearFormattingControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconClearFormatting, { ...props }), operation: { name: "unsetAllMarks" } }); const UnlinkControl = RichTextEditorControl.createControl({ label: "unlinkControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconUnlink, { ...props }), operation: { name: "unsetLink" } }); const BulletListControl = RichTextEditorControl.createControl({ label: "bulletListControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconList, { ...props }), isActive: { name: "bulletList" }, operation: { name: "toggleBulletList" } }); const OrderedListControl = RichTextEditorControl.createControl({ label: "orderedListControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconListNumbers, { ...props }), isActive: { name: "orderedList" }, operation: { name: "toggleOrderedList" } }); const H1Control = RichTextEditorControl.createControl({ label: "h1ControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconH1, { ...props }), isActive: { name: "heading", attributes: { level: 1 } }, operation: { name: "toggleHeading", attributes: { level: 1 } } }); const H2Control = RichTextEditorControl.createControl({ label: "h2ControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconH2, { ...props }), isActive: { name: "heading", attributes: { level: 2 } }, operation: { name: "toggleHeading", attributes: { level: 2 } } }); const H3Control = RichTextEditorControl.createControl({ label: "h3ControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconH3, { ...props }), isActive: { name: "heading", attributes: { level: 3 } }, operation: { name: "toggleHeading", attributes: { level: 3 } } }); const H4Control = RichTextEditorControl.createControl({ label: "h4ControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconH4, { ...props }), isActive: { name: "heading", attributes: { level: 4 } }, operation: { name: "toggleHeading", attributes: { level: 4 } } }); const H5Control = RichTextEditorControl.createControl({ label: "h5ControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconH5, { ...props }), isActive: { name: "heading", attributes: { level: 5 } }, operation: { name: "toggleHeading", attributes: { level: 5 } } }); const H6Control = RichTextEditorControl.createControl({ label: "h6ControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconH6, { ...props }), isActive: { name: "heading", attributes: { level: 6 } }, operation: { name: "toggleHeading", attributes: { level: 6 } } }); const BlockquoteControl = RichTextEditorControl.createControl({ label: "blockquoteControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconBlockquote, { ...props }), isActive: { name: "blockquote" }, operation: { name: "toggleBlockquote" } }); const AlignLeftControl = RichTextEditorControl.createControl({ label: "alignLeftControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconAlignLeft, { ...props }), operation: { name: "setTextAlign", attributes: "left" } }); const AlignRightControl = RichTextEditorControl.createControl({ label: "alignRightControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconAlignRight, { ...props }), operation: { name: "setTextAlign", attributes: "right" } }); const AlignCenterControl = RichTextEditorControl.createControl({ label: "alignCenterControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconAlignCenter, { ...props }), operation: { name: "setTextAlign", attributes: "center" } }); const AlignJustifyControl = RichTextEditorControl.createControl({ label: "alignJustifyControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconAlignJustified, { ...props }), operation: { name: "setTextAlign", attributes: "justify" } }); const SubscriptControl = RichTextEditorControl.createControl({ label: "subscriptControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconSubscript, { ...props }), isActive: { name: "subscript" }, operation: { name: "toggleSubscript" } }); const SuperscriptControl = RichTextEditorControl.createControl({ label: "superscriptControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconSuperscript, { ...props }), isActive: { name: "superscript" }, operation: { name: "toggleSuperscript" } }); const CodeControl = RichTextEditorControl.createControl({ label: "codeControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconCode, { ...props }), isActive: { name: "code" }, operation: { name: "toggleCode" } }); const CodeBlockControl = RichTextEditorControl.createControl({ label: "codeBlockControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconCode, { ...props }), isActive: { name: "codeBlock" }, operation: { name: "toggleCodeBlock" } }); const HighlightControl = RichTextEditorControl.createControl({ label: "highlightControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconHighlight, { ...props }), isActive: { name: "highlight" }, operation: { name: "toggleHighlight" } }); const HrControl = RichTextEditorControl.createControl({ label: "hrControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconLineDashed, { ...props }), operation: { name: "setHorizontalRule" } }); const UnsetColorControl = RichTextEditorControl.createControl({ label: "unsetColorControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconCircleOff, { ...props }), operation: { name: "unsetColor" } }); const UndoControl = RichTextEditorControl.createControl({ label: "undoControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconArrowBackUp, { ...props }), isDisabled: (editor) => !editor?.can().undo(), operation: { name: "undo" } }); const RedoControl = RichTextEditorControl.createControl({ label: "redoControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconArrowForwardUp, { ...props }), isDisabled: (editor) => !editor?.can().redo(), operation: { name: "redo" } }); const TaskListControl = RichTextEditorControl.createControl({ label: "tasksControlLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconListCheck, { ...props }), isActive: { name: "taskList" }, operation: { name: "toggleTaskList" } }); const TaskListSinkControl = RichTextEditorControl.createControl({ label: "tasksSinkLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconIndentIncrease, { ...props }), operation: { name: "sinkListItem", attributes: "taskItem" }, isDisabled: (editor) => !editor?.can().sinkListItem("taskItem") }); const TaskListLiftControl = RichTextEditorControl.createControl({ label: "tasksLiftLabel", icon: (props) => /* @__PURE__ */ jsxRuntime.jsx(Icons.IconIndentDecrease, { ...props }), operation: { name: "liftListItem", attributes: "taskItem" }, isDisabled: (editor) => !editor?.can().liftListItem("taskItem") }); exports.AlignCenterControl = AlignCenterControl; exports.AlignJustifyControl = AlignJustifyControl; exports.AlignLeftControl = AlignLeftControl; exports.AlignRightControl = AlignRightControl; exports.BlockquoteControl = BlockquoteControl; exports.BoldControl = BoldControl; exports.BulletListControl = BulletListControl; exports.ClearFormattingControl = ClearFormattingControl; exports.CodeBlockControl = CodeBlockControl; exports.CodeControl = CodeControl; exports.H1Control = H1Control; exports.H2Control = H2Control; exports.H3Control = H3Control; exports.H4Control = H4Control; exports.H5Control = H5Control; exports.H6Control = H6Control; exports.HighlightControl = HighlightControl; exports.HrControl = HrControl; exports.ItalicControl = ItalicControl; exports.OrderedListControl = OrderedListControl; exports.RedoControl = RedoControl; exports.StrikeThroughControl = StrikeThroughControl; exports.SubscriptControl = SubscriptControl; exports.SuperscriptControl = SuperscriptControl; exports.TaskListControl = TaskListControl; exports.TaskListLiftControl = TaskListLiftControl; exports.TaskListSinkControl = TaskListSinkControl; exports.UnderlineControl = UnderlineControl; exports.UndoControl = UndoControl; exports.UnlinkControl = UnlinkControl; exports.UnsetColorControl = UnsetColorControl; //# sourceMappingURL=controls.cjs.map