@mantine/tiptap
Version:
Rich text editor based on tiptap
47 lines (44 loc) • 1.51 kB
JavaScript
'use client';
import { jsx } from 'react/jsx-runtime';
import { EditorContent } from '@tiptap/react';
import { factory, useProps, TypographyStylesProvider, Box } from '@mantine/core';
import { useRichTextEditorContext } from '../RichTextEditor.context.mjs';
import classes from '../RichTextEditor.module.css.mjs';
const defaultProps = {};
const RichTextEditorContent = factory((_props, ref) => {
const props = useProps("RichTextEditorContent", defaultProps, _props);
const { classNames, className, style, styles, vars, ...others } = props;
const ctx = useRichTextEditorContext();
if (ctx.withTypographyStyles) {
return /* @__PURE__ */ jsx(
TypographyStylesProvider,
{
...ctx.getStyles("typographyStylesProvider", { className, style, styles, classNames }),
unstyled: ctx.unstyled,
ref,
children: /* @__PURE__ */ jsx(
Box,
{
component: EditorContent,
editor: ctx.editor,
...ctx.getStyles("content", { classNames, styles }),
...others
}
)
}
);
}
return /* @__PURE__ */ jsx(
Box,
{
component: EditorContent,
editor: ctx.editor,
...ctx.getStyles("content", { classNames, styles, className, style }),
...others
}
);
});
RichTextEditorContent.classes = classes;
RichTextEditorContent.displayName = "@mantine/tiptap/RichTextEditorContent";
export { RichTextEditorContent };
//# sourceMappingURL=RichTextEditorContent.mjs.map