File tree 1 file changed +7
-1
lines changed
src/components/views/rooms
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,12 @@ interface IState {
33
33
34
34
export default class MessageComposerFormatBar extends React . PureComponent < IProps , IState > {
35
35
private readonly formatBarRef = createRef < HTMLDivElement > ( ) ;
36
+ /**
37
+ * The height of the format bar in pixels.
38
+ * Height 32px + 2px border
39
+ * @private
40
+ */
41
+ private readonly BAR_HEIGHT = 34 ;
36
42
37
43
public constructor ( props : IProps ) {
38
44
super ( props ) ;
@@ -96,7 +102,7 @@ export default class MessageComposerFormatBar extends React.PureComponent<IProps
96
102
this . setState ( { visible : true } ) ;
97
103
const parentRect = this . formatBarRef . current . parentElement . getBoundingClientRect ( ) ;
98
104
this . formatBarRef . current . style . left = `${ selectionRect . left - parentRect . left } px` ;
99
- const halfBarHeight = this . formatBarRef . current . clientHeight / 2 ; // used to center the bar
105
+ const halfBarHeight = this . BAR_HEIGHT / 2 ; // used to center the bar
100
106
const offset = halfBarHeight + 2 ; // makes sure the bar won't cover selected text
101
107
const offsetLimit = halfBarHeight + offset ;
102
108
const position = Math . max ( selectionRect . top - parentRect . top - offsetLimit , - offsetLimit ) ;
You can’t perform that action at this time.
0 commit comments