textfields: only do pointer capture when not editing (#3407)

Fixes https://linear.app/tldraw/issue/TLD-2374/can-lose-focus-and-caret

#focus-issues #blood-moat

### Change Type

<!--  Please select a 'Scope' label ️ -->

- [x] `sdk` — Changes the tldraw SDK
- [ ] `dotcom` — Changes the tldraw.com web app
- [ ] `docs` — Changes to the documentation, examples, or templates.
- [ ] `vs code` — Changes to the vscode plugin
- [ ] `internal` — Does not affect user-facing stuff

<!--  Please select a 'Type' label ️ -->

- [x] `bugfix` — Bug fix
- [ ] `feature` — New feature
- [ ] `improvement` — Improving existing features
- [ ] `chore` — Updating dependencies, other boring stuff
- [ ] `galaxy brain` — Architectural changes
- [ ] `tests` — Changes to any test code
- [ ] `tools` — Changes to infrastructure, CI, internal scripts,
debugging tools, etc.
- [ ] `dunno` — I don't know
lu/frame-kickout-rotation^2
Mime Čuvalo 2024-04-09 08:49:24 +01:00 zatwierdzone przez GitHub
rodzic 4a5068f681
commit 994b0f8baa
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
1 zmienionych plików z 4 dodań i 2 usunięć

Wyświetl plik

@ -160,9 +160,11 @@ export function useEditableText(id: TLShapeId, type: string, text: string) {
// This is important so that when dragging a shape using the text label,
// the shape continues to be dragged, even if the cursor is over the UI.
setPointerCapture(e.currentTarget, e)
if (!isEditing) {
setPointerCapture(e.currentTarget, e)
}
},
[editor, id]
[editor, id, isEditing]
)
const handleDoubleClick = stopEventPropagation