| Server IP : 66.29.153.156 / Your IP : 216.73.216.114 Web Server : LiteSpeed System : Linux premium322.web-hosting.com 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64 User : lastyfjz ( 1521) PHP Version : 8.1.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/./lastyfjz/unicitys.com/wp-content/plugins/extendify/src/QuickEdit/lib/ |
Upload File : |
// Pure Esc decision for the global keydown handler. Wiring (listener
// attach, stopPropagation, store mutations) lives in global-escape.js.
// See click-rule.js's module header for the full unified-selector
// contract this is one piece of.
//
// Priority order matches the user-facing contract:
// 1. agent block + QE on the SAME block → clear both in one keypress
// (two-pill click stages both; collapsing the unwind keeps Esc as
// a single dismissal gesture rather than the user pressing twice)
// 2. agent block staged → clear it (also cancels the in-flight workflow)
// 3. QE selection set → clear it
// 4. committedSelection → clear it (sticky pre-pill-action commit)
// 5. otherwise → noop (Esc must not flip edit mode off)
//
// Edit mode off is a pass-through: the per-surface Esc handlers
// (BlockTextEditor capture-phase, WP <Modal>, image-menu) keep working
// because the global handler only consumes Esc while edit mode is on.
export const decideEscapeAction = ({
editModeOn,
hasAgentBlock,
hasQuickEditSelection,
hasCommittedSelection,
sameBlock = false,
}) => {
if (!editModeOn) return { action: 'pass-through' };
if (hasAgentBlock && hasQuickEditSelection && sameBlock) {
return { action: 'clear-selection-and-agent-block' };
}
if (hasAgentBlock) return { action: 'clear-agent-block' };
if (hasQuickEditSelection) return { action: 'clear-selection' };
if (hasCommittedSelection) return { action: 'clear-committed-selection' };
return { action: 'noop' };
};