mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
[backport cloud/1.41] fix: prevent middle-click paste duplicating workflow on Linux (#10040)
Backport of #8259 to `cloud/1.41` Automatically created by backport workflow. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-10040-backport-cloud-1-41-fix-prevent-middle-click-paste-duplicating-workflow-on-Linux-3256d73d36508136884fd82505fb37d9) by [Unito](https://www.unito.io) Co-authored-by: Gregorius Bima Kharisma Wicaksana <51526537+bimakw@users.noreply.github.com> Co-authored-by: bymyself <cbyrne@comfy.org>
This commit is contained in:
@@ -1951,6 +1951,11 @@ export class LGraphCanvas implements CustomEventDispatcher<LGraphCanvasEventMap>
|
||||
return false
|
||||
}
|
||||
|
||||
/** Prevents default for middle-click auxclick only. */
|
||||
_preventMiddleAuxClick(e: MouseEvent): void {
|
||||
if (e.button === 1) e.preventDefault()
|
||||
}
|
||||
|
||||
/** Captures an event and prevents default - returns true. */
|
||||
_doReturnTrue(e: Event): boolean {
|
||||
e.preventDefault()
|
||||
@@ -1986,6 +1991,8 @@ export class LGraphCanvas implements CustomEventDispatcher<LGraphCanvasEventMap>
|
||||
canvas.addEventListener('pointercancel', this._mousecancel_callback, true)
|
||||
|
||||
canvas.addEventListener('contextmenu', this._doNothing)
|
||||
// Prevent middle-click paste (PRIMARY clipboard on Linux) - fixes #4464
|
||||
canvas.addEventListener('auxclick', this._preventMiddleAuxClick)
|
||||
|
||||
// Keyboard
|
||||
this._key_callback = this.processKey.bind(this)
|
||||
@@ -2024,6 +2031,7 @@ export class LGraphCanvas implements CustomEventDispatcher<LGraphCanvasEventMap>
|
||||
canvas.removeEventListener('keydown', this._key_callback!)
|
||||
document.removeEventListener('keyup', this._key_callback!)
|
||||
canvas.removeEventListener('contextmenu', this._doNothing)
|
||||
canvas.removeEventListener('auxclick', this._preventMiddleAuxClick)
|
||||
canvas.removeEventListener('dragenter', this._doReturnTrue)
|
||||
|
||||
this._mousedown_callback = undefined
|
||||
|
||||
Reference in New Issue
Block a user