Files
windmill/frontend
Guilhem 365e20410e feat(ai-chat): collapse big pastes, cap input height, escape HTML (#9487)
* feat(ai-chat): collapse big pastes, cap input height, escape HTML

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* refactor(ai-chat): concentrate paste expand/render in a ChatDraft module

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat(ai-chat): step caret over paste chips as one unit

Arrow-Left/Right now jump edge-to-edge across a collapsed-paste chip
instead of crawling through the invisible token characters, and snap the
caret out if it lands inside a token. Shift extends the selection across
the whole chip; word/line jumps (alt/cmd/ctrl) are left to the browser.
Mirrors the existing atomic-deletion behavior so traversal and deletion
both treat the chip as a single object.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(ai-chat): atomic chip deletion on overlapping selections + plural label

A selection that partially overlapped a paste token previously hit the
collapsed-caret early-return, so the browser deleted a partial token and
left an orphaned zero-width run plus a dangling pastes registry entry.
handlePasteDeletion now widens the deletion range to cover each overlapped
token whole and drops all affected pastes entries (shared removePasteRange
helper). Strict overlap, so abutting a chip edge doesn't pull it in.

Also route line-count pluralization through a shared lineCount() helper so
a 1-line paste reads "1 line" in the conversation bubble too, not "1 lines".

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(ai-chat): full chip atomicity via beforeinput + expand on copy/cut

Addresses review nits on PR #9487:

- Chip atomicity is no longer limited to Backspace/Delete keydown. A new
  beforeinput handler takes over any selection-spanning edit that overlaps
  a paste chip — typing over a selection, paste, drag-and-drop, and
  Backspace/Delete over a selection — and applies it to the whole token(s)
  via a shared replacePasteRange, so a partial edit can no longer leave an
  orphaned zero-width run or a dangling pastes registry entry. handlePaste
  is likewise widened so a large paste onto a chip replaces it whole. The
  keydown handler now only covers the collapsed-caret-at-boundary case
  beforeinput can't see.
- Copy/cut of a selection containing a chip now puts the expanded content
  on the clipboard instead of the chip label + its zero-width run; cut also
  removes the chip whole. This also removes the duplicate-token re-paste
  vector (the clipboard never carries a raw token anymore).
- Rename lineCount -> lineCountLabel: it returns a formatted string, not a
  count, so the name shouldn't read like an accessor.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(ai-chat): address cubic + claude review findings on the paste feature

cubic-dev-ai findings:
- autosize: clear inline overflow-y on the uncapped path so a capped->
  uncapped toggle can't leave a stale `auto`/`hidden`.
- pasteTokens: new countLines() ignores a single trailing newline, so a
  10-line paste with a trailing \n no longer counts as 11 (off-by-one in
  shouldCollapsePaste and the chip's reported line count).
- ContextTextarea: the @-mention picker anchor now subtracts the textarea's
  own scrollTop/Left and is recomputed on internal scroll, so it stays
  pinned once the input is capped at 40vh and scrolls.

claude re-review findings:
- ContextTextarea: drag-and-drop of a selection containing a chip now puts
  the expanded content on the drag payload via ondragstart (mirroring
  copy/cut), so a dragged chip no longer orphans its token and loses the
  pasted content (or leaks the label to an external target).
- ContextTextarea: handlePasteBeforeInput now guards on e.cancelable and a
  HANDLED_INPUT_TYPES whitelist, so historyUndo/Redo (Ctrl+Z) and
  non-cancelable insertCompositionText (IME) are left to the browser
  instead of being reinterpreted as a delete / rewritten mid-composition.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 14:58:01 +00:00
..
2026-01-22 16:20:01 +00:00
2025-12-23 18:19:30 +00:00
2026-02-19 09:33:33 +00:00
2026-03-05 18:11:40 +01:00
2026-01-22 16:20:01 +00:00
2026-03-18 11:38:22 +00:00
2026-02-19 09:33:33 +00:00

Windmill frontend

The Windmill frontend written in Svelte 5 + Tailwind CSS

The frontend is under AGPL, see the LICENSE file at the root of this repo