fix: menu contextuel right-click + long-press mobile
FlowDeck CI / test (push) Failing after 4s
FlowDeck CI / docker (push) Has been skipped

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
This commit is contained in:
2026-07-13 10:25:54 -04:00
parent b865b5da6c
commit 282eecf80c
+45 -1
View File
@@ -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
<script>console.log('FLOWDECK v2.4.6 — ws-split about to render, _wsInitData exists:', typeof window._wsInitData !== 'undefined');</script>
<div class="ws-split"
@contextmenu.prevent="if(window._wsData) window._wsData.onContextMenu($event)"
@contextmenu.prevent="onContextMenu($event)"
@click.self="ctxMenu.visible = false"
@touchstart="onTouchStart($event)"
@touchend="onTouchEnd($event)"
@touchmove="onTouchMove($event)"
tabindex="0"
x-ref="layout">
<div class="ws-main">
@@ -2313,6 +2356,7 @@ console.log('FLOWDECK v2.4.6 — IIFE done, _wsInitData keys:', Object.keys(wind
<!-- Context menu -->
<div class="ctx-menu" x-show="ctxMenu.visible"
:style="{ left: ctxMenu.x + 'px', top: ctxMenu.y + 'px' }"
@click.outside="ctxMenu.visible=false"
@keydown.escape="ctxMenu.visible=false"
x-transition>
<div class="ctx-item" @click="ctxMenuOpenPage()">📄 Open</div>