0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-24 01:13:15 +00:00

Simplify click-outside close widget logic

This commit is contained in:
Trevor Buckner
2023-07-03 15:27:18 -04:00
committed by Charlie Humphreys
parent 51760e02e7
commit ebbf0ca88b

View File

@@ -453,16 +453,8 @@ const CodeEditor = createClass({
};
},
handleMouseDown : function(e) {
let target = e.target;
let found = false;
while (target.parentElement) {
target = target.parentElement;
if(target.classList.contains('CodeMirror-linewidget')) {
found = true;
break;
}
}
if(!found) {
// Close open widgets if click outside of a widget
if(!e.target.matches('.CodeMirror-linewidget *')) {
for (const widget of this.state.widgets) {
this.state.widgetUtils.removeLineWidgets(widget);
}