feat(api-client): Postman-style multi-line variable values (RQ-4145) - #111
Draft
Kanishkrawatt wants to merge 1 commit into
Draft
feat(api-client): Postman-style multi-line variable values (RQ-4145)#111Kanishkrawatt wants to merge 1 commit into
Kanishkrawatt wants to merge 1 commit into
Conversation
String-typed variable values in the environment/runtime variables table are now edited with an expand-on-focus multi-line editor instead of an antd `Input`, which silently stripped newlines out of any value it touched. - `SingleLineEditor` gains two opt-in props, `multiline` and `readOnly`. In multiline mode it wraps long lines, renders a `↵` glyph at every line end, binds Shift+Enter to insert a newline and Enter to commit (by blurring, which the existing blur handler turns into a save), and leaves pasted newlines intact instead of flattening them to spaces. - Collapse-on-blur / expand-on-focus is pure CSS driven off CodeMirror's own `.cm-focused` class: one line tall when blurred, growing to a scrollable 180px cap when focused. Read-only cells cannot take focus, so they expand on hover instead. - The single-line constraint is fixed at the root for every consumer. It used to drop any transaction whose document had more than one line, so a value that already contained newlines froze the cell completely — no cursor, no selection, no copy (RQ-4135). It now drops only transactions that *grow* the line count, leaving pre-existing multi-line values navigable and editable in the URL bar, headers, params, path variables and auth fields too. - The CodeMirror extensions move to `singleLineEditorExtensions.ts` with unit tests covering the constraint and the glyph positions. The key column stays single-line, and secret values keep the masked input. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RQ-4145
Problem
String-typed variable values in the environment/runtime variables table were edited with an antd
<Input>. An<input>element's value sanitization strips line breaks, so any value containing newlines was displayed mangled and silently lost its newlines the moment the user typed into the cell.The underlying
SingleLineEditorhad the same latent problem from the other direction: itstransactionFilterdropped any transaction whose document had more than one line, so a value that already contained newlines made the editor completely inert — no cursor, no arrow movement, no selection, no copy (RQ-4135).What changed
SingleLineEditorgains two opt-in props:multilineandreadOnly.In multiline mode it:
↵glyph at every line endCollapse-on-blur / expand-on-focus is pure CSS, driven off CodeMirror's own
.cm-focusedclass — one line tall when blurred, growing in place to a scrollable 180px cap when focused. No focus-swap state machine. Read-only content can't take focus, so those cells expand on hover instead.The single-line constraint is fixed at the root, for every consumer. It now drops only transactions that grow the line count, so a pre-existing multi-line value stays navigable, editable and copyable in the URL bar, headers, params, path variables and auth fields too — not just in the cell this ticket names.
Variables table:
String-typed value cells (syncValue/localValue) render the new editor. The key column stays single-line,Secretkeeps its masked input, and Number/Boolean are untouched.The CodeMirror extensions moved to
singleLineEditorExtensions.tsso the logic is unit-testable without a DOM.Scope decisions
KeyValueTablevalue columns. Headers and params genuinely cannot contain newlines, so they only needed the inert-cell fix, which they get for free from the shared constraint change.↵glyph rather than a…ellipsis. Atext-overflow: ellipsisisn't reachable inside CodeMirror's line divs, and the glyph carries the same "there is more here" signal at zero cost.Testing
app/src/.../SingleLineEditor/singleLineEditorExtensions.test.ts— 6 tests, passing, exercising realEditorStatetransactions:↵glyph positions: every line end except the lastNot verified: the repo-wide
npm run type-checkand a real browser pass. This machine's disk is full (126 MB free of 228 GB), sonpm installcould not complete — it rolled back twice. The two touched.tsxfiles were parse- and type-checked in isolation, and every CodeMirror API used (EditorState.readOnly,EditorView.editable,EditorView.lineWrapping,state.replaceSelection) was confirmed against the installed.d.ts. The visual behaviour — collapsed height, expanded cap, glyph placement, focus border — still needs a look in the app.🤖 Generated with Claude Code