From 282eecf80c53ada3ab445e867cafbd66161baa50 Mon Sep 17 00:00:00 2001 From: bruno Date: Mon, 13 Jul 2026 10:25:54 -0400 Subject: [PATCH] fix: menu contextuel right-click + long-press mobile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Desktop: - @contextmenu.prevent corrigé: window._wsData → onContextMenu() (window._wsData n'existait pas, le handler était mort) Mobile: - @touchstart/@touchmove/@touchend ajoutés sur ws-split - Détection long-press: >600ms sans mouvement >10px - Recherche du [data-ws-id] le plus proche - Appel onContextMenu avec les coordonnées tactiles Fermeture: - @click.outside ajouté sur .ctx-menu - @click.self maintenu sur ws-split pour fermer en cliquant ailleurs --- app/templates/local_workspace.html | 46 +++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/app/templates/local_workspace.html b/app/templates/local_workspace.html index 90d0198..00feb6d 100644 --- a/app/templates/local_workspace.html +++ b/app/templates/local_workspace.html @@ -780,6 +780,46 @@ window._wsInitData = (function() { }); }, + // ── Long-press (mobile context menu) ── + _touchStartX: 0, + _touchStartY: 0, + _touchStartTime: 0, + _touchMoved: false, + _touchTarget: null, + onTouchStart(ev) { + if (!ev.touches || ev.touches.length !== 1) return; + this._touchStartX = ev.touches[0].clientX; + this._touchStartY = ev.touches[0].clientY; + this._touchStartTime = Date.now(); + this._touchMoved = false; + this._touchTarget = ev.target; + }, + onTouchMove(ev) { + if (!ev.touches || ev.touches.length !== 1) return; + var dx = Math.abs(ev.touches[0].clientX - this._touchStartX); + var dy = Math.abs(ev.touches[0].clientY - this._touchStartY); + if (dx > 10 || dy > 10) this._touchMoved = true; + }, + onTouchEnd(ev) { + if (this._touchMoved) return; + var elapsed = Date.now() - this._touchStartTime; + if (elapsed < 600) return; + // Long press detected — find target element + var el = this._touchTarget; + if (!el) return; + var idEl = el.closest('[data-ws-id]'); + if (!idEl) return; + // Prevent default context menu if it hasn't fired yet + ev.preventDefault(); + var fakeEv = { + clientX: this._touchStartX, + clientY: this._touchStartY, + target: idEl, + preventDefault: function(){} + }; + this.onContextMenu(fakeEv); + }, + ctxAddExistingTag(tag) { this.ctxAddNewTag(tag.name, tag.color); }, @@ -1885,8 +1925,11 @@ console.log('FLOWDECK v2.4.6 — IIFE done, _wsInitData keys:', Object.keys(wind
@@ -2313,6 +2356,7 @@ console.log('FLOWDECK v2.4.6 — IIFE done, _wsInitData keys:', Object.keys(wind
📄 Open