Skip to content

A platform for community discussion. Free, open, simple.

FIX: cancel post toolbar on click outside (#23546)

Joffrey JAFFEUXa32fa3b9470d
diff --git a/app/assets/javascripts/discourse/app/components/post-text-selection.gjs b/app/assets/javascripts/discourse/app/components/post-text-selection.gjs
index 8165bde932d..47a6ea59776 100644
--- a/app/assets/javascripts/discourse/app/components/post-text-selection.gjs
+++ b/app/assets/javascripts/discourse/app/components/post-text-selection.gjs
@@ -233,9 +233,14 @@ export default class PostTextSelection extends Component {
}
@bind
- async mousedown() {
- this.isMousedown = true;
+ mousedown(event) {
this.holdingMouseDown = false;
+
+ if (!event.target.closest(".cooked")) {
+ return;
+ }
+
+ this.isMousedown = true;
this.holdingMouseDownHandler = discourseLater(() => {
this.holdingMouseDown = true;
}, 100);