Skip to content

Commit fe4db8b

Browse files
committed
docs: Add the api of editable property in Bubble
1 parent ade91c4 commit fe4db8b

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

components/bubble/index.en-US.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,30 @@ Common props ref:[Common props](/docs/react/common-props)
6464
| items | Bubble items list | (BubbleProps & { key?: string \| number, role?: string })[] | - | |
6565
| roles | Set the default properties of the bubble. The `role` in `items` will be automatically matched. | Record<string, BubbleProps> \| (bubble) => BubbleProps | - | |
6666

67+
### editable
68+
69+
```tsx
70+
interface EditConfig {
71+
editing?: boolean;
72+
onChange?: (content: string) => void;
73+
onCancel?: () => void;
74+
onEnd?: (content: string) => void;
75+
editorClassNames?: string;
76+
editorStyles?: CSSProperties;
77+
editorTextAreaConfig?: TextAreaProps;
78+
editorButtonConfig?: { type: 'save' | 'cancel'; text?: string; option?: ButtonProps }[];
79+
}
80+
```
81+
82+
| Property | Description | Type | Default | Version |
83+
| --- | --- | --- | --- | --- |
84+
| editing | Wether to be editable | boolean | false | |
85+
| onChange | Called when input at textarea | (content?:string) => void | - | |
86+
| onCancel | Called when exiting the editable state | () => void | - | |
87+
| onEnd | Called when saving or ending the editable state | (content?:string) => void | - | |
88+
| editorTextAreaConfig | Configure settings related to textarea in the editor | TextAreaProps | variant="borderless" autoSize={{ minRows: 2, maxRows: 3 }} | |
89+
| 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' } }] | |
90+
6791
## Semantic DOM
6892

6993
<code src="./demo/_semantic.tsx" simplify="true"></code>

components/bubble/index.zh-CN.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,30 @@ demo:
6565
| items | 气泡数据列表 | (BubbleProps & { key?: string \| number, role?: string })[] | - | |
6666
| roles | 设置气泡默认属性,`items` 中的 `role` 会进行自动对应 | Record<string, BubbleProps> \| (bubble) => BubbleProps | - | |
6767

68+
### editable
69+
70+
```tsx
71+
interface EditConfig {
72+
editing?: boolean;
73+
onChange?: (content: string) => void;
74+
onCancel?: () => void;
75+
onEnd?: (content: string) => void;
76+
editorClassNames?: string;
77+
editorStyles?: CSSProperties;
78+
editorTextAreaConfig?: TextAreaProps;
79+
editorButtonConfig?: { type: 'save' | 'cancel'; text?: string; option?: ButtonProps }[];
80+
}
81+
```
82+
83+
| 属性 | 说明 | 类型 | 默认值 | 版本 |
84+
| --- | --- | --- | --- | --- |
85+
| editing | 控制是否是编辑中状态 | boolean | false | |
86+
| onChange | 文本域编辑时触发 | (content?:string) => void | - | |
87+
| onCancel | 退出编辑状态时触发 | () => void | - | |
88+
| onEnd | 保存/结束编辑状态时触发 | (content?:string) => void | - | |
89+
| editorTextAreaConfig | 配置编辑器中文本域的相关设置 | TextAreaProps | variant="borderless" autoSize={{ minRows: 2, maxRows: 3 }} | |
90+
| editorButtonConfig | 配置编辑器中按钮的相关设置 | { type: 'save' \| 'cancel'; text?: string; option?: ButtonProps }[] | [{ type: 'save', text: 'Save', option: { size: 'small', type: 'primary' } }, { type: 'cancel', text: 'Cancel', option: { size: 'small' } }] | |
91+
6892
## Semantic DOM
6993

7094
<code src="./demo/_semantic.tsx" simplify="true"></code>

0 commit comments

Comments
 (0)