@empoleon/tiptap
Version:
Rich text editor based on tiptap
57 lines (53 loc) • 2 kB
JavaScript
;
var web = require('solid-js/web');
var solidTiptap = require('@empoleon/solid-tiptap');
var core = require('@empoleon/core');
var RichTextEditor_context = require('../RichTextEditor.context.cjs');
var RichTextEditor_module = require('../RichTextEditor.module.css.cjs');
var solidJs = require('solid-js');
const defaultProps = {};
const RichTextEditorContent = core.factory(_props => {
const props = core.useProps("RichTextEditorContent", defaultProps, _props);
const [local, others] = solidJs.splitProps(props, ["classNames", "className", "style", "styles", "vars", "ref"]);
const ctx = RichTextEditor_context.useRichTextEditorContext();
if (ctx.withTypographyStyles) {
return web.createComponent(core.TypographyStylesProvider, web.mergeProps(() => ctx.getStyles("typographyStylesProvider", {
className: local.className,
style: local.style,
styles: local.styles,
classNames: local.classNames
}), {
get unstyled() {
return ctx.unstyled;
},
ref(r$) {
var _ref$ = local.ref;
typeof _ref$ === "function" ? _ref$(r$) : local.ref = r$;
},
get children() {
return web.createComponent(core.Box, web.mergeProps({
component: solidTiptap.EditorContent,
get editor() {
return ctx.editor;
}
}, () => ctx.getStyles("content", {
classNames: local.classNames,
styles: local.styles
}), others));
}
}));
}
return web.createComponent(core.Box, web.mergeProps({
component: solidTiptap.EditorContent,
get editor() {
return ctx.editor;
}
}, () => ctx.getStyles("content", {
classNames: local.classNames,
styles: local.styles
}), others));
});
RichTextEditorContent.classes = RichTextEditor_module;
RichTextEditorContent.displayName = "@empoleon/tiptap/RichTextEditorContent";
exports.RichTextEditorContent = RichTextEditorContent;
//# sourceMappingURL=RichTextEditorContent.cjs.map