import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
import "react";
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_client__ from "@tachybase/client";
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_components__ from "@tachybase/components";
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
const schema = {
    type: 'object',
    properties: {
        markdown: {
            type: 'void',
            title: "Read pretty",
            'x-decorator': 'Editable',
            'x-component': 'Markdown.Void',
            'x-editable': false,
            'x-component-props': {
                content: '# Markdown content'
            }
        }
    }
};
const Editable = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.observer)((props)=>{
    const filed = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useField)();
    if (filed.editable) return props.children;
    return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
        children: [
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Button, {
                onClick: ()=>{
                    filed.editable = true;
                },
                children: "编辑"
            }),
            /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
                children: props.children
            })
        ]
    });
}, {
    displayName: 'Editable'
});
const demo2_rslib_entry_ = ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__tachybase_client__.SchemaComponentProvider, {
        components: {
            Editable,
            Markdown: __WEBPACK_EXTERNAL_MODULE__tachybase_client__.Markdown,
            FormItem: __WEBPACK_EXTERNAL_MODULE__tachybase_components__.FormItem
        },
        children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__tachybase_client__.SchemaComponent, {
            schema: schema
        })
    });
export { demo2_rslib_entry_ as default };
