Merge pull request #11207 from KDSBrowne/bbb-11197

Prevent open text-area blocking select menus
This commit is contained in:
Anton Georgiev 2021-01-25 12:13:00 -05:00 committed by GitHub
commit 63afee6f7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,6 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import {Meteor} from "meteor/meteor";
import { Meteor } from 'meteor/meteor';
const ANNOTATION_CONFIG = Meteor.settings.public.whiteboard.annotations;
const DRAW_START = ANNOTATION_CONFIG.status.start;
@ -51,6 +51,7 @@ export default class TextDrawListener extends Component {
// Check it to figure if you can add onTouchStart in render(), or should use raw DOM api
this.hasBeenTouchedRecently = false;
this.handleClick = this.handleClick.bind(this);
this.handleMouseDown = this.handleMouseDown.bind(this);
this.handleMouseMove = this.handleMouseMove.bind(this);
this.handleMouseUp = this.handleMouseUp.bind(this);
@ -65,9 +66,9 @@ export default class TextDrawListener extends Component {
componentDidMount() {
window.addEventListener('beforeunload', this.sendLastMessage);
window.addEventListener('click', this.handleClick);
}
// If the activeId suddenly became empty - this means the shape was deleted
// While the user was drawing it. So we are resetting the state.
componentWillReceiveProps(nextProps) {
@ -113,11 +114,17 @@ export default class TextDrawListener extends Component {
componentWillUnmount() {
window.removeEventListener('beforeunload', this.sendLastMessage);
window.removeEventListener('click', this.handleClick);
// sending the last message on componentDidUnmount
// for example in case when you switched a tool while drawing text shape
this.sendLastMessage();
}
handleClick() {
const { isWritingText } = this.state;
if (isWritingText) this.sendLastMessage();
}
// checks if the input textarea is focused or not, and if not - moves focus there
// returns false if text area wasn't focused
// returns true if textarea was focused
@ -510,8 +517,9 @@ export default class TextDrawListener extends Component {
} = this.state;
const { contextMenuHandler } = actions;
const baseName = Meteor.settings.public.app.cdn + Meteor.settings.public.app.basename + Meteor.settings.public.app.instanceId;
const { settings } = Meteor;
const { public: _public } = settings;
const baseName = _public.app.cdn + _public.app.basename + _public.app.instanceId;
const textDrawStyle = {
width: '100%',
height: '100%',