IJPL-174856 Check the event source in the Markdown preview mouse click handler

(cherry picked from commit 79a23742a23e49469c689fc89dc7ee50ec9be6d1)

IJ-CR-157286

GitOrigin-RevId: 987dffbe968db633b11bacca5ed0eccdbde57a80
This commit is contained in:
Dmitry Timofeev
2025-03-10 18:31:38 +01:00
committed by intellij-monorepo-bot
parent 55feb2fffa
commit 0fc7f6622a

View File

@@ -29,6 +29,7 @@ import com.intellij.openapi.vfs.VirtualFile
import com.intellij.ui.awt.RelativePoint
import com.intellij.util.concurrency.annotations.RequiresEdt
import com.intellij.util.ui.StartupUiUtil
import com.intellij.util.ui.UIUtil
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.cancel
import kotlinx.coroutines.flow.MutableStateFlow
@@ -93,6 +94,7 @@ class MarkdownPreviewFileEditor(
StartupUiUtil.addAwtListener(AWTEvent.MOUSE_EVENT_MASK, this) { event ->
if (event is MouseEvent && event.id == MouseEvent.MOUSE_CLICKED && event.button == MouseEvent.BUTTON3
&& UIUtil.isDescendingFrom(event.component, htmlPanelWrapper)
&& event.component.isShowing() && htmlPanelWrapper.isShowing()
&& component.containsScreenLocation(event.locationOnScreen)
) {