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