Fix className.includes bug (#3672)
This PR (should) fix a Sentry bug: https://tldraw.sentry.io/share/issue/c4cda01be5d142b79136e8ae97a7a3a7/ ### Change Type - [x] `sdk` — Changes the tldraw SDK - [x] `bugfix` — Bug fix ### Release Notes - Fixes a rare bug effecting text shapes on mobile.
This commit is contained in:
parent
06be91b97b
commit
9ba4f7cf2a
1 changed files with 6 additions and 6 deletions
|
@ -105,17 +105,17 @@ export function useCanvasEvents() {
|
|||
|
||||
function onTouchEnd(e: React.TouchEvent) {
|
||||
;(e as any).isKilled = true
|
||||
// check that e.target is an HTMLElement
|
||||
if (!(e.target instanceof HTMLElement)) return
|
||||
|
||||
if (
|
||||
(e.target as HTMLElement).tagName !== 'A' &&
|
||||
(e.target as HTMLElement).tagName !== 'TEXTAREA' &&
|
||||
e.target.tagName !== 'A' &&
|
||||
e.target.tagName !== 'TEXTAREA' &&
|
||||
// When in EditingShape state, we are actually clicking on a 'DIV'
|
||||
// not A/TEXTAREA element yet. So, to preserve cursor position
|
||||
// for edit mode on mobile we need to not preventDefault.
|
||||
// TODO: Find out if we still need this preventDefault in general though.
|
||||
!(
|
||||
editor.getEditingShape() &&
|
||||
(e.target as HTMLElement).className.includes('tl-text-content')
|
||||
)
|
||||
!(editor.getEditingShape() && e.target.className.includes('tl-text-content'))
|
||||
) {
|
||||
preventDefault(e)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue