UNPKG

@mantine/tiptap

Version:

Rich text editor based on tiptap

1 lines 2.43 kB
{"version":3,"file":"RichTextEditorContent.mjs","names":["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,wBAAwB,SAAuC,WAAW;CAErF,MAAM,EAAE,YAAY,WAAW,OAAO,QAAQ,MAAM,GAAG,WADzC,SAAS,yBAAyB,MAAM,MACgB;CACtE,MAAM,MAAM,yBAAyB;CAErC,IAAI,IAAI,sBACN,OACE,oBAAC,YAAD;EACE,GAAI,IAAI,UAAU,cAAc;GAAE;GAAW;GAAO;GAAQ;EAAW,CAAC;EACxE,UAAU,IAAI;YAEd,oBAAC,KAAD;GACE,WAAW;GACX,QAAQ,IAAI;GACZ,GAAI,IAAI,UAAU,WAAW;IAAE;IAAY;GAAO,CAAC;GACnD,GAAI;EACL,CAAA;CACS,CAAA;CAIhB,OACE,oBAAC,KAAD;EACE,WAAW;EACX,QAAQ,IAAI;EACZ,GAAI,IAAI,UAAU,WAAW;GAAE;GAAY;GAAQ;GAAW;EAAM,CAAC;EACrE,GAAI;CACL,CAAA;AAEL,CAAC;AAED,sBAAsB,UAAUA;AAChC,sBAAsB,cAAc"}