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