Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 68e59a3

Browse files
authored
Merge pull request #4696 from aaronraimist/empty-formatbar
Don't show FormatBar if composer is empty
2 parents efa12b8 + ed2eca5 commit 68e59a3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/components/views/rooms/BasicMessageComposer.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,14 +359,16 @@ export default class BasicMessageEditor extends React.Component {
359359
}
360360

361361
_onSelectionChange = () => {
362+
const {isEmpty} = this.props.model;
363+
362364
this._refreshLastCaretIfNeeded();
363365
const selection = document.getSelection();
364366
if (this._hasTextSelected && selection.isCollapsed) {
365367
this._hasTextSelected = false;
366368
if (this._formatBarRef) {
367369
this._formatBarRef.hide();
368370
}
369-
} else if (!selection.isCollapsed) {
371+
} else if (!selection.isCollapsed && !isEmpty) {
370372
this._hasTextSelected = true;
371373
if (this._formatBarRef) {
372374
const selectionRect = selection.getRangeAt(0).getBoundingClientRect();

0 commit comments

Comments
 (0)