From f2ff4c6e3da7bbc82b94832f4dffb3d69f39efc9 Mon Sep 17 00:00:00 2001 From: tabzzz Date: Sun, 8 Dec 2024 01:44:06 +0800 Subject: [PATCH] docs: Add the api of editable property in Bubble --- components/bubble/index.en-US.md | 22 ++++++++++++++++++++++ components/bubble/index.zh-CN.md | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/components/bubble/index.en-US.md b/components/bubble/index.en-US.md index 74eabc18..b70c28a2 100644 --- a/components/bubble/index.en-US.md +++ b/components/bubble/index.en-US.md @@ -64,6 +64,28 @@ Common props ref:[Common props](/docs/react/common-props) | items | Bubble items list | (BubbleProps & { key?: string \| number, role?: string })[] | - | | | roles | Set the default properties of the bubble. The `role` in `items` will be automatically matched. | Record \| (bubble) => BubbleProps | - | | +### editable + +```tsx +interface EditConfig { + editing?: boolean; + onChange?: (content: string) => void; + onCancel?: () => void; + onEnd?: (content: string) => void; + editorTextAreaConfig?: TextAreaProps; + editorButtonConfig?: { type: 'save' | 'cancel'; text?: string; option?: ButtonProps }[]; +} +``` + +| Property | Description | Type | Default | Version | +| --- | --- | --- | --- | --- | +| editing | Wether to be editable | boolean | false | | +| onChange | Called when input at textarea | (content?:string) => void | - | | +| onCancel | Called when exiting the editable state | () => void | - | | +| onEnd | Called when saving or ending the editable state | (content?:string) => void | - | | +| editorTextAreaConfig | Configure settings related to textarea in the editor | TextAreaProps | variant="borderless" autoSize={{ minRows: 2, maxRows: 3 }} | | +| editorButtonConfig | Configure settings related to button in the editor | { type: 'save' \| 'cancel'; text?: string; option?: ButtonProps }[] | [{ type: 'save', text: 'Save', option: { size: 'small', type: 'primary' } }, { type: 'cancel', text: 'Cancel', option: { size: 'small' } }] | | + ## Semantic DOM diff --git a/components/bubble/index.zh-CN.md b/components/bubble/index.zh-CN.md index b12c6cfe..f142636c 100644 --- a/components/bubble/index.zh-CN.md +++ b/components/bubble/index.zh-CN.md @@ -65,6 +65,28 @@ demo: | items | 气泡数据列表 | (BubbleProps & { key?: string \| number, role?: string })[] | - | | | roles | 设置气泡默认属性,`items` 中的 `role` 会进行自动对应 | Record \| (bubble) => BubbleProps | - | | +### editable + +```tsx +interface EditConfig { + editing?: boolean; + onChange?: (content: string) => void; + onCancel?: () => void; + onEnd?: (content: string) => void; + editorTextAreaConfig?: TextAreaProps; + editorButtonConfig?: { type: 'save' | 'cancel'; text?: string; option?: ButtonProps }[]; +} +``` + +| 属性 | 说明 | 类型 | 默认值 | 版本 | +| --- | --- | --- | --- | --- | +| editing | 控制是否是编辑中状态 | boolean | false | | +| onChange | 文本域编辑时触发 | (content?:string) => void | - | | +| onCancel | 退出编辑状态时触发 | () => void | - | | +| onEnd | 保存/结束编辑状态时触发 | (content?:string) => void | - | | +| editorTextAreaConfig | 配置编辑器中文本域的相关设置 | TextAreaProps | variant="borderless" autoSize={{ minRows: 2, maxRows: 3 }} | | +| editorButtonConfig | 配置编辑器中按钮的相关设置 | { type: 'save' \| 'cancel'; text?: string; option?: ButtonProps }[] | [{ type: 'save', text: 'Save', option: { size: 'small', type: 'primary' } }, { type: 'cancel', text: 'Cancel', option: { size: 'small' } }] | | + ## Semantic DOM