|
266 | 266 | * ======================================================================== |
267 | 267 | * Replaces the legacy `.text-collapse` rule from |
268 | 268 | * src/lib/scss/custom/pages/_conversation.scss. The dialog text is |
269 | | - * collapsed to the first 5 lines by default; clicking the More button |
| 269 | + * collapsed to the first 10 lines by default; clicking the More button |
270 | 270 | * removes this class so the content can flow to its natural height. |
271 | 271 | * |
272 | 272 | * Two clamping mechanisms are layered here for reliability: |
273 | | - * 1. `-webkit-line-clamp: 5` with `display: -webkit-box` gives the |
| 273 | + * 1. `-webkit-line-clamp: 10` with `display: -webkit-box` gives the |
274 | 274 | * nicer "line truncation with ellipsis" effect on simple text. |
275 | 275 | * 2. `max-height: 10lh` is the hard fallback. The inner `<Markdown>` |
276 | 276 | * wraps its rendered HTML in a `.markdown-container` with |
277 | 277 | * `overflow-x: auto`, which establishes its own block formatting |
278 | 278 | * context — that BFC defeats line-clamp on the parent because text |
279 | 279 | * flow is sealed inside the child. The max-height cap clips |
280 | 280 | * reliably regardless of inner BFCs and is what actually keeps long |
281 | | - * code blocks / tables collapsed. |
| 281 | + * code blocks / tables collapsed. A `::after` pseudo-element below |
| 282 | + * paints a '...' in the bottom-right corner so the truncation is |
| 283 | + * still signaled visually when line-clamp's native ellipsis is |
| 284 | + * suppressed by the inner BFC. |
282 | 285 | */ |
283 | 286 | .text-collapse { |
| 287 | + position: relative; |
284 | 288 | overflow: hidden; |
285 | 289 | max-height: 10lh; |
286 | 290 | display: -webkit-box; |
287 | 291 | -webkit-box-orient: vertical; |
288 | | - -webkit-line-clamp: 5; |
289 | | - line-clamp: 5; |
| 292 | + -webkit-line-clamp: 10; |
| 293 | + line-clamp: 10; |
| 294 | +} |
| 295 | + |
| 296 | +/* Ellipsis fallback for collapsed content whose inner BFC defeats |
| 297 | + * -webkit-line-clamp (notably the Markdown container's overflow-x: auto |
| 298 | + * around code blocks / tables). The native line-clamp ellipsis already |
| 299 | + * handles plain text; this pseudo-element guarantees a '...' indicator |
| 300 | + * is rendered even when line-clamp is sealed inside the child BFC. |
| 301 | + * |
| 302 | + * The gradient fades from transparent to the conversation page |
| 303 | + * background (white) so the '...' sits cleanly over the last visible |
| 304 | + * line without obscuring readable text. */ |
| 305 | +.text-collapse::after { |
| 306 | + content: '...'; |
| 307 | + position: absolute; |
| 308 | + right: 0; |
| 309 | + bottom: 0; |
| 310 | + padding: 0 0.25rem 0 1.5rem; |
| 311 | + background: linear-gradient(to right, rgba(255, 255, 255, 0), rgb(255 255 255) 50%); |
| 312 | + color: inherit; |
| 313 | + font-weight: inherit; |
| 314 | + pointer-events: none; |
290 | 315 | } |
291 | 316 |
|
292 | 317 |
|
|
0 commit comments