@mantine/tiptap 9.2.0 → 9.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/RichTextEditor.cjs.map +1 -1
- package/cjs/RichTextEditor.context.cjs.map +1 -1
- package/cjs/RichTextEditorContent/RichTextEditorContent.cjs.map +1 -1
- package/cjs/RichTextEditorControl/RichTextEditorColorControl.cjs.map +1 -1
- package/cjs/RichTextEditorControl/RichTextEditorColorPickerControl.cjs.map +1 -1
- package/cjs/RichTextEditorControl/RichTextEditorControl.cjs +12 -2
- package/cjs/RichTextEditorControl/RichTextEditorControl.cjs.map +1 -1
- package/cjs/RichTextEditorControl/RichTextEditorLinkControl.cjs +6 -1
- package/cjs/RichTextEditorControl/RichTextEditorLinkControl.cjs.map +1 -1
- package/cjs/RichTextEditorControl/RichTextEditorSourceCodeControl.cjs.map +1 -1
- package/cjs/RichTextEditorControl/controls.cjs.map +1 -1
- package/cjs/RichTextEditorControlsGroup/RichTextEditorControlsGroup.cjs.map +1 -1
- package/cjs/RichTextEditorToolbar/RichTextEditorToolbar.cjs.map +1 -1
- package/cjs/extensions/Link.cjs.map +1 -1
- package/cjs/extensions/TaskList.cjs.map +1 -1
- package/cjs/icons/Icons.cjs.map +1 -1
- package/cjs/labels.cjs.map +1 -1
- package/esm/RichTextEditor.context.mjs.map +1 -1
- package/esm/RichTextEditor.mjs.map +1 -1
- package/esm/RichTextEditorContent/RichTextEditorContent.mjs.map +1 -1
- package/esm/RichTextEditorControl/RichTextEditorColorControl.mjs.map +1 -1
- package/esm/RichTextEditorControl/RichTextEditorColorPickerControl.mjs.map +1 -1
- package/esm/RichTextEditorControl/RichTextEditorControl.mjs +12 -2
- package/esm/RichTextEditorControl/RichTextEditorControl.mjs.map +1 -1
- package/esm/RichTextEditorControl/RichTextEditorLinkControl.mjs +6 -1
- package/esm/RichTextEditorControl/RichTextEditorLinkControl.mjs.map +1 -1
- package/esm/RichTextEditorControl/RichTextEditorSourceCodeControl.mjs.map +1 -1
- package/esm/RichTextEditorControl/controls.mjs.map +1 -1
- package/esm/RichTextEditorControlsGroup/RichTextEditorControlsGroup.mjs.map +1 -1
- package/esm/RichTextEditorToolbar/RichTextEditorToolbar.mjs.map +1 -1
- package/esm/extensions/Link.mjs.map +1 -1
- package/esm/extensions/TaskList.mjs.map +1 -1
- package/esm/icons/Icons.mjs.map +1 -1
- package/esm/labels.mjs.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextEditor.cjs","names":["RichTextEditorProvider","DEFAULT_LABELS","Box","classes","RichTextEditorContent","RichTextEditorControl","RichTextEditorToolbar","RichTextEditorControlsGroup","RichTextEditorSourceCodeControl"],"sources":["../src/RichTextEditor.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { Editor } from '@tiptap/react';\nimport {\n Box,\n BoxProps,\n ElementProps,\n factory,\n Factory,\n StylesApiProps,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport { DEFAULT_LABELS, RichTextEditorLabels } from './labels';\nimport { RichTextEditorProvider } from './RichTextEditor.context';\nimport {\n RichTextEditorContent,\n type RichTextEditorContentProps,\n} from './RichTextEditorContent/RichTextEditorContent';\nimport * as controls from './RichTextEditorControl';\nimport {\n RichTextEditorControl,\n type RichTextEditorControlProps,\n} from './RichTextEditorControl/RichTextEditorControl';\nimport type { RichTextEditorColorControlProps } from './RichTextEditorControl/RichTextEditorColorControl';\nimport type { RichTextEditorLinkControlProps } from './RichTextEditorControl/RichTextEditorLinkControl';\nimport {\n RichTextEditorSourceCodeControl,\n type RichTextEditorSourceCodeControlProps,\n} from './RichTextEditorControl/RichTextEditorSourceCodeControl';\nimport {\n RichTextEditorControlsGroup,\n type RichTextEditorControlsGroupProps,\n} from './RichTextEditorControlsGroup/RichTextEditorControlsGroup';\nimport {\n RichTextEditorToolbar,\n type RichTextEditorToolbarProps,\n} from './RichTextEditorToolbar/RichTextEditorToolbar';\nimport classes from './RichTextEditor.module.css';\n\nexport type RichTextEditorVariant = 'default' | 'subtle';\n\nexport type RichTextEditorStylesNames =\n | 'linkEditorSave'\n | 'linkEditorDropdown'\n | 'root'\n | 'content'\n | 'Typography'\n | 'control'\n | 'controlIcon'\n | 'controlsGroup'\n | 'toolbar'\n | 'linkEditor'\n | 'linkEditorInput'\n | 'linkEditorExternalControl';\n\nexport interface RichTextEditorProps\n extends BoxProps, StylesApiProps<RichTextEditorFactory>, ElementProps<'div'> {\n /** Tiptap editor instance */\n editor: Editor | null;\n\n /** Determines whether code highlight styles should be added @default true */\n withCodeHighlightStyles?: boolean;\n\n /** Determines whether typography styles should be added @default true */\n withTypographyStyles?: boolean;\n\n /** Called if `RichTextEditor.SourceCode` clicked. */\n onSourceCodeTextSwitch?: (isSourceCodeModeActive: boolean) => void;\n\n /** Labels that are used in controls */\n labels?: Partial<RichTextEditorLabels>;\n\n /** Child editor components */\n children: React.ReactNode;\n}\n\nexport type RichTextEditorFactory = Factory<{\n props: RichTextEditorProps;\n ref: HTMLDivElement;\n stylesNames: RichTextEditorStylesNames;\n variant: RichTextEditorVariant;\n staticComponents: {\n Content: typeof RichTextEditorContent;\n Control: typeof RichTextEditorControl;\n Toolbar: typeof RichTextEditorToolbar;\n ControlsGroup: typeof RichTextEditorControlsGroup;\n Bold: typeof controls.BoldControl;\n Italic: typeof controls.ItalicControl;\n Strikethrough: typeof controls.StrikeThroughControl;\n Underline: typeof controls.UnderlineControl;\n ClearFormatting: typeof controls.ClearFormattingControl;\n H1: typeof controls.H1Control;\n H2: typeof controls.H2Control;\n H3: typeof controls.H3Control;\n H4: typeof controls.H4Control;\n H5: typeof controls.H5Control;\n H6: typeof controls.H6Control;\n BulletList: typeof controls.BulletListControl;\n OrderedList: typeof controls.OrderedListControl;\n Link: typeof controls.RichTextEditorLinkControl;\n Unlink: typeof controls.UnlinkControl;\n Blockquote: typeof controls.BlockquoteControl;\n AlignLeft: typeof controls.AlignLeftControl;\n AlignRight: typeof controls.AlignRightControl;\n AlignCenter: typeof controls.AlignCenterControl;\n AlignJustify: typeof controls.AlignJustifyControl;\n Superscript: typeof controls.SuperscriptControl;\n Subscript: typeof controls.SubscriptControl;\n Code: typeof controls.CodeControl;\n CodeBlock: typeof controls.CodeBlockControl;\n ColorPicker: typeof controls.RichTextEditorColorPickerControl;\n Color: typeof controls.RichTextEditorColorControl;\n Highlight: typeof controls.HighlightControl;\n Hr: typeof controls.HrControl;\n UnsetColor: typeof controls.UnsetColorControl;\n Undo: typeof controls.UndoControl;\n Redo: typeof controls.RedoControl;\n TaskList: typeof controls.TaskListControl;\n TaskListSink: typeof controls.TaskListSinkControl;\n TaskListLift: typeof controls.TaskListLiftControl;\n SourceCode: typeof RichTextEditorSourceCodeControl;\n };\n}>;\n\nconst defaultProps = {\n withCodeHighlightStyles: true,\n withTypographyStyles: true,\n variant: 'default',\n} satisfies Partial<RichTextEditorProps>;\n\nexport const RichTextEditor = factory<RichTextEditorFactory>((_props) => {\n const props = useProps('RichTextEditor', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n editor,\n withCodeHighlightStyles,\n withTypographyStyles,\n onSourceCodeTextSwitch,\n labels,\n children,\n variant,\n attributes,\n ...others\n } = props;\n\n const getStyles = useStyles<RichTextEditorFactory>({\n name: 'RichTextEditor',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n });\n\n const mergedLabels = useMemo(() => ({ ...DEFAULT_LABELS, ...labels }), [labels]);\n\n return (\n <RichTextEditorProvider\n value={{\n editor,\n getStyles,\n labels: mergedLabels,\n withCodeHighlightStyles,\n withTypographyStyles,\n onSourceCodeTextSwitch,\n unstyled,\n variant,\n }}\n >\n <Box {...getStyles('root')} {...others}>\n {children}\n </Box>\n </RichTextEditorProvider>\n );\n});\n\nRichTextEditor.classes = classes;\nRichTextEditor.displayName = '@mantine/tiptap/RichTextEditor';\n\n// Generic components\nRichTextEditor.Content = RichTextEditorContent;\nRichTextEditor.Control = RichTextEditorControl;\nRichTextEditor.Toolbar = RichTextEditorToolbar;\nRichTextEditor.ControlsGroup = RichTextEditorControlsGroup;\n\n// Controls components\nRichTextEditor.Bold = controls.BoldControl;\nRichTextEditor.Italic = controls.ItalicControl;\nRichTextEditor.Strikethrough = controls.StrikeThroughControl;\nRichTextEditor.Underline = controls.UnderlineControl;\nRichTextEditor.ClearFormatting = controls.ClearFormattingControl;\nRichTextEditor.H1 = controls.H1Control;\nRichTextEditor.H2 = controls.H2Control;\nRichTextEditor.H3 = controls.H3Control;\nRichTextEditor.H4 = controls.H4Control;\nRichTextEditor.H5 = controls.H5Control;\nRichTextEditor.H6 = controls.H6Control;\nRichTextEditor.BulletList = controls.BulletListControl;\nRichTextEditor.OrderedList = controls.OrderedListControl;\nRichTextEditor.Link = controls.RichTextEditorLinkControl;\nRichTextEditor.Unlink = controls.UnlinkControl;\nRichTextEditor.Blockquote = controls.BlockquoteControl;\nRichTextEditor.AlignLeft = controls.AlignLeftControl;\nRichTextEditor.AlignRight = controls.AlignRightControl;\nRichTextEditor.AlignCenter = controls.AlignCenterControl;\nRichTextEditor.AlignJustify = controls.AlignJustifyControl;\nRichTextEditor.Superscript = controls.SuperscriptControl;\nRichTextEditor.Subscript = controls.SubscriptControl;\nRichTextEditor.Code = controls.CodeControl;\nRichTextEditor.CodeBlock = controls.CodeBlockControl;\nRichTextEditor.ColorPicker = controls.RichTextEditorColorPickerControl;\nRichTextEditor.Color = controls.RichTextEditorColorControl;\nRichTextEditor.Highlight = controls.HighlightControl;\nRichTextEditor.Hr = controls.HrControl;\nRichTextEditor.UnsetColor = controls.UnsetColorControl;\nRichTextEditor.Undo = controls.UndoControl;\nRichTextEditor.Redo = controls.RedoControl;\nRichTextEditor.TaskList = controls.TaskListControl;\nRichTextEditor.TaskListSink = controls.TaskListSinkControl;\nRichTextEditor.TaskListLift = controls.TaskListLiftControl;\nRichTextEditor.SourceCode = RichTextEditorSourceCodeControl;\n\nexport namespace RichTextEditor {\n export type Props = RichTextEditorProps;\n export type StylesNames = RichTextEditorStylesNames;\n export type Factory = RichTextEditorFactory;\n\n export namespace Toolbar {\n export type Props = RichTextEditorToolbarProps;\n }\n\n export namespace Control {\n export type Props = RichTextEditorControlProps;\n export type ColorProps = RichTextEditorColorControlProps;\n export type LinkProps = RichTextEditorLinkControlProps;\n export type SourceCodeProps = RichTextEditorSourceCodeControlProps;\n }\n\n export namespace Content {\n export type Props = RichTextEditorContentProps;\n }\n\n export namespace ControlsGroup {\n export type Props = RichTextEditorControlsGroupProps;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4HA,MAAM,eAAe;CACnB,yBAAyB;CACzB,sBAAsB;CACtB,SAAS;CACV;AAED,MAAa,kBAAA,GAAA,cAAA,UAAiD,WAAW;CACvE,MAAM,SAAA,GAAA,cAAA,UAAiB,kBAAkB,cAAc,OAAO;CAC9D,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,QACA,yBACA,sBACA,wBACA,QACA,UACA,SACA,YACA,GAAG,WACD;CAEJ,MAAM,aAAA,GAAA,cAAA,WAA6C;EACjD,MAAM;EACN,SAAA,8BAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC;AAIF,QACE,iBAAA,GAAA,kBAAA,KAACA,+BAAAA,wBAAD;EACE,OAAO;GACL;GACA;GACA,SAAA,GAAA,MAAA,gBAP8B;IAAE,GAAGC,eAAAA;IAAgB,GAAG;IAAQ,GAAG,CAAC,OAAO,CAAC;GAQ1E;GACA;GACA;GACA;GACA;GACD;YAED,iBAAA,GAAA,kBAAA,KAACC,cAAAA,KAAD;GAAK,GAAI,UAAU,OAAO;GAAE,GAAI;GAC7B;GACG,CAAA;EACiB,CAAA;EAE3B;AAEF,eAAe,UAAUC,8BAAAA;AACzB,eAAe,cAAc;AAG7B,eAAe,UAAUC,8BAAAA;AACzB,eAAe,UAAUC,8BAAAA;AACzB,eAAe,UAAUC,8BAAAA;AACzB,eAAe,gBAAgBC,oCAAAA;AAG/B,eAAe,OAAA,iBAAA;AACf,eAAe,SAAA,iBAAA;AACf,eAAe,gBAAA,iBAAA;AACf,eAAe,YAAA,iBAAA;AACf,eAAe,kBAAA,iBAAA;AACf,eAAe,KAAA,iBAAA;AACf,eAAe,KAAA,iBAAA;AACf,eAAe,KAAA,iBAAA;AACf,eAAe,KAAA,iBAAA;AACf,eAAe,KAAA,iBAAA;AACf,eAAe,KAAA,iBAAA;AACf,eAAe,aAAA,iBAAA;AACf,eAAe,cAAA,iBAAA;AACf,eAAe,OAAA,kCAAA;AACf,eAAe,SAAA,iBAAA;AACf,eAAe,aAAA,iBAAA;AACf,eAAe,YAAA,iBAAA;AACf,eAAe,aAAA,iBAAA;AACf,eAAe,cAAA,iBAAA;AACf,eAAe,eAAA,iBAAA;AACf,eAAe,cAAA,iBAAA;AACf,eAAe,YAAA,iBAAA;AACf,eAAe,OAAA,iBAAA;AACf,eAAe,YAAA,iBAAA;AACf,eAAe,cAAA,yCAAA;AACf,eAAe,QAAA,mCAAA;AACf,eAAe,YAAA,iBAAA;AACf,eAAe,KAAA,iBAAA;AACf,eAAe,aAAA,iBAAA;AACf,eAAe,OAAA,iBAAA;AACf,eAAe,OAAA,iBAAA;AACf,eAAe,WAAA,iBAAA;AACf,eAAe,eAAA,iBAAA;AACf,eAAe,eAAA,iBAAA;AACf,eAAe,aAAaC,wCAAAA"}
|
|
1
|
+
{"version":3,"file":"RichTextEditor.cjs","names":["RichTextEditorProvider","DEFAULT_LABELS","Box","classes","RichTextEditorContent","RichTextEditorControl","RichTextEditorToolbar","RichTextEditorControlsGroup","RichTextEditorSourceCodeControl"],"sources":["../src/RichTextEditor.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { Editor } from '@tiptap/react';\nimport {\n Box,\n BoxProps,\n ElementProps,\n factory,\n Factory,\n StylesApiProps,\n useProps,\n useStyles,\n} from '@mantine/core';\nimport { DEFAULT_LABELS, RichTextEditorLabels } from './labels';\nimport { RichTextEditorProvider } from './RichTextEditor.context';\nimport {\n RichTextEditorContent,\n type RichTextEditorContentProps,\n} from './RichTextEditorContent/RichTextEditorContent';\nimport * as controls from './RichTextEditorControl';\nimport {\n RichTextEditorControl,\n type RichTextEditorControlProps,\n} from './RichTextEditorControl/RichTextEditorControl';\nimport type { RichTextEditorColorControlProps } from './RichTextEditorControl/RichTextEditorColorControl';\nimport type { RichTextEditorLinkControlProps } from './RichTextEditorControl/RichTextEditorLinkControl';\nimport {\n RichTextEditorSourceCodeControl,\n type RichTextEditorSourceCodeControlProps,\n} from './RichTextEditorControl/RichTextEditorSourceCodeControl';\nimport {\n RichTextEditorControlsGroup,\n type RichTextEditorControlsGroupProps,\n} from './RichTextEditorControlsGroup/RichTextEditorControlsGroup';\nimport {\n RichTextEditorToolbar,\n type RichTextEditorToolbarProps,\n} from './RichTextEditorToolbar/RichTextEditorToolbar';\nimport classes from './RichTextEditor.module.css';\n\nexport type RichTextEditorVariant = 'default' | 'subtle';\n\nexport type RichTextEditorStylesNames =\n | 'linkEditorSave'\n | 'linkEditorDropdown'\n | 'root'\n | 'content'\n | 'Typography'\n | 'control'\n | 'controlIcon'\n | 'controlsGroup'\n | 'toolbar'\n | 'linkEditor'\n | 'linkEditorInput'\n | 'linkEditorExternalControl';\n\nexport interface RichTextEditorProps\n extends BoxProps, StylesApiProps<RichTextEditorFactory>, ElementProps<'div'> {\n /** Tiptap editor instance */\n editor: Editor | null;\n\n /** Determines whether code highlight styles should be added @default true */\n withCodeHighlightStyles?: boolean;\n\n /** Determines whether typography styles should be added @default true */\n withTypographyStyles?: boolean;\n\n /** Called if `RichTextEditor.SourceCode` clicked. */\n onSourceCodeTextSwitch?: (isSourceCodeModeActive: boolean) => void;\n\n /** Labels that are used in controls */\n labels?: Partial<RichTextEditorLabels>;\n\n /** Child editor components */\n children: React.ReactNode;\n}\n\nexport type RichTextEditorFactory = Factory<{\n props: RichTextEditorProps;\n ref: HTMLDivElement;\n stylesNames: RichTextEditorStylesNames;\n variant: RichTextEditorVariant;\n staticComponents: {\n Content: typeof RichTextEditorContent;\n Control: typeof RichTextEditorControl;\n Toolbar: typeof RichTextEditorToolbar;\n ControlsGroup: typeof RichTextEditorControlsGroup;\n Bold: typeof controls.BoldControl;\n Italic: typeof controls.ItalicControl;\n Strikethrough: typeof controls.StrikeThroughControl;\n Underline: typeof controls.UnderlineControl;\n ClearFormatting: typeof controls.ClearFormattingControl;\n H1: typeof controls.H1Control;\n H2: typeof controls.H2Control;\n H3: typeof controls.H3Control;\n H4: typeof controls.H4Control;\n H5: typeof controls.H5Control;\n H6: typeof controls.H6Control;\n BulletList: typeof controls.BulletListControl;\n OrderedList: typeof controls.OrderedListControl;\n Link: typeof controls.RichTextEditorLinkControl;\n Unlink: typeof controls.UnlinkControl;\n Blockquote: typeof controls.BlockquoteControl;\n AlignLeft: typeof controls.AlignLeftControl;\n AlignRight: typeof controls.AlignRightControl;\n AlignCenter: typeof controls.AlignCenterControl;\n AlignJustify: typeof controls.AlignJustifyControl;\n Superscript: typeof controls.SuperscriptControl;\n Subscript: typeof controls.SubscriptControl;\n Code: typeof controls.CodeControl;\n CodeBlock: typeof controls.CodeBlockControl;\n ColorPicker: typeof controls.RichTextEditorColorPickerControl;\n Color: typeof controls.RichTextEditorColorControl;\n Highlight: typeof controls.HighlightControl;\n Hr: typeof controls.HrControl;\n UnsetColor: typeof controls.UnsetColorControl;\n Undo: typeof controls.UndoControl;\n Redo: typeof controls.RedoControl;\n TaskList: typeof controls.TaskListControl;\n TaskListSink: typeof controls.TaskListSinkControl;\n TaskListLift: typeof controls.TaskListLiftControl;\n SourceCode: typeof RichTextEditorSourceCodeControl;\n };\n}>;\n\nconst defaultProps = {\n withCodeHighlightStyles: true,\n withTypographyStyles: true,\n variant: 'default',\n} satisfies Partial<RichTextEditorProps>;\n\nexport const RichTextEditor = factory<RichTextEditorFactory>((_props) => {\n const props = useProps('RichTextEditor', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n unstyled,\n vars,\n editor,\n withCodeHighlightStyles,\n withTypographyStyles,\n onSourceCodeTextSwitch,\n labels,\n children,\n variant,\n attributes,\n ...others\n } = props;\n\n const getStyles = useStyles<RichTextEditorFactory>({\n name: 'RichTextEditor',\n classes,\n props,\n className,\n style,\n classNames,\n styles,\n unstyled,\n attributes,\n vars,\n });\n\n const mergedLabels = useMemo(() => ({ ...DEFAULT_LABELS, ...labels }), [labels]);\n\n return (\n <RichTextEditorProvider\n value={{\n editor,\n getStyles,\n labels: mergedLabels,\n withCodeHighlightStyles,\n withTypographyStyles,\n onSourceCodeTextSwitch,\n unstyled,\n variant,\n }}\n >\n <Box {...getStyles('root')} {...others}>\n {children}\n </Box>\n </RichTextEditorProvider>\n );\n});\n\nRichTextEditor.classes = classes;\nRichTextEditor.displayName = '@mantine/tiptap/RichTextEditor';\n\n// Generic components\nRichTextEditor.Content = RichTextEditorContent;\nRichTextEditor.Control = RichTextEditorControl;\nRichTextEditor.Toolbar = RichTextEditorToolbar;\nRichTextEditor.ControlsGroup = RichTextEditorControlsGroup;\n\n// Controls components\nRichTextEditor.Bold = controls.BoldControl;\nRichTextEditor.Italic = controls.ItalicControl;\nRichTextEditor.Strikethrough = controls.StrikeThroughControl;\nRichTextEditor.Underline = controls.UnderlineControl;\nRichTextEditor.ClearFormatting = controls.ClearFormattingControl;\nRichTextEditor.H1 = controls.H1Control;\nRichTextEditor.H2 = controls.H2Control;\nRichTextEditor.H3 = controls.H3Control;\nRichTextEditor.H4 = controls.H4Control;\nRichTextEditor.H5 = controls.H5Control;\nRichTextEditor.H6 = controls.H6Control;\nRichTextEditor.BulletList = controls.BulletListControl;\nRichTextEditor.OrderedList = controls.OrderedListControl;\nRichTextEditor.Link = controls.RichTextEditorLinkControl;\nRichTextEditor.Unlink = controls.UnlinkControl;\nRichTextEditor.Blockquote = controls.BlockquoteControl;\nRichTextEditor.AlignLeft = controls.AlignLeftControl;\nRichTextEditor.AlignRight = controls.AlignRightControl;\nRichTextEditor.AlignCenter = controls.AlignCenterControl;\nRichTextEditor.AlignJustify = controls.AlignJustifyControl;\nRichTextEditor.Superscript = controls.SuperscriptControl;\nRichTextEditor.Subscript = controls.SubscriptControl;\nRichTextEditor.Code = controls.CodeControl;\nRichTextEditor.CodeBlock = controls.CodeBlockControl;\nRichTextEditor.ColorPicker = controls.RichTextEditorColorPickerControl;\nRichTextEditor.Color = controls.RichTextEditorColorControl;\nRichTextEditor.Highlight = controls.HighlightControl;\nRichTextEditor.Hr = controls.HrControl;\nRichTextEditor.UnsetColor = controls.UnsetColorControl;\nRichTextEditor.Undo = controls.UndoControl;\nRichTextEditor.Redo = controls.RedoControl;\nRichTextEditor.TaskList = controls.TaskListControl;\nRichTextEditor.TaskListSink = controls.TaskListSinkControl;\nRichTextEditor.TaskListLift = controls.TaskListLiftControl;\nRichTextEditor.SourceCode = RichTextEditorSourceCodeControl;\n\nexport namespace RichTextEditor {\n export type Props = RichTextEditorProps;\n export type StylesNames = RichTextEditorStylesNames;\n export type Factory = RichTextEditorFactory;\n\n export namespace Toolbar {\n export type Props = RichTextEditorToolbarProps;\n }\n\n export namespace Control {\n export type Props = RichTextEditorControlProps;\n export type ColorProps = RichTextEditorColorControlProps;\n export type LinkProps = RichTextEditorLinkControlProps;\n export type SourceCodeProps = RichTextEditorSourceCodeControlProps;\n }\n\n export namespace Content {\n export type Props = RichTextEditorContentProps;\n }\n\n export namespace ControlsGroup {\n export type Props = RichTextEditorControlsGroupProps;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4HA,MAAM,eAAe;CACnB,yBAAyB;CACzB,sBAAsB;CACtB,SAAS;AACX;AAEA,MAAa,kBAAA,GAAA,cAAA,UAAiD,WAAW;CACvE,MAAM,SAAA,GAAA,cAAA,UAAiB,kBAAkB,cAAc,MAAM;CAC7D,MAAM,EACJ,YACA,WACA,OACA,QACA,UACA,MACA,QACA,yBACA,sBACA,wBACA,QACA,UACA,SACA,YACA,GAAG,WACD;CAEJ,MAAM,aAAA,GAAA,c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,eAAe,KAAA,iBAAA;AACf,eAAe,aAAA,iBAAA;AACf,eAAe,OAAA,iBAAA;AACf,eAAe,OAAA,iBAAA;AACf,eAAe,WAAA,iBAAA;AACf,eAAe,eAAA,iBAAA;AACf,eAAe,eAAA,iBAAA;AACf,eAAe,aAAaC,wCAAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextEditor.context.cjs","names":[],"sources":["../src/RichTextEditor.context.ts"],"sourcesContent":["import { Editor } from '@tiptap/react';\nimport { createSafeContext, GetStylesApi } from '@mantine/core';\nimport { RichTextEditorLabels } from './labels';\nimport type { RichTextEditorFactory } from './RichTextEditor';\n\ninterface RichTextEditorContext {\n getStyles: GetStylesApi<RichTextEditorFactory>;\n editor: Editor | null;\n labels: RichTextEditorLabels;\n withCodeHighlightStyles: boolean | undefined;\n withTypographyStyles: boolean | undefined;\n unstyled: boolean | undefined;\n variant: string | undefined;\n onSourceCodeTextSwitch?: (isSourceCodeModeActive: boolean) => void;\n}\n\nexport const [RichTextEditorProvider, useRichTextEditorContext] =\n createSafeContext<RichTextEditorContext>('RichTextEditor component was not found in tree');\n"],"mappings":";;;AAgBA,MAAa,CAAC,wBAAwB,6BAAA,
|
|
1
|
+
{"version":3,"file":"RichTextEditor.context.cjs","names":[],"sources":["../src/RichTextEditor.context.ts"],"sourcesContent":["import { Editor } from '@tiptap/react';\nimport { createSafeContext, GetStylesApi } from '@mantine/core';\nimport { RichTextEditorLabels } from './labels';\nimport type { RichTextEditorFactory } from './RichTextEditor';\n\ninterface RichTextEditorContext {\n getStyles: GetStylesApi<RichTextEditorFactory>;\n editor: Editor | null;\n labels: RichTextEditorLabels;\n withCodeHighlightStyles: boolean | undefined;\n withTypographyStyles: boolean | undefined;\n unstyled: boolean | undefined;\n variant: string | undefined;\n onSourceCodeTextSwitch?: (isSourceCodeModeActive: boolean) => void;\n}\n\nexport const [RichTextEditorProvider, useRichTextEditorContext] =\n createSafeContext<RichTextEditorContext>('RichTextEditor component was not found in tree');\n"],"mappings":";;;AAgBA,MAAa,CAAC,wBAAwB,6BAAA,0BAAA,EAAA,mBACK,gDAAgD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextEditorContent.cjs","names":["useRichTextEditorContext","Typography","Box","EditorContent","classes"],"sources":["../../src/RichTextEditorContent/RichTextEditorContent.tsx"],"sourcesContent":["import { EditorContent } from '@tiptap/react';\nimport {\n Box,\n BoxProps,\n CompoundStylesApiProps,\n ElementProps,\n factory,\n Factory,\n Typography,\n useProps,\n} from '@mantine/core';\nimport { useRichTextEditorContext } from '../RichTextEditor.context';\nimport classes from '../RichTextEditor.module.css';\n\nexport type RichTextEditorContentStylesNames = 'root';\nexport interface RichTextEditorContentProps\n extends BoxProps, CompoundStylesApiProps<RichTextEditorContentFactory>, ElementProps<'div'> {}\n\nexport type RichTextEditorContentFactory = Factory<{\n props: RichTextEditorContentProps;\n ref: HTMLDivElement;\n stylesNames: RichTextEditorContentStylesNames;\n compound: true;\n}>;\n\nexport const RichTextEditorContent = factory<RichTextEditorContentFactory>((_props) => {\n const props = useProps('RichTextEditorContent', null, _props);\n const { classNames, className, style, styles, vars, ...others } = props;\n const ctx = useRichTextEditorContext();\n\n if (ctx.withTypographyStyles) {\n return (\n <Typography\n {...ctx.getStyles('Typography', { className, style, styles, classNames })}\n unstyled={ctx.unstyled}\n >\n <Box\n component={EditorContent}\n editor={ctx.editor}\n {...ctx.getStyles('content', { classNames, styles })}\n {...others}\n />\n </Typography>\n );\n }\n\n return (\n <Box\n component={EditorContent}\n editor={ctx.editor}\n {...ctx.getStyles('content', { classNames, styles, className, style })}\n {...others}\n />\n );\n});\n\nRichTextEditorContent.classes = classes;\nRichTextEditorContent.displayName = '@mantine/tiptap/RichTextEditorContent';\n"],"mappings":";;;;;;;;AAyBA,MAAa,yBAAA,GAAA,cAAA,UAA+D,WAAW;CAErF,MAAM,EAAE,YAAY,WAAW,OAAO,QAAQ,MAAM,GAAG,YAAA,GAAA,cAAA,UADhC,yBAAyB,MAAM,
|
|
1
|
+
{"version":3,"file":"RichTextEditorContent.cjs","names":["useRichTextEditorContext","Typography","Box","EditorContent","classes"],"sources":["../../src/RichTextEditorContent/RichTextEditorContent.tsx"],"sourcesContent":["import { EditorContent } from '@tiptap/react';\nimport {\n Box,\n BoxProps,\n CompoundStylesApiProps,\n ElementProps,\n factory,\n Factory,\n Typography,\n useProps,\n} from '@mantine/core';\nimport { useRichTextEditorContext } from '../RichTextEditor.context';\nimport classes from '../RichTextEditor.module.css';\n\nexport type RichTextEditorContentStylesNames = 'root';\nexport interface RichTextEditorContentProps\n extends BoxProps, CompoundStylesApiProps<RichTextEditorContentFactory>, ElementProps<'div'> {}\n\nexport type RichTextEditorContentFactory = Factory<{\n props: RichTextEditorContentProps;\n ref: HTMLDivElement;\n stylesNames: RichTextEditorContentStylesNames;\n compound: true;\n}>;\n\nexport const RichTextEditorContent = factory<RichTextEditorContentFactory>((_props) => {\n const props = useProps('RichTextEditorContent', null, _props);\n const { classNames, className, style, styles, vars, ...others } = props;\n const ctx = useRichTextEditorContext();\n\n if (ctx.withTypographyStyles) {\n return (\n <Typography\n {...ctx.getStyles('Typography', { className, style, styles, classNames })}\n unstyled={ctx.unstyled}\n >\n <Box\n component={EditorContent}\n editor={ctx.editor}\n {...ctx.getStyles('content', { classNames, styles })}\n {...others}\n />\n </Typography>\n );\n }\n\n return (\n <Box\n component={EditorContent}\n editor={ctx.editor}\n {...ctx.getStyles('content', { classNames, styles, className, style })}\n {...others}\n />\n );\n});\n\nRichTextEditorContent.classes = classes;\nRichTextEditorContent.displayName = '@mantine/tiptap/RichTextEditorContent';\n"],"mappings":";;;;;;;;AAyBA,MAAa,yBAAA,GAAA,cAAA,UAA+D,WAAW;CAErF,MAAM,EAAE,YAAY,WAAW,OAAO,QAAQ,MAAM,GAAG,YAAA,GAAA,cAAA,UADhC,yBAAyB,MAAM,MACgB;CACtE,MAAM,MAAMA,+BAAAA,yBAAyB;CAErC,IAAI,IAAI,sBACN,OACE,iBAAA,GAAA,kBAAA,KAACC,cAAAA,YAAD;EACE,GAAI,IAAI,UAAU,cAAc;GAAE;GAAW;GAAO;GAAQ;EAAW,CAAC;EACxE,UAAU,IAAI;YAEd,iBAAA,GAAA,kBAAA,KAACC,cAAAA,KAAD;GACE,WAAWC,cAAAA;GACX,QAAQ,IAAI;GACZ,GAAI,IAAI,UAAU,WAAW;IAAE;IAAY;GAAO,CAAC;GACnD,GAAI;EACL,CAAA;CACS,CAAA;CAIhB,OACE,iBAAA,GAAA,kBAAA,KAACD,cAAAA,KAAD;EACE,WAAWC,cAAAA;EACX,QAAQ,IAAI;EACZ,GAAI,IAAI,UAAU,WAAW;GAAE;GAAY;GAAQ;GAAW;EAAM,CAAC;EACrE,GAAI;CACL,CAAA;AAEL,CAAC;AAED,sBAAsB,UAAUC,8BAAAA;AAChC,sBAAsB,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextEditorColorControl.cjs","names":["useRichTextEditorContext","RichTextEditorControl","ColorSwatch"],"sources":["../../src/RichTextEditorControl/RichTextEditorColorControl.tsx"],"sourcesContent":["import { BoxProps, ColorSwatch, ElementProps, useProps } from '@mantine/core';\nimport { useRichTextEditorContext } from '../RichTextEditor.context';\nimport { RichTextEditorControl } from './RichTextEditorControl';\n\nexport interface RichTextEditorColorControlProps extends BoxProps, ElementProps<'button'> {\n /** Color that will be set as text color, for example #ef457e */\n color: string;\n}\n\nexport function RichTextEditorColorControl(props: RichTextEditorColorControlProps) {\n const { color, ...others } = useProps('RichTextEditorColorControl', null, props);\n const { editor, labels, variant } = useRichTextEditorContext();\n const currentColor = editor?.getAttributes('textStyle').color || null;\n const label = labels.colorControlLabel(color);\n\n return (\n <RichTextEditorControl\n {...others}\n variant={variant}\n active={currentColor === color}\n aria-label={label}\n title={label}\n onClick={() => (editor?.chain() as any)?.focus().setColor(color).run()}\n >\n <ColorSwatch color={color} size={14} />\n </RichTextEditorControl>\n );\n}\n\nRichTextEditorColorControl.displayName = '@mantine/tiptap/RichTextEditorColorControl';\n"],"mappings":";;;;;;;AASA,SAAgB,2BAA2B,OAAwC;CACjF,MAAM,EAAE,OAAO,GAAG,YAAA,GAAA,cAAA,UAAoB,8BAA8B,MAAM,
|
|
1
|
+
{"version":3,"file":"RichTextEditorColorControl.cjs","names":["useRichTextEditorContext","RichTextEditorControl","ColorSwatch"],"sources":["../../src/RichTextEditorControl/RichTextEditorColorControl.tsx"],"sourcesContent":["import { BoxProps, ColorSwatch, ElementProps, useProps } from '@mantine/core';\nimport { useRichTextEditorContext } from '../RichTextEditor.context';\nimport { RichTextEditorControl } from './RichTextEditorControl';\n\nexport interface RichTextEditorColorControlProps extends BoxProps, ElementProps<'button'> {\n /** Color that will be set as text color, for example #ef457e */\n color: string;\n}\n\nexport function RichTextEditorColorControl(props: RichTextEditorColorControlProps) {\n const { color, ...others } = useProps('RichTextEditorColorControl', null, props);\n const { editor, labels, variant } = useRichTextEditorContext();\n const currentColor = editor?.getAttributes('textStyle').color || null;\n const label = labels.colorControlLabel(color);\n\n return (\n <RichTextEditorControl\n {...others}\n variant={variant}\n active={currentColor === color}\n aria-label={label}\n title={label}\n onClick={() => (editor?.chain() as any)?.focus().setColor(color).run()}\n >\n <ColorSwatch color={color} size={14} />\n </RichTextEditorControl>\n );\n}\n\nRichTextEditorColorControl.displayName = '@mantine/tiptap/RichTextEditorColorControl';\n"],"mappings":";;;;;;;AASA,SAAgB,2BAA2B,OAAwC;CACjF,MAAM,EAAE,OAAO,GAAG,YAAA,GAAA,cAAA,UAAoB,8BAA8B,MAAM,KAAK;CAC/E,MAAM,EAAE,QAAQ,QAAQ,YAAYA,+BAAAA,yBAAyB;CAC7D,MAAM,eAAe,QAAQ,cAAc,WAAW,EAAE,SAAS;CACjE,MAAM,QAAQ,OAAO,kBAAkB,KAAK;CAE5C,OACE,iBAAA,GAAA,kBAAA,KAACC,8BAAAA,uBAAD;EACE,GAAI;EACK;EACT,QAAQ,iBAAiB;EACzB,cAAY;EACZ,OAAO;EACP,gBAAgB,QAAQ,MAAM,IAAW,MAAM,EAAE,SAAS,KAAK,EAAE,IAAI;YAErE,iBAAA,GAAA,kBAAA,KAACC,cAAAA,aAAD;GAAoB;GAAO,MAAM;EAAK,CAAA;CACjB,CAAA;AAE3B;AAEA,2BAA2B,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextEditorColorPickerControl.cjs","names":["useRichTextEditorContext","ColorSwatch","Popover","RichTextEditorControl","SimpleGrid","ColorPicker","Tooltip","Group","ActionIcon","IconX","IconCircleOff","IconColorPicker","IconPalette","IconCheck"],"sources":["../../src/RichTextEditorControl/RichTextEditorColorPickerControl.tsx"],"sourcesContent":["import { useState } from 'react';\nimport {\n ActionIcon,\n BoxProps,\n ColorPicker,\n ColorPickerProps,\n ColorSwatch,\n ElementProps,\n Group,\n Popover,\n PopoverProps,\n rem,\n SimpleGrid,\n Tooltip,\n useProps,\n} from '@mantine/core';\nimport { useDisclosure } from '@mantine/hooks';\nimport { IconCheck, IconCircleOff, IconColorPicker, IconPalette, IconX } from '../icons/Icons';\nimport { useRichTextEditorContext } from '../RichTextEditor.context';\nimport { RichTextEditorControl } from './RichTextEditorControl';\n\nexport interface RichTextEditorColorPickerControlProps extends BoxProps, ElementProps<'button'> {\n /** Props added to Popover component */\n popoverProps?: Partial<PopoverProps>;\n\n /** Props added to ColorPicker component */\n colorPickerProps?: Partial<ColorPickerProps>;\n\n /** List of colors that the user can choose from */\n colors: string[];\n}\n\nexport function RichTextEditorColorPickerControl(props: RichTextEditorColorPickerControlProps) {\n const { popoverProps, colors, colorPickerProps, ...others } = useProps(\n 'RichTextEditorColorPickerControl',\n null,\n props\n );\n\n const { editor, labels, getStyles, variant } = useRichTextEditorContext();\n const [opened, { toggle, close }] = useDisclosure(false);\n const [state, setState] = useState<'palette' | 'colorPicker'>('palette');\n const currentColor = editor?.getAttributes('textStyle').color || 'var(--mantine-color-text)';\n\n const handleChange = (value: string, shouldClose = true) => {\n (editor?.chain() as any)?.focus().setColor(value).run();\n shouldClose && close();\n };\n\n const handleClear = () => {\n (editor?.chain() as any)?.focus().unsetColor().run();\n close();\n };\n\n const controls = colors.map((color, index) => (\n <ColorSwatch\n key={index}\n component=\"button\"\n color={color}\n onClick={() => handleChange(color)}\n size={26}\n radius=\"xs\"\n style={{ cursor: 'pointer' }}\n title={labels.colorPickerColorLabel(color)}\n aria-label={labels.colorPickerColorLabel(color)}\n />\n ));\n\n return (\n <Popover\n opened={opened}\n withinPortal\n trapFocus\n onChange={(_opened) => !_opened && close()}\n {...popoverProps}\n >\n <Popover.Target>\n <RichTextEditorControl\n {...others}\n variant={variant}\n aria-label={labels.colorPickerControlLabel}\n title={labels.colorPickerControlLabel}\n onClick={toggle}\n >\n <ColorSwatch color={currentColor} size={14} />\n </RichTextEditorControl>\n </Popover.Target>\n\n <Popover.Dropdown {...getStyles('linkEditorDropdown')}>\n {state === 'palette' && (\n <SimpleGrid cols={7} spacing={2}>\n {controls}\n </SimpleGrid>\n )}\n\n {state === 'colorPicker' && (\n <ColorPicker\n defaultValue={currentColor}\n onChange={(value) => handleChange(value, false)}\n {...colorPickerProps}\n />\n )}\n\n <Tooltip.Group closeDelay={200}>\n <Group justify=\"flex-end\" gap=\"xs\" mt=\"sm\">\n {state === 'palette' && (\n <ActionIcon\n variant=\"default\"\n onClick={close}\n title={labels.colorPickerCancel}\n aria-label={labels.colorPickerCancel}\n >\n <IconX style={{ width: rem(16), height: rem(16) }} />\n </ActionIcon>\n )}\n\n <ActionIcon\n variant=\"default\"\n onClick={handleClear}\n title={labels.colorPickerClear}\n aria-label={labels.colorPickerClear}\n >\n <IconCircleOff style={{ width: rem(16), height: rem(16) }} />\n </ActionIcon>\n\n {state === 'palette' ? (\n <ActionIcon\n variant=\"default\"\n onClick={() => setState('colorPicker')}\n title={labels.colorPickerColorPicker}\n aria-label={labels.colorPickerColorPicker}\n >\n <IconColorPicker style={{ width: rem(16), height: rem(16) }} />\n </ActionIcon>\n ) : (\n <ActionIcon\n variant=\"default\"\n onClick={() => setState('palette')}\n aria-label={labels.colorPickerPalette}\n title={labels.colorPickerPalette}\n >\n <IconPalette style={{ width: rem(16), height: rem(16) }} />\n </ActionIcon>\n )}\n\n {state === 'colorPicker' && (\n <ActionIcon\n variant=\"default\"\n onClick={close}\n title={labels.colorPickerSave}\n aria-label={labels.colorPickerSave}\n >\n <IconCheck style={{ width: rem(16), height: rem(16) }} />\n </ActionIcon>\n )}\n </Group>\n </Tooltip.Group>\n </Popover.Dropdown>\n </Popover>\n );\n}\n\nRichTextEditorColorPickerControl.displayName = '@mantine/tiptap/ColorPickerControl';\n"],"mappings":";;;;;;;;;;AAgCA,SAAgB,iCAAiC,OAA8C;CAC7F,MAAM,EAAE,cAAc,QAAQ,kBAAkB,GAAG,YAAA,GAAA,cAAA,UACjD,oCACA,MACA,
|
|
1
|
+
{"version":3,"file":"RichTextEditorColorPickerControl.cjs","names":["useRichTextEditorContext","ColorSwatch","Popover","RichTextEditorControl","SimpleGrid","ColorPicker","Tooltip","Group","ActionIcon","IconX","IconCircleOff","IconColorPicker","IconPalette","IconCheck"],"sources":["../../src/RichTextEditorControl/RichTextEditorColorPickerControl.tsx"],"sourcesContent":["import { useState } from 'react';\nimport {\n ActionIcon,\n BoxProps,\n ColorPicker,\n ColorPickerProps,\n ColorSwatch,\n ElementProps,\n Group,\n Popover,\n PopoverProps,\n rem,\n SimpleGrid,\n Tooltip,\n useProps,\n} from '@mantine/core';\nimport { useDisclosure } from '@mantine/hooks';\nimport { IconCheck, IconCircleOff, IconColorPicker, IconPalette, IconX } from '../icons/Icons';\nimport { useRichTextEditorContext } from '../RichTextEditor.context';\nimport { RichTextEditorControl } from './RichTextEditorControl';\n\nexport interface RichTextEditorColorPickerControlProps extends BoxProps, ElementProps<'button'> {\n /** Props added to Popover component */\n popoverProps?: Partial<PopoverProps>;\n\n /** Props added to ColorPicker component */\n colorPickerProps?: Partial<ColorPickerProps>;\n\n /** List of colors that the user can choose from */\n colors: string[];\n}\n\nexport function RichTextEditorColorPickerControl(props: RichTextEditorColorPickerControlProps) {\n const { popoverProps, colors, colorPickerProps, ...others } = useProps(\n 'RichTextEditorColorPickerControl',\n null,\n props\n );\n\n const { editor, labels, getStyles, variant } = useRichTextEditorContext();\n const [opened, { toggle, close }] = useDisclosure(false);\n const [state, setState] = useState<'palette' | 'colorPicker'>('palette');\n const currentColor = editor?.getAttributes('textStyle').color || 'var(--mantine-color-text)';\n\n const handleChange = (value: string, shouldClose = true) => {\n (editor?.chain() as any)?.focus().setColor(value).run();\n shouldClose && close();\n };\n\n const handleClear = () => {\n (editor?.chain() as any)?.focus().unsetColor().run();\n close();\n };\n\n const controls = colors.map((color, index) => (\n <ColorSwatch\n key={index}\n component=\"button\"\n color={color}\n onClick={() => handleChange(color)}\n size={26}\n radius=\"xs\"\n style={{ cursor: 'pointer' }}\n title={labels.colorPickerColorLabel(color)}\n aria-label={labels.colorPickerColorLabel(color)}\n />\n ));\n\n return (\n <Popover\n opened={opened}\n withinPortal\n trapFocus\n onChange={(_opened) => !_opened && close()}\n {...popoverProps}\n >\n <Popover.Target>\n <RichTextEditorControl\n {...others}\n variant={variant}\n aria-label={labels.colorPickerControlLabel}\n title={labels.colorPickerControlLabel}\n onClick={toggle}\n >\n <ColorSwatch color={currentColor} size={14} />\n </RichTextEditorControl>\n </Popover.Target>\n\n <Popover.Dropdown {...getStyles('linkEditorDropdown')}>\n {state === 'palette' && (\n <SimpleGrid cols={7} spacing={2}>\n {controls}\n </SimpleGrid>\n )}\n\n {state === 'colorPicker' && (\n <ColorPicker\n defaultValue={currentColor}\n onChange={(value) => handleChange(value, false)}\n {...colorPickerProps}\n />\n )}\n\n <Tooltip.Group closeDelay={200}>\n <Group justify=\"flex-end\" gap=\"xs\" mt=\"sm\">\n {state === 'palette' && (\n <ActionIcon\n variant=\"default\"\n onClick={close}\n title={labels.colorPickerCancel}\n aria-label={labels.colorPickerCancel}\n >\n <IconX style={{ width: rem(16), height: rem(16) }} />\n </ActionIcon>\n )}\n\n <ActionIcon\n variant=\"default\"\n onClick={handleClear}\n title={labels.colorPickerClear}\n aria-label={labels.colorPickerClear}\n >\n <IconCircleOff style={{ width: rem(16), height: rem(16) }} />\n </ActionIcon>\n\n {state === 'palette' ? (\n <ActionIcon\n variant=\"default\"\n onClick={() => setState('colorPicker')}\n title={labels.colorPickerColorPicker}\n aria-label={labels.colorPickerColorPicker}\n >\n <IconColorPicker style={{ width: rem(16), height: rem(16) }} />\n </ActionIcon>\n ) : (\n <ActionIcon\n variant=\"default\"\n onClick={() => setState('palette')}\n aria-label={labels.colorPickerPalette}\n title={labels.colorPickerPalette}\n >\n <IconPalette style={{ width: rem(16), height: rem(16) }} />\n </ActionIcon>\n )}\n\n {state === 'colorPicker' && (\n <ActionIcon\n variant=\"default\"\n onClick={close}\n title={labels.colorPickerSave}\n aria-label={labels.colorPickerSave}\n >\n <IconCheck style={{ width: rem(16), height: rem(16) }} />\n </ActionIcon>\n )}\n </Group>\n </Tooltip.Group>\n </Popover.Dropdown>\n </Popover>\n );\n}\n\nRichTextEditorColorPickerControl.displayName = '@mantine/tiptap/ColorPickerControl';\n"],"mappings":";;;;;;;;;;AAgCA,SAAgB,iCAAiC,OAA8C;CAC7F,MAAM,EAAE,cAAc,QAAQ,kBAAkB,GAAG,YAAA,GAAA,cAAA,UACjD,oCACA,MACA,KACF;CAEA,MAAM,EAAE,QAAQ,QAAQ,WAAW,YAAYA,+BAAAA,yBAAyB;CACxE,MAAM,CAAC,QAAQ,EAAE,QAAQ,YAAA,GAAA,eAAA,eAAyB,KAAK;CACvD,MAAM,CAAC,OAAO,aAAA,GAAA,MAAA,UAAgD,SAAS;CACvE,MAAM,eAAe,QAAQ,cAAc,WAAW,EAAE,SAAS;CAEjE,MAAM,gBAAgB,OAAe,cAAc,SAAS;EAC1D,CAAC,QAAQ,MAAM,IAAW,MAAM,EAAE,SAAS,KAAK,EAAE,IAAI;EACtD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AY,OAAO;kBAEnB,iBAAA,GAAA,kBAAA,KAACK,cAAAA,WAAD,EAAW,OAAO;SAAE,QAAA,GAAA,cAAA,KAAW,EAAE;SAAG,SAAA,GAAA,cAAA,KAAY,EAAE;QAAE,EAAI,CAAA;OAC9C,CAAA;MAET;;IACM,CAAA;GACC;IACX;;AAEb;AAEA,iCAAiC,cAAc"}
|
|
@@ -3,6 +3,7 @@ require("../_virtual/_rolldown/runtime.cjs");
|
|
|
3
3
|
const require_RichTextEditor_module = require("../RichTextEditor.module.cjs");
|
|
4
4
|
const require_RichTextEditor_context = require("../RichTextEditor.context.cjs");
|
|
5
5
|
let _mantine_core = require("@mantine/core");
|
|
6
|
+
let _tiptap_react = require("@tiptap/react");
|
|
6
7
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
8
|
//#region packages/@mantine/tiptap/src/RichTextEditorControl/RichTextEditorControl.tsx
|
|
8
9
|
const defaultProps = { interactive: true };
|
|
@@ -47,12 +48,21 @@ function createControl({ label, isActive, operation, icon, isDisabled }) {
|
|
|
47
48
|
const Control = (props) => {
|
|
48
49
|
const { editor, labels } = require_RichTextEditor_context.useRichTextEditorContext();
|
|
49
50
|
const _label = labels[label];
|
|
51
|
+
const editorState = (0, _tiptap_react.useEditorState)({
|
|
52
|
+
editor: editor ?? null,
|
|
53
|
+
selector: (ctx) => ({
|
|
54
|
+
active: isActive?.name ? ctx.editor?.isActive(isActive.name, isActive.attributes) ?? false : false,
|
|
55
|
+
disabled: isDisabled?.(ctx.editor) ?? false
|
|
56
|
+
})
|
|
57
|
+
});
|
|
58
|
+
const active = editorState?.active ?? false;
|
|
59
|
+
const disabled = editorState?.disabled ?? false;
|
|
50
60
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RichTextEditorControlBase, {
|
|
51
61
|
"aria-label": _label,
|
|
52
62
|
title: _label,
|
|
53
|
-
active
|
|
63
|
+
active,
|
|
54
64
|
icon: props.icon || icon,
|
|
55
|
-
disabled
|
|
65
|
+
disabled,
|
|
56
66
|
...props,
|
|
57
67
|
onClick: () => editor?.chain().focus()[operation.name](operation.attributes).run()
|
|
58
68
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextEditorControl.cjs","names":["useRichTextEditorContext","UnstyledButton","classes"],"sources":["../../src/RichTextEditorControl/RichTextEditorControl.tsx"],"sourcesContent":["import {\n BoxProps,\n CompoundStylesApiProps,\n ElementProps,\n factory,\n Factory,\n UnstyledButton,\n useProps,\n} from '@mantine/core';\nimport { RichTextEditorLabels } from '../labels';\nimport { useRichTextEditorContext } from '../RichTextEditor.context';\nimport classes from '../RichTextEditor.module.css';\n\nexport type RichTextEditorControlStylesNames = 'control';\n\nexport interface RichTextEditorControlProps\n extends BoxProps, CompoundStylesApiProps<RichTextEditorControlFactory>, ElementProps<'button'> {\n /** Determines whether the control should have active state @default false */\n active?: boolean;\n\n /** Determines whether the control can be interacted with, set `false` to make the control to act as a label */\n interactive?: boolean;\n}\n\nexport type RichTextEditorControlFactory = Factory<{\n props: RichTextEditorControlProps;\n ref: HTMLButtonElement;\n stylesNames: RichTextEditorControlStylesNames;\n compound: true;\n}>;\n\nconst defaultProps = {\n interactive: true,\n} satisfies Partial<RichTextEditorControlProps>;\n\nexport const RichTextEditorControl = factory<RichTextEditorControlFactory>((_props) => {\n const props = useProps('RichTextEditorControl', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n vars,\n interactive,\n active,\n onMouseDown,\n disabled,\n ...others\n } = props;\n const ctx = useRichTextEditorContext();\n\n return (\n <UnstyledButton\n {...others}\n {...ctx.getStyles('control', { className, style, classNames, styles })}\n disabled={disabled}\n data-rich-text-editor-control\n tabIndex={interactive ? 0 : -1}\n data-interactive={interactive || undefined}\n data-disabled={disabled || undefined}\n data-active={active || undefined}\n aria-pressed={(active && interactive) || undefined}\n aria-hidden={!interactive || undefined}\n unstyled={ctx.unstyled}\n variant={ctx.variant || 'default'}\n onMouseDown={(event) => {\n event.preventDefault();\n onMouseDown?.(event);\n }}\n />\n );\n});\n\nRichTextEditorControl.classes = classes;\nRichTextEditorControl.displayName = '@mantine/tiptap/RichTextEditorControl';\n\nexport interface RichTextEditorControlBaseProps extends RichTextEditorControlProps {\n icon?: React.FC<{ style: React.CSSProperties }>;\n}\n\nexport function RichTextEditorControlBase({\n className,\n icon: Icon,\n ...others\n}: RichTextEditorControlBaseProps & { icon: React.FC<{ style: React.CSSProperties }> }) {\n const ctx = useRichTextEditorContext();\n\n return (\n <RichTextEditorControl {...others}>\n <Icon {...ctx.getStyles('controlIcon')} />\n </RichTextEditorControl>\n );\n}\n\nRichTextEditorControlBase.displayName = '@mantine/tiptap/RichTextEditorControlBase';\n\nexport interface CreateControlProps {\n label: keyof RichTextEditorLabels;\n icon: React.FC<{ style: React.CSSProperties }>;\n isActive?: { name: string; attributes?: Record<string, any> | string };\n isDisabled?: (editor: any) => boolean;\n operation: { name: string; attributes?: Record<string, any> | string };\n}\n\nexport function createControl({\n label,\n isActive,\n operation,\n icon,\n isDisabled,\n}: CreateControlProps) {\n const Control = (props: RichTextEditorControlBaseProps) => {\n const { editor, labels } = useRichTextEditorContext();\n const _label = labels[label] as string;\n
|
|
1
|
+
{"version":3,"file":"RichTextEditorControl.cjs","names":["useRichTextEditorContext","UnstyledButton","classes"],"sources":["../../src/RichTextEditorControl/RichTextEditorControl.tsx"],"sourcesContent":["import { useEditorState } from '@tiptap/react';\nimport {\n BoxProps,\n CompoundStylesApiProps,\n ElementProps,\n factory,\n Factory,\n UnstyledButton,\n useProps,\n} from '@mantine/core';\nimport { RichTextEditorLabels } from '../labels';\nimport { useRichTextEditorContext } from '../RichTextEditor.context';\nimport classes from '../RichTextEditor.module.css';\n\nexport type RichTextEditorControlStylesNames = 'control';\n\nexport interface RichTextEditorControlProps\n extends BoxProps, CompoundStylesApiProps<RichTextEditorControlFactory>, ElementProps<'button'> {\n /** Determines whether the control should have active state @default false */\n active?: boolean;\n\n /** Determines whether the control can be interacted with, set `false` to make the control to act as a label */\n interactive?: boolean;\n}\n\nexport type RichTextEditorControlFactory = Factory<{\n props: RichTextEditorControlProps;\n ref: HTMLButtonElement;\n stylesNames: RichTextEditorControlStylesNames;\n compound: true;\n}>;\n\nconst defaultProps = {\n interactive: true,\n} satisfies Partial<RichTextEditorControlProps>;\n\nexport const RichTextEditorControl = factory<RichTextEditorControlFactory>((_props) => {\n const props = useProps('RichTextEditorControl', defaultProps, _props);\n const {\n classNames,\n className,\n style,\n styles,\n vars,\n interactive,\n active,\n onMouseDown,\n disabled,\n ...others\n } = props;\n const ctx = useRichTextEditorContext();\n\n return (\n <UnstyledButton\n {...others}\n {...ctx.getStyles('control', { className, style, classNames, styles })}\n disabled={disabled}\n data-rich-text-editor-control\n tabIndex={interactive ? 0 : -1}\n data-interactive={interactive || undefined}\n data-disabled={disabled || undefined}\n data-active={active || undefined}\n aria-pressed={(active && interactive) || undefined}\n aria-hidden={!interactive || undefined}\n unstyled={ctx.unstyled}\n variant={ctx.variant || 'default'}\n onMouseDown={(event) => {\n event.preventDefault();\n onMouseDown?.(event);\n }}\n />\n );\n});\n\nRichTextEditorControl.classes = classes;\nRichTextEditorControl.displayName = '@mantine/tiptap/RichTextEditorControl';\n\nexport interface RichTextEditorControlBaseProps extends RichTextEditorControlProps {\n icon?: React.FC<{ style: React.CSSProperties }>;\n}\n\nexport function RichTextEditorControlBase({\n className,\n icon: Icon,\n ...others\n}: RichTextEditorControlBaseProps & { icon: React.FC<{ style: React.CSSProperties }> }) {\n const ctx = useRichTextEditorContext();\n\n return (\n <RichTextEditorControl {...others}>\n <Icon {...ctx.getStyles('controlIcon')} />\n </RichTextEditorControl>\n );\n}\n\nRichTextEditorControlBase.displayName = '@mantine/tiptap/RichTextEditorControlBase';\n\nexport interface CreateControlProps {\n label: keyof RichTextEditorLabels;\n icon: React.FC<{ style: React.CSSProperties }>;\n isActive?: { name: string; attributes?: Record<string, any> | string };\n isDisabled?: (editor: any) => boolean;\n operation: { name: string; attributes?: Record<string, any> | string };\n}\n\nexport function createControl({\n label,\n isActive,\n operation,\n icon,\n isDisabled,\n}: CreateControlProps) {\n const Control = (props: RichTextEditorControlBaseProps) => {\n const { editor, labels } = useRichTextEditorContext();\n const _label = labels[label] as string;\n const editorState = useEditorState({\n editor: editor ?? null,\n selector: (ctx) => ({\n active: isActive?.name\n ? (ctx.editor?.isActive(isActive.name, isActive.attributes) ?? false)\n : false,\n disabled: isDisabled?.(ctx.editor) ?? false,\n }),\n });\n\n const active = editorState?.active ?? false;\n const disabled = editorState?.disabled ?? false;\n\n return (\n <RichTextEditorControlBase\n aria-label={_label}\n title={_label}\n active={active}\n icon={props.icon || icon}\n disabled={disabled}\n {...props}\n onClick={() => (editor as any)?.chain().focus()[operation.name](operation.attributes).run()}\n />\n );\n };\n\n Control.displayName = `@mantine/tiptap/${label}`;\n\n return Control;\n}\n"],"mappings":";;;;;;;;AAgCA,MAAM,eAAe,EACnB,aAAa,KACf;AAEA,MAAa,yBAAA,GAAA,cAAA,UAA+D,WAAW;CAErF,MAAM,EACJ,YACA,WACA,OACA,QACA,MACA,aACA,QACA,aACA,UACA,GAAG,YAAA,GAAA,cAAA,UAXkB,yBAAyB,cAAc,MAYtD;CACR,MAAM,MAAMA,+BAAAA,yBAAyB;CAErC,OACE,iBAAA,GAAA,kBAAA,KAACC,cAAAA,gBAAD;EACE,GAAI;EACJ,GAAI,IAAI,UAAU,WAAW;GAAE;GAAW;GAAO;GAAY;EAAO,CAAC;EAC3D;EACV,iCAAA;EACA,UAAU,cAAc,IAAI;EAC5B,oBAAkB,eAAe,KAAA;EACjC,iBAAe,YAAY,KAAA;EAC3B,eAAa,UAAU,KAAA;EACvB,gBAAe,UAAU,eAAgB,KAAA;EACzC,eAAa,CAAC,eAAe,KAAA;EAC7B,UAAU,IAAI;EACd,SAAS,IAAI,WAAW;EACxB,cAAc,UAAU;GACtB,MAAM,eAAe;GACrB,cAAc,KAAK;EACrB;CACD,CAAA;AAEL,CAAC;AAED,sBAAsB,UAAUC,8BAAAA;AAChC,sBAAsB,cAAc;AAMpC,SAAgB,0BAA0B,EACxC,WACA,MAAM,MACN,GAAG,UACmF;CACtF,MAAM,MAAMF,+BAAAA,yBAAyB;CAErC,OACE,iBAAA,GAAA,kBAAA,KAAC,uBAAD;EAAuB,GAAI;YACzB,iBAAA,GAAA,kBAAA,KAAC,MAAD,EAAM,GAAI,IAAI,UAAU,aAAa,EAAI,CAAA;CACpB,CAAA;AAE3B;AAEA,0BAA0B,cAAc;AAUxC,SAAgB,cAAc,EAC5B,OACA,UACA,WACA,MACA,cACqB;CACrB,MAAM,WAAW,UAA0C;EACzD,MAAM,EAAE,QAAQ,WAAWA,+BAAAA,yBAAyB;EACpD,MAAM,SAAS,OAAO;EACtB,MAAM,eAAA,GAAA,cAAA,gBAA6B;GACjC,QAAQ,UAAU;GAClB,WAAW,SAAS;IAClB,QAAQ,UAAU,OACb,IAAI,QAAQ,SAAS,SAAS,MAAM,SAAS,UAAU,KAAK,QAC7D;IACJ,UAAU,aAAa,IAAI,MAAM,KAAK;GACxC;EACF,CAAC;EAED,MAAM,SAAS,aAAa,UAAU;EACtC,MAAM,WAAW,aAAa,YAAY;EAE1C,OACE,iBAAA,GAAA,kBAAA,KAAC,2BAAD;GACE,cAAY;GACZ,OAAO;GACC;GACR,MAAM,MAAM,QAAQ;GACV;GACV,GAAI;GACJ,eAAgB,QAAgB,MAAM,EAAE,MAAM,EAAE,UAAU,MAAM,UAAU,UAAU,EAAE,IAAI;EAC3F,CAAA;CAEL;CAEA,QAAQ,cAAc,mBAAmB;CAEzC,OAAO;AACT"}
|
|
@@ -6,6 +6,7 @@ const require_Icons = require("../icons/Icons.cjs");
|
|
|
6
6
|
const require_RichTextEditorControl = require("./RichTextEditorControl.cjs");
|
|
7
7
|
let react = require("react");
|
|
8
8
|
let _mantine_core = require("@mantine/core");
|
|
9
|
+
let _tiptap_react = require("@tiptap/react");
|
|
9
10
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
11
|
let _mantine_hooks = require("@mantine/hooks");
|
|
11
12
|
//#region packages/@mantine/tiptap/src/RichTextEditorControl/RichTextEditorLinkControl.tsx
|
|
@@ -46,6 +47,10 @@ const RichTextEditorLinkControl = (0, _mantine_core.factory)((_props) => {
|
|
|
46
47
|
}
|
|
47
48
|
};
|
|
48
49
|
(0, _mantine_hooks.useWindowEvent)("edit-link", handleOpen, false);
|
|
50
|
+
const active = (0, _tiptap_react.useEditorState)({
|
|
51
|
+
editor: ctx.editor ?? null,
|
|
52
|
+
selector: (state) => state.editor?.isActive("link") ?? false
|
|
53
|
+
});
|
|
49
54
|
const { resolvedClassNames, resolvedStyles } = (0, _mantine_core.useResolvedStylesApi)({
|
|
50
55
|
classNames,
|
|
51
56
|
styles,
|
|
@@ -66,7 +71,7 @@ const RichTextEditorLinkControl = (0, _mantine_core.factory)((_props) => {
|
|
|
66
71
|
"aria-label": ctx.labels.linkControlLabel,
|
|
67
72
|
title: ctx.labels.linkControlLabel,
|
|
68
73
|
onClick: handleOpen,
|
|
69
|
-
active:
|
|
74
|
+
active: active ?? false,
|
|
70
75
|
classNames: resolvedClassNames,
|
|
71
76
|
styles: resolvedStyles,
|
|
72
77
|
className,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextEditorLinkControl.cjs","names":["IconLink","useRichTextEditorContext","Popover","RichTextEditorControlBase","TextInput","Tooltip","UnstyledButton","IconExternalLink","Button","classes"],"sources":["../../src/RichTextEditorControl/RichTextEditorLinkControl.tsx"],"sourcesContent":["import { useState } from 'react';\nimport {\n BoxProps,\n Button,\n CompoundStylesApiProps,\n factory,\n Factory,\n Popover,\n PopoverProps,\n rem,\n TextInput,\n Tooltip,\n UnstyledButton,\n useProps,\n useResolvedStylesApi,\n} from '@mantine/core';\nimport { useDisclosure, useInputState, useWindowEvent } from '@mantine/hooks';\nimport { IconExternalLink, IconLink } from '../icons/Icons';\nimport { useRichTextEditorContext } from '../RichTextEditor.context';\nimport { RichTextEditorControlBase, RichTextEditorControlBaseProps } from './RichTextEditorControl';\nimport classes from '../RichTextEditor.module.css';\n\nexport type RichTextEditorLinkControlStylesNames =\n | 'control'\n | 'linkEditor'\n | 'linkEditorDropdown'\n | 'linkEditorSave'\n | 'linkEditorInput'\n | 'linkEditorExternalControl';\n\nexport interface RichTextEditorLinkControlProps\n extends\n BoxProps,\n Omit<RichTextEditorControlBaseProps, 'classNames' | 'styles' | 'vars'>,\n CompoundStylesApiProps<RichTextEditorLinkControlFactory> {\n /** Props passed down to Popover component */\n popoverProps?: Partial<PopoverProps>;\n\n /** Determines whether external link control tooltip should be disabled @default false */\n disableTooltips?: boolean;\n\n /** Initial state for determining whether the link should be an external @default false */\n initialExternal?: boolean;\n}\n\nexport type RichTextEditorLinkControlFactory = Factory<{\n props: RichTextEditorLinkControlProps;\n ref: HTMLButtonElement;\n stylesNames: RichTextEditorLinkControlStylesNames;\n compound: true;\n}>;\n\nconst LinkIcon: RichTextEditorControlBaseProps['icon'] = (props) => <IconLink {...props} />;\n\nexport const RichTextEditorLinkControl = factory<RichTextEditorLinkControlFactory>((_props) => {\n const props = useProps('RichTextEditorLinkControl', null, _props);\n const {\n classNames,\n className,\n style,\n styles,\n vars,\n icon,\n popoverProps,\n disableTooltips,\n initialExternal,\n ...others\n } = props;\n\n const ctx = useRichTextEditorContext();\n\n const stylesApiProps = { classNames, styles };\n\n const [url, setUrl] = useInputState('');\n const [external, setExternal] = useState(initialExternal);\n const [opened, { open, close }] = useDisclosure(false);\n\n const handleOpen = () => {\n open();\n const linkData = ctx.editor?.getAttributes('link');\n setUrl(linkData?.href || '');\n setExternal(linkData?.href ? linkData?.target === '_blank' : initialExternal);\n };\n\n const handleClose = () => {\n close();\n setUrl('');\n setExternal(initialExternal);\n };\n\n const setLink = () => {\n handleClose();\n url === ''\n ? ctx.editor?.chain().focus().extendMarkRange('link').unsetLink().run()\n : ctx.editor\n ?.chain()\n .focus()\n .extendMarkRange('link')\n .setLink({ href: url, target: external ? '_blank' : null })\n .run();\n };\n\n const handleInputKeydown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n event.preventDefault();\n setLink();\n }\n };\n\n useWindowEvent('edit-link', handleOpen, false);\n\n const { resolvedClassNames, resolvedStyles } =\n useResolvedStylesApi<RichTextEditorLinkControlFactory>({ classNames, styles, props });\n\n return (\n <Popover\n trapFocus\n shadow=\"md\"\n withinPortal\n opened={opened}\n onChange={(_opened) => !_opened && handleClose()}\n offset={-44}\n zIndex={10000}\n {...popoverProps}\n >\n <Popover.Target>\n <RichTextEditorControlBase\n icon={icon || LinkIcon}\n {...others}\n aria-label={ctx.labels.linkControlLabel}\n title={ctx.labels.linkControlLabel}\n onClick={handleOpen}\n active={
|
|
1
|
+
{"version":3,"file":"RichTextEditorLinkControl.cjs","names":["IconLink","useRichTextEditorContext","Popover","RichTextEditorControlBase","TextInput","Tooltip","UnstyledButton","IconExternalLink","Button","classes"],"sources":["../../src/RichTextEditorControl/RichTextEditorLinkControl.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { useEditorState } from '@tiptap/react';\nimport {\n BoxProps,\n Button,\n CompoundStylesApiProps,\n factory,\n Factory,\n Popover,\n PopoverProps,\n rem,\n TextInput,\n Tooltip,\n UnstyledButton,\n useProps,\n useResolvedStylesApi,\n} from '@mantine/core';\nimport { useDisclosure, useInputState, useWindowEvent } from '@mantine/hooks';\nimport { IconExternalLink, IconLink } from '../icons/Icons';\nimport { useRichTextEditorContext } from '../RichTextEditor.context';\nimport { RichTextEditorControlBase, RichTextEditorControlBaseProps } from './RichTextEditorControl';\nimport classes from '../RichTextEditor.module.css';\n\nexport type RichTextEditorLinkControlStylesNames =\n | 'control'\n | 'linkEditor'\n | 'linkEditorDropdown'\n | 'linkEditorSave'\n | 'linkEditorInput'\n | 'linkEditorExternalControl';\n\nexport interface RichTextEditorLinkControlProps\n extends\n BoxProps,\n Omit<RichTextEditorControlBaseProps, 'classNames' | 'styles' | 'vars'>,\n CompoundStylesApiProps<RichTextEditorLinkControlFactory> {\n /** Props passed down to Popover component */\n popoverProps?: Partial<PopoverProps>;\n\n /** Determines whether external link control tooltip should be disabled @default false */\n disableTooltips?: boolean;\n\n /** Initial state for determining whether the link should be an external @default false */\n initialExternal?: boolean;\n}\n\nexport type RichTextEditorLinkControlFactory = Factory<{\n props: RichTextEditorLinkControlProps;\n ref: HTMLButtonElement;\n stylesNames: RichTextEditorLinkControlStylesNames;\n compound: true;\n}>;\n\nconst LinkIcon: RichTextEditorControlBaseProps['icon'] = (props) => <IconLink {...props} />;\n\nexport const RichTextEditorLinkControl = factory<RichTextEditorLinkControlFactory>((_props) => {\n const props = useProps('RichTextEditorLinkControl', null, _props);\n const {\n classNames,\n className,\n style,\n styles,\n vars,\n icon,\n popoverProps,\n disableTooltips,\n initialExternal,\n ...others\n } = props;\n\n const ctx = useRichTextEditorContext();\n\n const stylesApiProps = { classNames, styles };\n\n const [url, setUrl] = useInputState('');\n const [external, setExternal] = useState(initialExternal);\n const [opened, { open, close }] = useDisclosure(false);\n\n const handleOpen = () => {\n open();\n const linkData = ctx.editor?.getAttributes('link');\n setUrl(linkData?.href || '');\n setExternal(linkData?.href ? linkData?.target === '_blank' : initialExternal);\n };\n\n const handleClose = () => {\n close();\n setUrl('');\n setExternal(initialExternal);\n };\n\n const setLink = () => {\n handleClose();\n url === ''\n ? ctx.editor?.chain().focus().extendMarkRange('link').unsetLink().run()\n : ctx.editor\n ?.chain()\n .focus()\n .extendMarkRange('link')\n .setLink({ href: url, target: external ? '_blank' : null })\n .run();\n };\n\n const handleInputKeydown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Enter') {\n event.preventDefault();\n setLink();\n }\n };\n\n useWindowEvent('edit-link', handleOpen, false);\n\n const active = useEditorState({\n editor: ctx.editor ?? null,\n selector: (state) => state.editor?.isActive('link') ?? false,\n });\n\n const { resolvedClassNames, resolvedStyles } =\n useResolvedStylesApi<RichTextEditorLinkControlFactory>({ classNames, styles, props });\n\n return (\n <Popover\n trapFocus\n shadow=\"md\"\n withinPortal\n opened={opened}\n onChange={(_opened) => !_opened && handleClose()}\n offset={-44}\n zIndex={10000}\n {...popoverProps}\n >\n <Popover.Target>\n <RichTextEditorControlBase\n icon={icon || LinkIcon}\n {...others}\n aria-label={ctx.labels.linkControlLabel}\n title={ctx.labels.linkControlLabel}\n onClick={handleOpen}\n active={active ?? false}\n classNames={resolvedClassNames}\n styles={resolvedStyles}\n className={className}\n style={style}\n variant={ctx.variant}\n />\n </Popover.Target>\n\n <Popover.Dropdown {...ctx.getStyles('linkEditorDropdown', stylesApiProps)}>\n <div {...ctx.getStyles('linkEditor', stylesApiProps)}>\n <TextInput\n placeholder={ctx.labels.linkEditorInputPlaceholder}\n aria-label={ctx.labels.linkEditorInputLabel}\n type=\"url\"\n value={url}\n onChange={setUrl}\n classNames={{ input: ctx.getStyles('linkEditorInput', stylesApiProps).className }}\n onKeyDown={handleInputKeydown}\n rightSection={\n <Tooltip\n label={\n external ? ctx.labels.linkEditorExternalLink : ctx.labels.linkEditorInternalLink\n }\n events={{ hover: true, focus: true, touch: true }}\n withinPortal\n withArrow\n disabled={disableTooltips}\n zIndex={10000}\n >\n <UnstyledButton\n onClick={() => setExternal((e) => !e)}\n data-active={external || undefined}\n {...ctx.getStyles('linkEditorExternalControl', stylesApiProps)}\n >\n <IconExternalLink style={{ width: rem(14), height: rem(14) }} />\n </UnstyledButton>\n </Tooltip>\n }\n />\n\n <Button\n variant=\"default\"\n onClick={setLink}\n {...ctx.getStyles('linkEditorSave', stylesApiProps)}\n >\n {ctx.labels.linkEditorSave}\n </Button>\n </div>\n </Popover.Dropdown>\n </Popover>\n );\n});\n\nRichTextEditorLinkControl.classes = classes;\nRichTextEditorLinkControl.displayName = '@mantine/tiptap/RichTextEditorLinkControl';\n"],"mappings":";;;;;;;;;;;;AAqDA,MAAM,YAAoD,UAAU,iBAAA,GAAA,kBAAA,KAACA,cAAAA,UAAD,EAAU,GAAI,MAAQ,CAAA;AAE1F,MAA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,iBAAA,GAAA,kBAAA,KAACC,cAAAA,kBAAD,EAAkB,OAAO;QAAE,QAAA,GAAA,cAAA,KAAW,EAAE;QAAG,SAAA,GAAA,cAAA,KAAY,EAAE;OAAE,EAAI,CAAA;MACjD,CAAA;KACT,CAAA;IAEZ,CAAA,GAED,iBAAA,GAAA,kBAAA,KAACC,cAAAA,QAAD;KACE,SAAQ;KACR,SAAS;KACT,GAAI,IAAI,UAAU,kBAAkB,cAAc;eAEjD,IAAI,OAAO;IACN,CAAA,CACL;;EACW,CAAA,CACX;;AAEb,CAAC;AAED,0BAA0B,UAAUC,8BAAAA;AACpC,0BAA0B,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextEditorSourceCodeControl.cjs","names":["useRichTextEditorContext","RichTextEditorControl","IconBraces"],"sources":["../../src/RichTextEditorControl/RichTextEditorSourceCodeControl.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { BoxProps, ElementProps, rem, useProps } from '@mantine/core';\nimport { IconBraces } from '../icons/Icons';\nimport { useRichTextEditorContext } from '../RichTextEditor.context';\nimport { RichTextEditorControl } from './RichTextEditorControl';\n\nexport interface RichTextEditorSourceCodeControlProps extends BoxProps, ElementProps<'button'> {}\n\nconst defaultProps: Partial<RichTextEditorSourceCodeControlProps> = {};\n\nexport function RichTextEditorSourceCodeControl(props: RichTextEditorSourceCodeControlProps) {\n const { ...others } = useProps('RichTextEditorSourceCodeControl', defaultProps, props);\n const { editor, labels, variant, onSourceCodeTextSwitch } = useRichTextEditorContext();\n const [isSourceCodeModeActive, setIsSourceCodeModeActive] = useState(false);\n\n const handleStateChange = () => {\n if (isSourceCodeModeActive) {\n editor?.commands.setContent(editor.getText(), { emitUpdate: true });\n } else {\n editor?.commands.setContent(`<textarea>${editor.getHTML()}</textarea>`);\n }\n\n const isSourceCodeModeActiveNew = !isSourceCodeModeActive;\n\n setIsSourceCodeModeActive(isSourceCodeModeActiveNew);\n onSourceCodeTextSwitch?.(isSourceCodeModeActiveNew);\n };\n\n return (\n <RichTextEditorControl\n {...others}\n variant={variant}\n active={isSourceCodeModeActive}\n aria-label={labels.sourceCodeControlLabel}\n title={labels.sourceCodeControlLabel}\n onClick={() => handleStateChange()}\n >\n <IconBraces style={{ width: rem(16), height: rem(16) }} />\n </RichTextEditorControl>\n );\n}\n\nRichTextEditorSourceCodeControl.displayName = '@mantine/tiptap/RichTextEditorSourceCodeControl';\n"],"mappings":";;;;;;;;;AAQA,MAAM,eAA8D,
|
|
1
|
+
{"version":3,"file":"RichTextEditorSourceCodeControl.cjs","names":["useRichTextEditorContext","RichTextEditorControl","IconBraces"],"sources":["../../src/RichTextEditorControl/RichTextEditorSourceCodeControl.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { BoxProps, ElementProps, rem, useProps } from '@mantine/core';\nimport { IconBraces } from '../icons/Icons';\nimport { useRichTextEditorContext } from '../RichTextEditor.context';\nimport { RichTextEditorControl } from './RichTextEditorControl';\n\nexport interface RichTextEditorSourceCodeControlProps extends BoxProps, ElementProps<'button'> {}\n\nconst defaultProps: Partial<RichTextEditorSourceCodeControlProps> = {};\n\nexport function RichTextEditorSourceCodeControl(props: RichTextEditorSourceCodeControlProps) {\n const { ...others } = useProps('RichTextEditorSourceCodeControl', defaultProps, props);\n const { editor, labels, variant, onSourceCodeTextSwitch } = useRichTextEditorContext();\n const [isSourceCodeModeActive, setIsSourceCodeModeActive] = useState(false);\n\n const handleStateChange = () => {\n if (isSourceCodeModeActive) {\n editor?.commands.setContent(editor.getText(), { emitUpdate: true });\n } else {\n editor?.commands.setContent(`<textarea>${editor.getHTML()}</textarea>`);\n }\n\n const isSourceCodeModeActiveNew = !isSourceCodeModeActive;\n\n setIsSourceCodeModeActive(isSourceCodeModeActiveNew);\n onSourceCodeTextSwitch?.(isSourceCodeModeActiveNew);\n };\n\n return (\n <RichTextEditorControl\n {...others}\n variant={variant}\n active={isSourceCodeModeActive}\n aria-label={labels.sourceCodeControlLabel}\n title={labels.sourceCodeControlLabel}\n onClick={() => handleStateChange()}\n >\n <IconBraces style={{ width: rem(16), height: rem(16) }} />\n </RichTextEditorControl>\n );\n}\n\nRichTextEditorSourceCodeControl.displayName = '@mantine/tiptap/RichTextEditorSourceCodeControl';\n"],"mappings":";;;;;;;;;AAQA,MAAM,eAA8D,CAAC;AAErE,SAAgB,gCAAgC,OAA6C;CAC3F,MAAM,EAAE,GAAG,YAAA,GAAA,cAAA,UAAoB,mCAAmC,cAAc,KAAK;CACrF,MAAM,EAAE,QAAQ,QAAQ,SAAS,2BAA2BA,+BAAAA,yBAAyB;CACrF,MAAM,CAAC,wBAAwB,8BAAA,GAAA,MAAA,UAAsC,KAAK;CAE1E,MAAM,0BAA0B;EAC9B,IAAI,wBACF,QAAQ,SAAS,WAAW,OAAO,QAAQ,GAAG,EAAE,YAAY,KAAK,CAAC;OAElE,QAAQ,SAAS,WAAW,aAAa,OAAO,QAAQ,EAAE,YAAY;EAGxE,MAAM,4BAA4B,CAAC;EAEnC,0BAA0B,yBAAyB;EACnD,yBAAyB,yBAAyB;CACpD;CAEA,OACE,iBAAA,GAAA,kBAAA,KAACC,8BAAAA,uBAAD;EACE,GAAI;EACK;EACT,QAAQ;EACR,cAAY,OAAO;EACnB,OAAO,OAAO;EACd,eAAe,kBAAkB;YAEjC,iBAAA,GAAA,kBAAA,KAACC,cAAAA,YAAD,EAAY,OAAO;GAAE,QAAA,GAAA,cAAA,KAAW,EAAE;GAAG,SAAA,GAAA,cAAA,KAAY,EAAE;EAAE,EAAI,CAAA;CACpC,CAAA;AAE3B;AAEA,gCAAgC,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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,OAAS,CAAA;CACxC,UAAU,EAAE,MAAM,QAAQ;CAC1B,WAAW,EAAE,MAAM,cAAc;CAClC,CAAC;AAEF,MAAa,gBAAgBD,8BAAAA,cAAc;CACzC,OAAO;CACP,OAAO,UAAU,iBAAA,GAAA,kBAAA,KAACE,cAAAA,YAAD,EAAY,GAAI,OAAS,CAAA;CAC1C,UAAU,EAAE,MAAM,UAAU;CAC5B,WAAW,EAAE,MAAM,gBAAgB;CACpC,CAAC;AAEF,MAAa,mBAAmBF,8BAAAA,cAAc;CAC5C,OAAO;CACP,OAAO,UAAU,iBAAA,GAAA,kBAAA,KAACG,cAAAA,eAAD,EAAe,GAAI,OAAS,CAAA;CAC7C,UAAU,EAAE,MAAM,aAAa;CAC/B,WAAW,EAAE,MAAM,mBAAmB;CACvC,CAAC;AAEF,MAAa,uBAAuBH,8BAAAA,cAAc;CAChD,OAAO;CACP,OAAO,UAAU,iBAAA,GAAA,kBAAA,KAACI,cAAAA,mBAAD,EAAmB,GAAI,OAAS,CAAA;CACjD,UAAU,EAAE,MAAM,UAAU;CAC5B,WAAW,E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,EAAE,MAAM,QAAQ;CAC5B,CAAC;AAEF,MAAa,cAAc1B,8BAAAA,cAAc;CACvC,OAAO;CACP,OAAO,UAAU,iBAAA,GAAA,kBAAA,KAAC2B,cAAAA,oBAAD,EAAoB,GAAI,OAAS,CAAA;CAClD,aAAa,WAAW,CAAC,QAAQ,KAAK,CAAC,MAAM;CAC7C,WAAW,EAAE,MAAM,QAAQ;CAC5B,CAAC;AAEF,MAAa,kBAAkB3B,8BAAAA,cAAc;CAC3C,OAAO;CACP,OAAO,UAAU,iBAAA,GAAA,kBAAA,KAAC4B,cAAAA,eAAD,EAAe,GAAI,OAAS,CAAA;CAC7C,UAAU,EAAE,MAAM,YAAY;CAC9B,WAAW,EAAE,MAAM,kBAAkB;CACtC,CAAC;AAEF,MAAa,sBAAsB5B,8BAAAA,cAAc;CAC/C,OAAO;CACP,OAAO,UAAU,iBAAA,GAAA,kBAAA,KAAC6B,cAAAA,oBAAD,EAAoB,GAAI,OAAS,CAAA;CAClD,WAAW;EAAE,MAAM;EAAgB,YAAY;EAAY;CAC3D,aAAa,WAAW,CAAC,QAAQ,KAAK,CAAC,aAAa,WAAW;CAChE,CAAC;AAEF,MAAa,sBAAsB7B,8BAAAA,cAAc;CAC/C,OAAO;CACP,OAAO,UAAU,iBAAA,GAAA,kBAAA,KAAC8B,cAAAA,oBAAD,EAAoB,GAAI,OAAS,CAAA;CAClD,WAAW;EAAE,MAAM;EAAgB,YAAY;EAAY;CAC3D,aAAa,WAAW,CAAC,QAAQ,KAAK,CAAC,aAAa,WAAW;CAChE,CAAC"}
|
|
1
|
+
{"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,CAAA;CAC5C,UAAU,EAAE,MAAM,YAAY;CAC9B,WAAW,EAAE,MAAM,kBAAkB;AACvC,CAAC;AAED,MAAa,uBAAuBH,8BAAAA,cAAc;CAChD,OAAO;CACP,OAAO,UAAU,iBAAA,GAAA,kBAAA,KAACI,cAAAA,mBAAD,EAAmB,GAAI,MAAQ,CAAA;CAChD,UAAU,EAAE,MAAM,SAAS;CAC3B,WAAW,EAAE,MAAM,eAAe;AACpC,CAAC;AAED,MAAa,yBAAy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B,8BAAAA,cAAc;CACvC,OAAO;CACP,OAAO,UAAU,iBAAA,GAAA,kBAAA,KAAC2B,cAAAA,oBAAD,EAAoB,GAAI,MAAQ,CAAA;CACjD,aAAa,WAAW,CAAC,QAAQ,IAAI,EAAE,KAAK;CAC5C,WAAW,EAAE,MAAM,OAAO;AAC5B,CAAC;AAED,MAAa,kBAAkB3B,8BAAAA,cAAc;CAC3C,OAAO;CACP,OAAO,UAAU,iBAAA,GAAA,kBAAA,KAAC4B,cAAAA,eAAD,EAAe,GAAI,MAAQ,CAAA;CAC5C,UAAU,EAAE,MAAM,WAAW;CAC7B,WAAW,EAAE,MAAM,iBAAiB;AACtC,CAAC;AAED,MAAa,sBAAsB5B,8BAAAA,cAAc;CAC/C,OAAO;CACP,OAAO,UAAU,iBAAA,GAAA,kBAAA,KAAC6B,cAAAA,oBAAD,EAAoB,GAAI,MAAQ,CAAA;CACjD,WAAW;EAAE,MAAM;EAAgB,YAAY;CAAW;CAC1D,aAAa,WAAW,CAAC,QAAQ,IAAI,EAAE,aAAa,UAAU;AAChE,CAAC;AAED,MAAa,sBAAsB7B,8BAAAA,cAAc;CAC/C,OAAO;CACP,OAAO,UAAU,iBAAA,GAAA,kBAAA,KAAC8B,cAAAA,oBAAD,EAAoB,GAAI,MAAQ,CAAA;CACjD,WAAW;EAAE,MAAM;EAAgB,YAAY;CAAW;CAC1D,aAAa,WAAW,CAAC,QAAQ,IAAI,EAAE,aAAa,UAAU;AAChE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextEditorControlsGroup.cjs","names":["useRichTextEditorContext","Box","classes"],"sources":["../../src/RichTextEditorControlsGroup/RichTextEditorControlsGroup.tsx"],"sourcesContent":["import {\n Box,\n BoxProps,\n CompoundStylesApiProps,\n ElementProps,\n factory,\n Factory,\n useProps,\n} from '@mantine/core';\nimport { useRichTextEditorContext } from '../RichTextEditor.context';\nimport classes from '../RichTextEditor.module.css';\n\nexport type RichTextEditorControlsGroupStylesNames = 'controlsGroup';\nexport interface RichTextEditorControlsGroupProps\n extends\n BoxProps,\n CompoundStylesApiProps<RichTextEditorControlsGroupFactory>,\n ElementProps<'div'> {}\n\nexport type RichTextEditorControlsGroupFactory = Factory<{\n props: RichTextEditorControlsGroupProps;\n ref: HTMLDivElement;\n stylesNames: RichTextEditorControlsGroupStylesNames;\n compound: true;\n}>;\n\nexport const RichTextEditorControlsGroup = factory<RichTextEditorControlsGroupFactory>((_props) => {\n const props = useProps('RichTextEditorControlsGroup', null, _props);\n const { classNames, className, style, styles, vars, variant, ...others } = props;\n const ctx = useRichTextEditorContext();\n return (\n <Box\n variant={variant || ctx.variant}\n {...ctx.getStyles('controlsGroup', { className, style, styles, classNames })}\n {...others}\n />\n );\n});\n\nRichTextEditorControlsGroup.classes = classes;\nRichTextEditorControlsGroup.displayName = '@mantine/tiptap/RichTextEditorControlsGroup';\n"],"mappings":";;;;;;;AA0BA,MAAa,+BAAA,GAAA,cAAA,UAA2E,WAAW;CAEjG,MAAM,EAAE,YAAY,WAAW,OAAO,QAAQ,MAAM,SAAS,GAAG,YAAA,GAAA,cAAA,UADzC,+BAA+B,MAAM,
|
|
1
|
+
{"version":3,"file":"RichTextEditorControlsGroup.cjs","names":["useRichTextEditorContext","Box","classes"],"sources":["../../src/RichTextEditorControlsGroup/RichTextEditorControlsGroup.tsx"],"sourcesContent":["import {\n Box,\n BoxProps,\n CompoundStylesApiProps,\n ElementProps,\n factory,\n Factory,\n useProps,\n} from '@mantine/core';\nimport { useRichTextEditorContext } from '../RichTextEditor.context';\nimport classes from '../RichTextEditor.module.css';\n\nexport type RichTextEditorControlsGroupStylesNames = 'controlsGroup';\nexport interface RichTextEditorControlsGroupProps\n extends\n BoxProps,\n CompoundStylesApiProps<RichTextEditorControlsGroupFactory>,\n ElementProps<'div'> {}\n\nexport type RichTextEditorControlsGroupFactory = Factory<{\n props: RichTextEditorControlsGroupProps;\n ref: HTMLDivElement;\n stylesNames: RichTextEditorControlsGroupStylesNames;\n compound: true;\n}>;\n\nexport const RichTextEditorControlsGroup = factory<RichTextEditorControlsGroupFactory>((_props) => {\n const props = useProps('RichTextEditorControlsGroup', null, _props);\n const { classNames, className, style, styles, vars, variant, ...others } = props;\n const ctx = useRichTextEditorContext();\n return (\n <Box\n variant={variant || ctx.variant}\n {...ctx.getStyles('controlsGroup', { className, style, styles, classNames })}\n {...others}\n />\n );\n});\n\nRichTextEditorControlsGroup.classes = classes;\nRichTextEditorControlsGroup.displayName = '@mantine/tiptap/RichTextEditorControlsGroup';\n"],"mappings":";;;;;;;AA0BA,MAAa,+BAAA,GAAA,cAAA,UAA2E,WAAW;CAEjG,MAAM,EAAE,YAAY,WAAW,OAAO,QAAQ,MAAM,SAAS,GAAG,YAAA,GAAA,cAAA,UADzC,+BAA+B,MAAM,MACmB;CAC/E,MAAM,MAAMA,+BAAAA,yBAAyB;CACrC,OACE,iBAAA,GAAA,kBAAA,KAACC,cAAAA,KAAD;EACE,SAAS,WAAW,IAAI;EACxB,GAAI,IAAI,UAAU,iBAAiB;GAAE;GAAW;GAAO;GAAQ;EAAW,CAAC;EAC3E,GAAI;CACL,CAAA;AAEL,CAAC;AAED,4BAA4B,UAAUC,8BAAAA;AACtC,4BAA4B,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextEditorToolbar.cjs","names":["useRichTextEditorContext","Box","classes"],"sources":["../../src/RichTextEditorToolbar/RichTextEditorToolbar.tsx"],"sourcesContent":["import {\n Box,\n BoxProps,\n CompoundStylesApiProps,\n ElementProps,\n factory,\n Factory,\n rem,\n useProps,\n} from '@mantine/core';\nimport { useRichTextEditorContext } from '../RichTextEditor.context';\nimport classes from '../RichTextEditor.module.css';\n\nexport type RichTextEditorToolbarStylesNames = 'toolbar';\n\nexport interface RichTextEditorToolbarProps\n extends BoxProps, CompoundStylesApiProps<RichTextEditorToolbarFactory>, ElementProps<'div'> {\n /** Determines whether `position: sticky` styles should be added to the toolbar @default false */\n sticky?: boolean;\n\n /** Sets top style to offset elements with fixed position @default 0 */\n stickyOffset?: React.CSSProperties['top'];\n}\n\nexport type RichTextEditorToolbarFactory = Factory<{\n props: RichTextEditorToolbarProps;\n ref: HTMLDivElement;\n stylesNames: RichTextEditorToolbarStylesNames;\n compound: true;\n}>;\n\nexport const RichTextEditorToolbar = factory<RichTextEditorToolbarFactory>((_props) => {\n const props = useProps('RichTextEditorToolbar', null, _props);\n const {\n classNames,\n className,\n style,\n styles,\n vars,\n sticky,\n stickyOffset,\n mod,\n variant,\n ...others\n } = props;\n const ctx = useRichTextEditorContext();\n\n return (\n <Box\n mod={[{ sticky }, mod]}\n variant={variant || ctx.variant}\n {...ctx.getStyles('toolbar', { className, style, styles, classNames })}\n {...others}\n __vars={{ '--rte-sticky-offset': rem(stickyOffset) }}\n />\n );\n});\n\nRichTextEditorToolbar.classes = classes;\nRichTextEditorToolbar.displayName = '@mantine/tiptap/RichTextEditorToolbar';\n"],"mappings":";;;;;;;AA+BA,MAAa,yBAAA,GAAA,cAAA,UAA+D,WAAW;CAErF,MAAM,EACJ,YACA,WACA,OACA,QACA,MACA,QACA,cACA,KACA,SACA,GAAG,YAAA,GAAA,cAAA,UAXkB,yBAAyB,MAAM,
|
|
1
|
+
{"version":3,"file":"RichTextEditorToolbar.cjs","names":["useRichTextEditorContext","Box","classes"],"sources":["../../src/RichTextEditorToolbar/RichTextEditorToolbar.tsx"],"sourcesContent":["import {\n Box,\n BoxProps,\n CompoundStylesApiProps,\n ElementProps,\n factory,\n Factory,\n rem,\n useProps,\n} from '@mantine/core';\nimport { useRichTextEditorContext } from '../RichTextEditor.context';\nimport classes from '../RichTextEditor.module.css';\n\nexport type RichTextEditorToolbarStylesNames = 'toolbar';\n\nexport interface RichTextEditorToolbarProps\n extends BoxProps, CompoundStylesApiProps<RichTextEditorToolbarFactory>, ElementProps<'div'> {\n /** Determines whether `position: sticky` styles should be added to the toolbar @default false */\n sticky?: boolean;\n\n /** Sets top style to offset elements with fixed position @default 0 */\n stickyOffset?: React.CSSProperties['top'];\n}\n\nexport type RichTextEditorToolbarFactory = Factory<{\n props: RichTextEditorToolbarProps;\n ref: HTMLDivElement;\n stylesNames: RichTextEditorToolbarStylesNames;\n compound: true;\n}>;\n\nexport const RichTextEditorToolbar = factory<RichTextEditorToolbarFactory>((_props) => {\n const props = useProps('RichTextEditorToolbar', null, _props);\n const {\n classNames,\n className,\n style,\n styles,\n vars,\n sticky,\n stickyOffset,\n mod,\n variant,\n ...others\n } = props;\n const ctx = useRichTextEditorContext();\n\n return (\n <Box\n mod={[{ sticky }, mod]}\n variant={variant || ctx.variant}\n {...ctx.getStyles('toolbar', { className, style, styles, classNames })}\n {...others}\n __vars={{ '--rte-sticky-offset': rem(stickyOffset) }}\n />\n );\n});\n\nRichTextEditorToolbar.classes = classes;\nRichTextEditorToolbar.displayName = '@mantine/tiptap/RichTextEditorToolbar';\n"],"mappings":";;;;;;;AA+BA,MAAa,yBAAA,GAAA,cAAA,UAA+D,WAAW;CAErF,MAAM,EACJ,YACA,WACA,OACA,QACA,MACA,QACA,cACA,KACA,SACA,GAAG,YAAA,GAAA,cAAA,UAXkB,yBAAyB,MAAM,MAY9C;CACR,MAAM,MAAMA,+BAAAA,yBAAyB;CAErC,OACE,iBAAA,GAAA,kBAAA,KAACC,cAAAA,KAAD;EACE,KAAK,CAAC,EAAE,OAAO,GAAG,GAAG;EACrB,SAAS,WAAW,IAAI;EACxB,GAAI,IAAI,UAAU,WAAW;GAAE;GAAW;GAAO;GAAQ;EAAW,CAAC;EACrE,GAAI;EACJ,QAAQ,EAAE,wBAAA,GAAA,cAAA,KAA2B,YAAY,EAAE;CACpD,CAAA;AAEL,CAAC;AAED,sBAAsB,UAAUC,8BAAAA;AAChC,sBAAsB,cAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.cjs","names":["TipTapLink"],"sources":["../../src/extensions/Link.ts"],"sourcesContent":["import TipTapLink from '@tiptap/extension-link';\n\nexport const Link = TipTapLink.extend({\n addKeyboardShortcuts: () => ({\n 'Mod-k': () => {\n window.dispatchEvent(new Event('edit-link'));\n return true;\n },\n }),\n}).configure({ openOnClick: false });\n"],"mappings":";;;;;AAEA,MAAa,OAAOA,uBAAAA,QAAW,OAAO,EACpC,6BAA6B,EAC3B,eAAe;
|
|
1
|
+
{"version":3,"file":"Link.cjs","names":["TipTapLink"],"sources":["../../src/extensions/Link.ts"],"sourcesContent":["import TipTapLink from '@tiptap/extension-link';\n\nexport const Link = TipTapLink.extend({\n addKeyboardShortcuts: () => ({\n 'Mod-k': () => {\n window.dispatchEvent(new Event('edit-link'));\n return true;\n },\n }),\n}).configure({ openOnClick: false });\n"],"mappings":";;;;;AAEA,MAAa,OAAOA,uBAAAA,QAAW,OAAO,EACpC,6BAA6B,EAC3B,eAAe;CACb,OAAO,cAAc,IAAI,MAAM,WAAW,CAAC;CAC3C,OAAO;AACT,EACF,GACF,CAAC,EAAE,UAAU,EAAE,aAAa,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskList.cjs","names":["classes"],"sources":["../../src/extensions/TaskList.ts"],"sourcesContent":["import classes from '../RichTextEditor.module.css';\n\nexport const getTaskListExtension = <T>(TipTapTaskList: T): T =>\n (TipTapTaskList as any)\n .extend({\n addKeyboardShortcuts: () => ({\n 'Mod-[': ({ editor }: any) => {\n editor.chain().focus().liftListItem('taskItem').run();\n return true;\n },\n 'Mod-]': ({ editor }: any) => {\n editor.chain().focus().sinkListItem('taskItem').run();\n return true;\n },\n }),\n })\n .configure({\n HTMLAttributes: {\n class: `${classes.taskList} mantine-RichTextEditor-taskList`,\n },\n });\n"],"mappings":";;;AAEA,MAAa,wBAA2B,mBACrC,eACE,OAAO,EACN,6BAA6B;CAC3B,UAAU,EAAE,aAAkB;
|
|
1
|
+
{"version":3,"file":"TaskList.cjs","names":["classes"],"sources":["../../src/extensions/TaskList.ts"],"sourcesContent":["import classes from '../RichTextEditor.module.css';\n\nexport const getTaskListExtension = <T>(TipTapTaskList: T): T =>\n (TipTapTaskList as any)\n .extend({\n addKeyboardShortcuts: () => ({\n 'Mod-[': ({ editor }: any) => {\n editor.chain().focus().liftListItem('taskItem').run();\n return true;\n },\n 'Mod-]': ({ editor }: any) => {\n editor.chain().focus().sinkListItem('taskItem').run();\n return true;\n },\n }),\n })\n .configure({\n HTMLAttributes: {\n class: `${classes.taskList} mantine-RichTextEditor-taskList`,\n },\n });\n"],"mappings":";;;AAEA,MAAa,wBAA2B,mBACrC,eACE,OAAO,EACN,6BAA6B;CAC3B,UAAU,EAAE,aAAkB;EAC5B,OAAO,MAAM,EAAE,MAAM,EAAE,aAAa,UAAU,EAAE,IAAI;EACpD,OAAO;CACT;CACA,UAAU,EAAE,aAAkB;EAC5B,OAAO,MAAM,EAAE,MAAM,EAAE,aAAa,UAAU,EAAE,IAAI;EACpD,OAAO;CACT;AACF,GACF,CAAC,EACA,UAAU,EACT,gBAAgB,EACd,OAAO,GAAGA,8BAAAA,QAAQ,SAAS,kCAC7B,EACF,CAAC"}
|