UNPKG

@rtdui/editor

Version:

React rich text editor based on tiptap

74 lines (70 loc) 2.6 kB
'use client'; 'use strict'; var jsxRuntime = require('react/jsx-runtime'); var React = require('react'); var ControlContext = require('./ControlContext.cjs'); var tiptapControls = require('./tiptapControls.cjs'); var ControlsGroup = require('./ControlsGroup.cjs'); var ToolbarControl = require('./ToolbarControl.cjs'); var constrolLabels = require('./constrolLabels.cjs'); const EditorControl_ = React.forwardRef( (props, ref) => { const { editor, children, labels, ...others } = props; const mergedLabels = React.useMemo( () => ({ ...constrolLabels.DEFAULT_CN_LABELS, ...labels }), [labels] ); return /* @__PURE__ */ jsxRuntime.jsx( ControlContext.EditorProvider, { value: { editor, labels: mergedLabels }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref, ...others, children }) } ); } ); EditorControl_.displayName = "@rtdui/editor/EditorControl"; const EditorControl = Object.assign(EditorControl_, { // Content = Content, // Control = Control, ControlsGroup: ControlsGroup.ControlsGroup, Toolbar: ToolbarControl.ToolbarControl, // Controls components Bold: tiptapControls.BoldControl, Italic: tiptapControls.ItalicControl, Strikethrough: tiptapControls.StrikeThroughControl, Underline: tiptapControls.UnderlineControl, ClearFormatting: tiptapControls.ClearFormattingControl, H1: tiptapControls.H1Control, H2: tiptapControls.H2Control, H3: tiptapControls.H3Control, H4: tiptapControls.H4Control, H5: tiptapControls.H5Control, H6: tiptapControls.H6Control, BulletList: tiptapControls.BulletListControl, OrderedList: tiptapControls.OrderedListControl, // Link: controls.LinkControl, Unlink: tiptapControls.UnlinkControl, Blockquote: tiptapControls.BlockquoteControl, AlignLeft: tiptapControls.AlignLeftControl, AlignRight: tiptapControls.AlignRightControl, AlignCenter: tiptapControls.AlignCenterControl, AlignJustify: tiptapControls.AlignJustifyControl, Superscript: tiptapControls.SuperscriptControl, Subscript: tiptapControls.SubscriptControl, Code: tiptapControls.CodeControl, CodeBlock: tiptapControls.CodeBlockControl, Highlight: tiptapControls.HighlightControl, Hr: tiptapControls.HrControl, // ColorPicker: controls.ColorPickerControl, // Color: controls.ColorControl, UnsetColor: tiptapControls.UnsetColorControl, Image: tiptapControls.ImageControl, Table: tiptapControls.TableControl }); exports.EditorControl = EditorControl; exports.EditorControl_ = EditorControl_; //# sourceMappingURL=EditorControl.cjs.map