()
| 69 | |
| 70 | // Selection = the half-open range [min(anchor,cursor), max(anchor,cursor)). |
| 71 | const hasSelection = anchor !== null && anchor !== cursor; |
| 72 | const selFrom = anchor === null ? cursor : Math.min(anchor, cursor); |
| 73 | const selTo = anchor === null ? cursor : Math.max(anchor, cursor); |
| 74 | |
| 75 | const clearAll = () => { |
| 76 | onChange(''); |
| 77 | setCursor(0); |
| 78 | setAnchor(null); |
| 79 | setAttachments([]); |
| 80 | histIdx.current = null; |