Files
PaperClipAI/ui
DottaandPaperclip 306437a2a5 fix(ui): support rich list editing and keyboard handling in all composers (#23766)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - Users write instructions, replies, and chat messages in the UI
composers (`TaskChatComposer`, `IssueChatComposer`, `CommentThread`,
`ChatComposer`, and `MarkdownEditor`).
> - Enter now submits messages by default and Shift+Enter inserts a
newline.
> - In rich editors, Shift+Enter inserted a soft `<br>` line break
instead of a new paragraph or list item, which blocked markdown list
shortcuts and stopped bulleted and numbered lists from continuing.
> - Inside lists, Tab inserted a literal tab character when the caret
was not at column 0, Shift+Tab triggered work-mode cycling in
`TaskChatComposer` instead of dedenting, and removing a parent item left
orphaned nested lists.
> - Plain-text textarea composers (`ChatComposer` and the
`MarkdownEditor` raw fallback) also lacked list continuation, Tab
indent, Shift+Tab dedent, and Backspace marker removal.
> - This pull request adds unified rich and plain-text list keyboard
handling and nested list styling across all composers.
> - The benefit is smooth creation, continuation, deletion, indentation,
and dedentation of bulleted, numbered, and checklist items in every
composer.

## Linked Issues or Issue Description

No pre-existing public GitHub issue was found after searching open
issues and PRs.

**What happened?**
When a composer uses Enter to submit and Shift+Enter to insert a
newline, typing `- ` or `1. ` after a newline does not start a rich list
because Shift+Enter inserts a soft `<br>` break inside the same
paragraph. Inside an existing list, Shift+Enter inserts a `<br>` inside
the same `<li>` instead of adding the next list item. Pressing Tab
mid-item inserts a tab character instead of indenting, pressing
Shift+Tab inside `TaskChatComposer` cycles work mode instead of
dedenting the list item, and plain-text textarea composers provide no
list keyboard shortcuts.

**Expected behavior**
In every composer, users can start bulleted and numbered lists after a
newline, add new list items with the active newline shortcut
(Shift+Enter in Enter-to-submit mode, Enter in Cmd/Ctrl+Enter mode),
indent with Tab, dedent or un-list with Shift+Tab, and delete or exit
list items cleanly with Backspace or an empty-item newline.

**Steps to reproduce**
1. Open any Enter-to-submit composer (for example, the task composer,
new task modal, comment composer, or board chat).
2. Type a line of text, press Shift+Enter, and type `- first item`.
3. Press Shift+Enter to add a second item, Tab to indent, Shift+Tab to
dedent, and Backspace to remove the bullet.

**Paperclip version or commit**
`master` (`62821e8766`)

**Deployment mode**
Local dev (pnpm dev)

## What Changed

- Added `ui/src/lib/list-editing.ts` (`listEditingPlugin`,
`registerListEditingCommands`, `isSelectionInsideList`) for
MDXEditor/Lexical composers:
- Maps Shift+Enter to `INSERT_PARAGRAPH_COMMAND` when `submitKey ===
"enter"` so markdown list shortcuts work after newlines, list items
continue cleanly, and empty list items dedent or exit.
- Preserves Shift+Enter as a soft line break when `submitKey ===
"mod-enter"` and reacts dynamically if the preference changes.
- Handles Tab indent and Shift+Tab dedent (or lift to paragraph at top
level) from any caret offset inside a list item, snaps original indent
depths so multi-level Shift+Tab dedents each selected item by one level,
and prevents orphaned nested lists when indenting the first item or
removing/exiting a parent item.
- Added `ui/src/lib/textarea-list-editing.ts`
(`applyTextareaListKeyDown`, `isTextareaSelectionInList`) for plain-text
textarea composers:
- Continues unordered, ordered (with sibling renumbering), and checklist
lines on Shift+Enter (or Enter in `mod-enter` mode), dedents/exits empty
list lines, indents with Tab, dedents/un-lists with Shift+Tab, and
cleans list markers on Backspace.
- Wired `listEditingPlugin` and `applyTextareaListKeyDown` into
`ui/src/components/MarkdownEditor.tsx` (rich mode and raw fallback
textarea), preserved Shift+Tab for dedent while autocomplete is open,
cleared the mount-reset flag on Tab/Shift+Enter, and treated rendered
`<li>` nodes as meaningful editor content.
- Updated `ui/src/components/task-chat/TaskChatComposer.tsx` so
Shift+Tab defers to list dedent when the selection is inside a list and
still cycles work modes outside lists.
- Wired `applyTextareaListKeyDown` into
`ui/src/components/ChatComposer.tsx`.
- Added nested bullet (`disc`, `circle`, `square`) and ordered
(`decimal`, `lower-alpha`, `lower-roman`) marker styles and suppressed
markers on Lexical's nested-list wrapper `<li>` elements in
`ui/src/index.css`.
- Added real-Lexical, textarea, `ChatComposer`, `MarkdownEditor`, and
`TaskChatComposer` tests.

## Verification

- Verified post-rebase on commit `62821e8766`:
- `pnpm vitest run ui/src/lib/list-editing.test.ts
ui/src/lib/textarea-list-editing.test.ts
ui/src/components/ChatComposer.test.tsx
ui/src/components/MarkdownEditor.test.tsx
ui/src/components/task-chat/TaskChatComposer.test.tsx` — 5 test files,
300 tests passed.
  - `pnpm --filter @paperclipai/ui typecheck` — passed.
- `pnpm --filter @paperclipai/ui build` — passed (verified prior to
rebase on identical code; CI supplies full typecheck, build, and test
coverage on `62821e8766`).
  - `node scripts/check-forbidden-tokens.mjs` — passed.
- `node scripts/local-verify.mjs --explain` — exited 2 because
`ui/src/index.css` is a broad input; CI supplies the full suite.

## Risks

- Low risk. Changes are scoped to UI composer keyboard handlers and
`.paperclip-mdxeditor-content` list CSS rules.
- Outside lists, Tab and Shift+Tab retain their existing behavior
(including Shift+Tab work-mode cycling in `TaskChatComposer`).
- In `mod-enter` mode (document editors and legacy composer submit
mode), plain Enter remains the paragraph/list key and Shift+Enter
remains a soft break.

## Model Used

- Google Gemini (Antigravity agent, high reasoning mode, tool use and
code execution)

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [ ] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
2026-12-04 16:41:13 -06:00
..
…

@paperclipai/ui

Published static assets for the Paperclip board UI.

What gets published

The npm package contains the production build under dist/. It does not ship the UI source tree or workspace-only dependencies.

Storybook

Storybook config, stories, and fixtures live under ui/storybook/.

pnpm --filter @paperclipai/ui storybook
pnpm --filter @paperclipai/ui build-storybook

Typical use

Install the package, then serve or copy the built files from node_modules/@paperclipai/ui/dist.

Editor dependency identity

Keep the root and workspace overrides for @codemirror/state, @codemirror/view, and @lezer/common aligned. CodeMirror requires shared extension identity, while Lezer parsers and syntax highlighters require shared NodeProp IDs. Multiple Lezer copies can crash code-block highlighting with tags is not iterable. src/lib/codemirror-single-instance.test.ts checks the installed dependency graph and highlights sample code through the editor's real language dependencies. GitHub Actions owns regeneration of pnpm-lock.yaml.