## Implementation Plan: New-line Support in Chat Messages **Target files and changes** (derived from investigation findings; unstaged changes in working tree are not assumed—agent will apply all modifications explicitly): ### 1. `templates/messages.html` (line 61) Replace the single‑line `` with a multi‑line ` ``` - Remove `maxlength` (server‑side cap at 2000 remains, no client‑side truncation needed). - Keep `name`, `placeholder`, `autocomplete`, `data-mention`, `aria-label`. ### 2. `static/js/MessagesLayout.js` - **Line 17** – Change selector: ```javascript // Before const inputEl = form.querySelector('input[name="content"]'); // After const inputEl = form.querySelector('textarea[name="content"]'); ``` - **Add a keydown handler** (e.g., after line 154, before the existing submit logic) that intercepts Enter and allows Shift+Enter for newline: ```javascript inputEl.addEventListener('keydown', (e) => { if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); form.dispatchEvent(new Event('submit')); } }); ``` This ensures Enter sends the message and Shift+Enter inserts a newline (browser default behaviour). ### 3. `static/css/messages.css` Replace every CSS selector that currently targets `input[type="text"]` inside the message input area with `textarea`. Affected lines: 306, 458, 476 (approximate; use project’s exact line numbers). Add the following properties to the textarea rule (ensuring it looks and behaves like a growing input box): ```css .messages-input-area textarea { resize: none; overflow-y: auto; max-height: 150px; line-height: 1.4; white-space: pre-wrap; word-wrap: break-word; } ``` Remove or update any rules that specifically target `input[type="text"]` and are no longer applicable. ### 4. Test files – update selectors to `textarea[name='content']` | File | Line | Current selector | New selector | |---|---|---|---| | `tests/e2e/messages.py` | 179 | `page.fill("input[name='content']", msg)` | `page.fill("textarea[name='content']", msg)` | | `tests/e2e/notifications/index.py` | 443 | `pb.locator("input[name='content']").first` | `pb.locator("textarea[name='content']").first` | | `tests/e2e/notifications/index.py` | 756 | `pb.locator("input[name='content']").first` | `pb.locator("textarea[name='content']").first` | No changes needed in `bot/social.py` – its locator already includes both `input[name='content']` and `textarea[name='content']`. ### 5. Verification commands After applying all changes, execute: ```bash pip install -e '.[dev]' -q && make test-unit pip install -q ruff && ruff check . ``` --- ## Definition of Done - [ ] `templates/messages.html` – the `` has been replaced with a `