mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
Resolve effective bindings from stored prefs plus defaults with leader/direct collision handling and default leader Ctrl+X; let direct actions pass through in terminals and suppress abort while an overlay is open. Add half-page scroll disengage, verified overlay focus restore, and consolidate prompt reset.
26 lines
1012 B
TypeScript
26 lines
1012 B
TypeScript
const CONTENT_EDITABLE_VALUES = new Set(['', 'true', 'plaintext-only'])
|
|
|
|
/**
|
|
* Returns true for free-text entry targets: `<input>`, `<textarea>`, and any content-editable
|
|
* element (`contenteditable=""`, `"true"`, or `"plaintext-only"`).
|
|
*/
|
|
export function isTextEntryElement(element: Element): boolean {
|
|
if (element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement) return true
|
|
if (!(element instanceof HTMLElement)) return false
|
|
if (element.isContentEditable) return true
|
|
const contentEditable = element.getAttribute('contenteditable')
|
|
return contentEditable !== null && CONTENT_EDITABLE_VALUES.has(contentEditable.toLowerCase())
|
|
}
|
|
|
|
/**
|
|
* Returns true when the element carries the `data-prompt-input` attribute that marks the chat prompt.
|
|
*/
|
|
export function isPromptInput(element: Element): boolean {
|
|
return element.hasAttribute('data-prompt-input')
|
|
}
|
|
|
|
/**
|
|
* Selector matching the chat prompt input.
|
|
*/
|
|
export const PROMPT_INPUT_SELECTOR = 'textarea[data-prompt-input]'
|