mirror of
https://github.com/vector-im/element-web.git
synced 2025-08-25 08:21:41 +02:00
Merge pull request #4696 from aaronraimist/empty-formatbar
Don't show FormatBar if composer is empty
This commit is contained in:
commit
68e59a3655
@ -359,6 +359,8 @@ export default class BasicMessageEditor extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_onSelectionChange = () => {
|
_onSelectionChange = () => {
|
||||||
|
const {isEmpty} = this.props.model;
|
||||||
|
|
||||||
this._refreshLastCaretIfNeeded();
|
this._refreshLastCaretIfNeeded();
|
||||||
const selection = document.getSelection();
|
const selection = document.getSelection();
|
||||||
if (this._hasTextSelected && selection.isCollapsed) {
|
if (this._hasTextSelected && selection.isCollapsed) {
|
||||||
@ -366,7 +368,7 @@ export default class BasicMessageEditor extends React.Component {
|
|||||||
if (this._formatBarRef) {
|
if (this._formatBarRef) {
|
||||||
this._formatBarRef.hide();
|
this._formatBarRef.hide();
|
||||||
}
|
}
|
||||||
} else if (!selection.isCollapsed) {
|
} else if (!selection.isCollapsed && !isEmpty) {
|
||||||
this._hasTextSelected = true;
|
this._hasTextSelected = true;
|
||||||
if (this._formatBarRef) {
|
if (this._formatBarRef) {
|
||||||
const selectionRect = selection.getRangeAt(0).getBoundingClientRect();
|
const selectionRect = selection.getRangeAt(0).getBoundingClientRect();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user