show/hide legend when focusing/blurring

This commit is contained in:
Bruno Windels 2019-09-02 15:59:17 +02:00
parent b7768f34f2
commit f200327ef2
2 changed files with 30 additions and 3 deletions

View file

@ -222,15 +222,21 @@ export default class BasicMessageEditor extends React.Component {
return this.getCaret().offset === this._lastTextLength;
}
_onBlur = () => {
_onBlur = (event) => {
document.removeEventListener("selectionchange", this._onSelectionChange);
if (this.props.onBlur) {
this.props.onBlur(event);
}
}
_onFocus = () => {
_onFocus = (event) => {
document.addEventListener("selectionchange", this._onSelectionChange);
// force to recalculate
this._lastSelection = null;
this._refreshLastCaretIfNeeded();
if (this.props.onFocus) {
this.props.onFocus(event);
}
}
_onSelectionChange = () => {