Commit 3a9a980
committed
fix(context-menu): preserve whitespace and selection on paste
Two fixes for context menu paste:
1. Prefer view.pasteText when plain text is available — Chromium wraps
writeText() output in HTML, which routes through handleHtmlPaste and
strips leading/trailing spaces. Still runs URL detection via
handleClipboardPaste with empty html.
2. Preserve range selection on right-click — the coordinate-based
isClickInsideSelection check is unreliable in presentation mode
(posAtCoords round-trip can misreport position), so keep any active
range selection instead of risking collapse.
3. Add preserveWhitespace to handleHtmlPaste as defense-in-depth for
HTML paste paths that don't have a plain-text fallback.1 parent 67011d9 commit 3a9a980
2 files changed
Lines changed: 18 additions & 27 deletions
File tree
Lines changed: 5 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
299 | | - | |
300 | | - | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
301 | 303 | | |
302 | 304 | | |
303 | | - | |
304 | 305 | | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
| 306 | + | |
314 | 307 | | |
315 | 308 | | |
316 | 309 | | |
| |||
Lines changed: 13 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
326 | | - | |
327 | | - | |
328 | | - | |
329 | | - | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | | - | |
337 | | - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
338 | 335 | | |
339 | | - | |
340 | | - | |
341 | | - | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
342 | 340 | | |
343 | 341 | | |
344 | 342 | | |
| |||
0 commit comments