(inputValue?: { value?: string })
| 813 | } |
| 814 | |
| 815 | const openEditor = async (inputValue?: { value?: string }) => { |
| 816 | input.onInputClear() |
| 817 | syncDraft() |
| 818 | hide() |
| 819 | |
| 820 | const current = clonePrompt(draft) |
| 821 | try { |
| 822 | const content = await input.onEditorOpen({ |
| 823 | value: inputValue?.value ?? current.text, |
| 824 | }) |
| 825 | if (content === undefined) { |
| 826 | return |
| 827 | } |
| 828 | const normalized = normalizePromptContent(content) |
| 829 | |
| 830 | restore({ |
| 831 | text: normalized, |
| 832 | parts: realignEditorPromptParts(normalized, current.parts), |
| 833 | ...(current.mode ? { mode: current.mode } : {}), |
| 834 | ...(current.command ? { command: current.command } : {}), |
| 835 | }) |
| 836 | } catch { |
| 837 | restore(current) |
| 838 | input.onStatus("failed to open editor") |
| 839 | } |
| 840 | } |
| 841 | |
| 842 | const select = (item?: PromptOption) => { |
| 843 | const next = item ?? options()[menu.selected()] |
no test coverage detected