import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import "react";
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
import * as __WEBPACK_EXTERNAL_MODULE_react_quill__ from "react-quill";
import * as __WEBPACK_EXTERNAL_MODULE__variables_utils_isVariable_mjs__ from "../../../variables/utils/isVariable.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__input_index_mjs__ from "../input/index.mjs";
import * as __WEBPACK_EXTERNAL_MODULE__style_mjs__ from "./style.mjs";
const RichText = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.connect)((props)=>{
    const { wrapSSR, hashId, componentCls } = (0, __WEBPACK_EXTERNAL_MODULE__style_mjs__.useStyles)();
    const modules = {
        toolbar: [
            [
                'bold',
                'italic',
                'underline',
                'link'
            ],
            [
                {
                    list: 'ordered'
                },
                {
                    list: 'bullet'
                }
            ],
            [
                'clean'
            ]
        ]
    };
    const formats = [
        'header',
        'bold',
        'italic',
        'underline',
        'strike',
        'blockquote',
        'list',
        'bullet',
        'indent',
        'link',
        'image'
    ];
    const { value, defaultValue, onChange, disabled } = props;
    const resultValue = (0, __WEBPACK_EXTERNAL_MODULE__variables_utils_isVariable_mjs__.isVariable)(value || defaultValue) ? void 0 : value || defaultValue || '';
    return wrapSSR(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_quill__["default"], {
        className: "".concat(componentCls, " ").concat(hashId),
        modules: modules,
        formats: formats,
        value: resultValue,
        onChange: onChange,
        readOnly: disabled
    }));
}, (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.mapProps)({
    initialValue: 'defaultValue'
}), (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.mapReadPretty)((props)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__input_index_mjs__.ReadPretty.Html, {
        ...props
    })));
export { RichText };
