UNPKG

@mantine/tiptap

Version:

Rich text editor based on tiptap

1 lines 13.7 kB
{"version":3,"file":"controls.cjs","names":["createControl","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"],"sources":["../../src/RichTextEditorControl/controls.tsx"],"sourcesContent":["import {\n IconAlignCenter,\n IconAlignJustified,\n IconAlignLeft,\n IconAlignRight,\n IconArrowBackUp,\n IconArrowForwardUp,\n IconBlockquote,\n IconBold,\n IconCircleOff,\n IconClearFormatting,\n IconCode,\n IconH1,\n IconH2,\n IconH3,\n IconH4,\n IconH5,\n IconH6,\n IconHighlight,\n IconIndentDecrease,\n IconIndentIncrease,\n IconItalic,\n IconLineDashed,\n IconList,\n IconListCheck,\n IconListNumbers,\n IconStrikethrough,\n IconSubscript,\n IconSuperscript,\n IconUnderline,\n IconUnlink,\n} from '../icons/Icons';\nimport { createControl } from './RichTextEditorControl';\n\nexport const BoldControl = createControl({\n label: 'boldControlLabel',\n icon: (props) => <IconBold {...props} />,\n isActive: { name: 'bold' },\n operation: { name: 'toggleBold' },\n});\n\nexport const ItalicControl = createControl({\n label: 'italicControlLabel',\n icon: (props) => <IconItalic {...props} />,\n isActive: { name: 'italic' },\n operation: { name: 'toggleItalic' },\n});\n\nexport const UnderlineControl = createControl({\n label: 'underlineControlLabel',\n icon: (props) => <IconUnderline {...props} />,\n isActive: { name: 'underline' },\n operation: { name: 'toggleUnderline' },\n});\n\nexport const StrikeThroughControl = createControl({\n label: 'strikeControlLabel',\n icon: (props) => <IconStrikethrough {...props} />,\n isActive: { name: 'strike' },\n operation: { name: 'toggleStrike' },\n});\n\nexport const ClearFormattingControl = createControl({\n label: 'clearFormattingControlLabel',\n icon: (props) => <IconClearFormatting {...props} />,\n operation: { name: 'unsetAllMarks' },\n});\n\nexport const UnlinkControl = createControl({\n label: 'unlinkControlLabel',\n icon: (props) => <IconUnlink {...props} />,\n operation: { name: 'unsetLink' },\n});\n\nexport const BulletListControl = createControl({\n label: 'bulletListControlLabel',\n icon: (props) => <IconList {...props} />,\n isActive: { name: 'bulletList' },\n operation: { name: 'toggleBulletList' },\n});\n\nexport const OrderedListControl = createControl({\n label: 'orderedListControlLabel',\n icon: (props) => <IconListNumbers {...props} />,\n isActive: { name: 'orderedList' },\n operation: { name: 'toggleOrderedList' },\n});\n\nexport const H1Control = createControl({\n label: 'h1ControlLabel',\n icon: (props) => <IconH1 {...props} />,\n isActive: { name: 'heading', attributes: { level: 1 } },\n operation: { name: 'toggleHeading', attributes: { level: 1 } },\n});\n\nexport const H2Control = createControl({\n label: 'h2ControlLabel',\n icon: (props) => <IconH2 {...props} />,\n isActive: { name: 'heading', attributes: { level: 2 } },\n operation: { name: 'toggleHeading', attributes: { level: 2 } },\n});\n\nexport const H3Control = createControl({\n label: 'h3ControlLabel',\n icon: (props) => <IconH3 {...props} />,\n isActive: { name: 'heading', attributes: { level: 3 } },\n operation: { name: 'toggleHeading', attributes: { level: 3 } },\n});\n\nexport const H4Control = createControl({\n label: 'h4ControlLabel',\n icon: (props) => <IconH4 {...props} />,\n isActive: { name: 'heading', attributes: { level: 4 } },\n operation: { name: 'toggleHeading', attributes: { level: 4 } },\n});\n\nexport const H5Control = createControl({\n label: 'h5ControlLabel',\n icon: (props) => <IconH5 {...props} />,\n isActive: { name: 'heading', attributes: { level: 5 } },\n operation: { name: 'toggleHeading', attributes: { level: 5 } },\n});\n\nexport const H6Control = createControl({\n label: 'h6ControlLabel',\n icon: (props) => <IconH6 {...props} />,\n isActive: { name: 'heading', attributes: { level: 6 } },\n operation: { name: 'toggleHeading', attributes: { level: 6 } },\n});\n\nexport const BlockquoteControl = createControl({\n label: 'blockquoteControlLabel',\n icon: (props) => <IconBlockquote {...props} />,\n isActive: { name: 'blockquote' },\n operation: { name: 'toggleBlockquote' },\n});\n\nexport const AlignLeftControl = createControl({\n label: 'alignLeftControlLabel',\n icon: (props) => <IconAlignLeft {...props} />,\n operation: { name: 'setTextAlign', attributes: 'left' },\n});\n\nexport const AlignRightControl = createControl({\n label: 'alignRightControlLabel',\n icon: (props) => <IconAlignRight {...props} />,\n operation: { name: 'setTextAlign', attributes: 'right' },\n});\n\nexport const AlignCenterControl = createControl({\n label: 'alignCenterControlLabel',\n icon: (props) => <IconAlignCenter {...props} />,\n operation: { name: 'setTextAlign', attributes: 'center' },\n});\n\nexport const AlignJustifyControl = createControl({\n label: 'alignJustifyControlLabel',\n icon: (props) => <IconAlignJustified {...props} />,\n operation: { name: 'setTextAlign', attributes: 'justify' },\n});\n\nexport const SubscriptControl = createControl({\n label: 'subscriptControlLabel',\n icon: (props) => <IconSubscript {...props} />,\n isActive: { name: 'subscript' },\n operation: { name: 'toggleSubscript' },\n});\n\nexport const SuperscriptControl = createControl({\n label: 'superscriptControlLabel',\n icon: (props) => <IconSuperscript {...props} />,\n isActive: { name: 'superscript' },\n operation: { name: 'toggleSuperscript' },\n});\n\nexport const CodeControl = createControl({\n label: 'codeControlLabel',\n icon: (props) => <IconCode {...props} />,\n isActive: { name: 'code' },\n operation: { name: 'toggleCode' },\n});\n\nexport const CodeBlockControl = createControl({\n label: 'codeBlockControlLabel',\n icon: (props) => <IconCode {...props} />,\n isActive: { name: 'codeBlock' },\n operation: { name: 'toggleCodeBlock' },\n});\n\nexport const HighlightControl = createControl({\n label: 'highlightControlLabel',\n icon: (props) => <IconHighlight {...props} />,\n isActive: { name: 'highlight' },\n operation: { name: 'toggleHighlight' },\n});\n\nexport const HrControl = createControl({\n label: 'hrControlLabel',\n icon: (props) => <IconLineDashed {...props} />,\n operation: { name: 'setHorizontalRule' },\n});\n\nexport const UnsetColorControl = createControl({\n label: 'unsetColorControlLabel',\n icon: (props) => <IconCircleOff {...props} />,\n operation: { name: 'unsetColor' },\n});\n\nexport const UndoControl = createControl({\n label: 'undoControlLabel',\n icon: (props) => <IconArrowBackUp {...props} />,\n isDisabled: (editor) => !editor?.can().undo(),\n operation: { name: 'undo' },\n});\n\nexport const RedoControl = createControl({\n label: 'redoControlLabel',\n icon: (props) => <IconArrowForwardUp {...props} />,\n isDisabled: (editor) => !editor?.can().redo(),\n operation: { name: 'redo' },\n});\n\nexport const TaskListControl = createControl({\n label: 'tasksControlLabel',\n icon: (props) => <IconListCheck {...props} />,\n isActive: { name: 'taskList' },\n operation: { name: 'toggleTaskList' },\n});\n\nexport const TaskListSinkControl = createControl({\n label: 'tasksSinkLabel',\n icon: (props) => <IconIndentIncrease {...props} />,\n operation: { name: 'sinkListItem', attributes: 'taskItem' },\n isDisabled: (editor) => !editor?.can().sinkListItem('taskItem'),\n});\n\nexport const TaskListLiftControl = createControl({\n label: 'tasksLiftLabel',\n icon: (props) => <IconIndentDecrease {...props} />,\n operation: { name: 'liftListItem', attributes: 'taskItem' },\n isDisabled: (editor) => !editor?.can().liftListItem('taskItem'),\n});\n"],"mappings":";;;;;;AAkCA,MAAa,cAAcA,8BAAAA,cAAc;CACvC,OAAO;CACP,OAAO,UAAU,iBAAA,GAAA,kBAAA,KAACC,cAAAA,UAAD,EAAU,GAAI,MAAQ,CAAA;CACvC,UAAU,EAAE,MAAM,OAAO;CACzB,WAAW,EAAE,MAAM,aAAa;AAClC,CAAC;AAED,MAAa,gBAAgBD,8BAAAA,cAAc;CACzC,OAAO;CACP,OAAO,UAAU,iBAAA,GAAA,kBAAA,KAACE,cAAAA,YAAD,EAAY,GAAI,MAAQ,CAAA;CACzC,UAAU,EAAE,MAAM,SAAS;CAC3B,WAAW,EAAE,MAAM,eAAe;AACpC,CAAC;AAED,MAAa,mBAAmBF,8BAAAA,cAAc;CAC5C,OAAO;CACP,OAAO,UAAU,iBAAA,GAAA,kBAAA,KAACG,cAAAA,eAAD,EAAe,GAAI,MAAQ,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