Browse Source

Ellipsis onExpand function takes event parameter (#22092)

pull/22129/head
Blaz Pocrnja 5 years ago
committed by GitHub
parent
commit
c8f437ea02
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      components/typography/Base.tsx
  2. 4
      components/typography/index.en-US.md

8
components/typography/Base.tsx

@ -40,7 +40,7 @@ interface EllipsisConfig {
rows?: number;
expandable?: boolean;
suffix?: string;
onExpand?: () => void;
onExpand?: React.MouseEventHandler<HTMLElement>;
}
export interface BlockProps extends TypographyProps {
@ -165,13 +165,13 @@ class Base extends React.Component<InternalBlockProps & ConfigConsumerProps, Bas
raf.cancel(this.rafId);
}
// =============== Expend ===============
onExpandClick = () => {
// =============== Expand ===============
onExpandClick: React.MouseEventHandler<HTMLElement> = e => {
const { onExpand } = this.getEllipsis();
this.setState({ expanded: true });
if (onExpand) {
onExpand();
(onExpand as React.MouseEventHandler<HTMLElement>)(e);
}
};

4
components/typography/index.en-US.md

@ -39,7 +39,7 @@ Basic text writing, including headings, body text, lists, and more.
| delete | Deleted line style | boolean | false | |
| disabled | Disabled content | boolean | false | |
| editable | Editable. Can control edit state when is object | boolean \| { editing: boolean, onStart: Function, onChange: Function(string) } | false | |
| ellipsis | Display ellipsis when text overflows. Can configure rows and expandable by using object | boolean \| { rows: number, expandable: boolean, onExpand: Function } | false | |
| ellipsis | Display ellipsis when text overflows. Can configure rows and expandable by using object | boolean \| { rows: number, expandable: boolean, onExpand: Function(event) } | false | |
| level | Set content importance. Match with `h1`, `h2`, `h3`, `h4` | number: `1`, `2`, `3`, `4` | 1 | |
| mark | Marked style | boolean | false | |
| underline | Underlined style | boolean | false | |
@ -55,7 +55,7 @@ Basic text writing, including headings, body text, lists, and more.
| delete | Deleted line style | boolean | false | |
| disabled | Disabled content | boolean | false | |
| editable | Editable. Can control edit state when is object | boolean \| { editing: boolean, onStart: Function, onChange: Function(string) } | false | |
| ellipsis | Display ellipsis when text overflows. Can configure rows expandable and suffix by using object | boolean \| { rows: number, expandable: boolean suffix: string, onExpand: Function } | false | |
| ellipsis | Display ellipsis when text overflows. Can configure rows expandable and suffix by using object | boolean \| { rows: number, expandable: boolean suffix: string, onExpand: Function(event) } | false | |
| mark | Marked style | boolean | false | |
| underline | Underlined style | boolean | false | |
| onChange | Trigger when user edits the content | Function(string) | - | |

Loading…
Cancel
Save