// === Unified front-end selector — canonical reference === // // Edit mode is opt-out: post-Launch users land on the front end with // `extendify-quick-edit-on` already on ``. The page must still // behave like a visitor's page for navigation; selection has to layer on // top without breaking the click semantics users expect from links and // form controls. That contract lives in this file and two siblings: // // click-rule.js (this file) — what a click does // escape-rule.js — what Esc does // ../state/store.js — unified selection state // // Cursor (CSS, in quick-edit.css) telegraphs the click rule before the // click: crosshair on tagged-block content, pointer on anchors, UA // default on form controls. The CSS is the user-visible promise the JS // keeps. // // --- Click rule --- // // Capture-phase listener on `document` while edit mode is on. Given the // click target, returns the branch the listener should take. Wiring // (preventDefault, stopPropagation, hover-bar render/clear, the soft- // selection carve-out for the staged block) lives in hover-bar.js. // // Priority — first matching branch wins: // 1. anchor — let the browser navigate (cursor: pointer) // 2. pill / toolbar — let the bubble-phase pill handler fire // 3. form control — let the input/textarea/select/button focus // 4. tagged block — commit selection on the innermost tagged ancestor // 5. otherwise — outside-click, clear any open hover bar // // Anchor beats tagged-block intentionally: clicking a link in a nav menu // or a button inside a tagged section navigates. Pills carry // `data-extendify-quick-edit-pill` so they survive the form-control // branch (the pill is a