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

Commit

Permalink
Don't show broken composer format bar when selection is whitespace (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy authored May 24, 2022
1 parent 9a1410e commit 0343548
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/components/views/rooms/BasicMessageComposer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -449,12 +449,11 @@ export default class BasicMessageEditor extends React.Component<IProps, IState>
const selection = document.getSelection();
if (this.hasTextSelected && selection.isCollapsed) {
this.hasTextSelected = false;
if (this.formatBarRef.current) {
this.formatBarRef.current.hide();
}
this.formatBarRef.current?.hide();
} else if (!selection.isCollapsed && !isEmpty) {
this.hasTextSelected = true;
if (this.formatBarRef.current && this.state.useMarkdown) {
const range = getRangeForSelection(this.editorRef.current, this.props.model, selection);
if (this.formatBarRef.current && this.state.useMarkdown && !!range.text.trim()) {
const selectionRect = selection.getRangeAt(0).getBoundingClientRect();
this.formatBarRef.current.showAt(selectionRect);
}
Expand Down

0 comments on commit 0343548

Please sign in to comment.