textfields: fix regression with Text shape and resizing (#3333)

The refactor of the textfields in this PR
https://github.com/tldraw/tldraw/pull/3050 caused a regression in
resizing Text shapes. (as demonstrated in this PR's video:
https://github.com/tldraw/tldraw/pull/3327)
We reverted that PR and now this PR updates the CSS to fix the gap that
was introduced when it was refactored.

### 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
pull/3051/head
Mime Čuvalo 2024-04-03 11:01:04 +01:00 zatwierdzone przez GitHub
rodzic 843347bde1
commit 03e4c8575c
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
2 zmienionych plików z 14 dodań i 23 usunięć

Wyświetl plik

@ -697,7 +697,8 @@ input,
padding: 0px;
margin: 0px;
border: none;
height: 100%;
width: fit-content;
height: fit-content;
font-variant: normal;
font-style: normal;
pointer-events: all;
@ -806,6 +807,17 @@ input,
outline: none;
}
.tl-text-content__wrapper {
position: relative;
width: fit-content;
height: fit-content;
display: flex;
align-items: center;
justify-content: center;
pointer-events: none;
min-height: auto;
}
.tl-text-content {
pointer-events: none;
}
@ -1015,17 +1027,6 @@ input,
pointer-events: all;
}
.tl-text-label__inner {
position: relative;
width: fit-content;
height: fit-content;
display: flex;
align-items: center;
justify-content: center;
pointer-events: none;
min-height: auto;
}
.tl-text-label__inner > .tl-text-content {
position: relative;
top: 0px;
@ -1114,17 +1115,7 @@ input,
.tl-arrow-label textarea {
z-index: 3;
margin: 0px;
padding: 4px;
height: 100%;
width: 100%;
position: absolute;
resize: none;
border: 0px;
user-select: all;
-webkit-user-select: text;
caret-color: var(--color-text);
border-image: none;
/* Don't allow textarea to be zero width */
min-width: 4px;
}

Wyświetl plik

@ -90,7 +90,7 @@ export const TextLabel = React.memo(function TextLabel({
}}
>
<div
className={`${cssPrefix}-label__inner`}
className={`${cssPrefix}-label__inner tl-text-content__wrapper`}
style={{
fontSize,
lineHeight: fontSize * lineHeight + 'px',