You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
738 B
TypeScript
35 lines
738 B
TypeScript
import React from 'react';
|
|
|
|
interface Props {
|
|
placeholder: string;
|
|
text?: string;
|
|
editable?: boolean;
|
|
onChange?: any;
|
|
}
|
|
|
|
export class SessionIdEditable extends React.PureComponent<Props> {
|
|
public componentWillUnmount() {
|
|
//FIXME ugly hack to empty the content editable div used on enter session ID
|
|
window.Session.emptyContentEditableDivs();
|
|
}
|
|
|
|
public render() {
|
|
const { placeholder, editable, onChange, text } = this.props;
|
|
|
|
return (
|
|
<div
|
|
className="session-id-editable"
|
|
placeholder={placeholder}
|
|
contentEditable={editable}
|
|
onInput={(e: any) => {
|
|
if (editable) {
|
|
onChange(e);
|
|
}
|
|
}}
|
|
>
|
|
{text}
|
|
</div>
|
|
);
|
|
}
|
|
}
|