fix: Position text editor absolute and fix the offsets so it doesn't remain fixed when container is scrolled (#3200)

* fix: Position text editor absolute and fix the offsets so it doesn't remain fixed when container is scrolled

* update changelog

* Update src/packages/excalidraw/CHANGELOG.md
This commit is contained in:
Aakansha Doshi 2021-03-07 21:12:10 +05:30 committed by GitHub
parent 862c065e33
commit 3a0a638a0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View File

@ -1578,7 +1578,10 @@ class App extends React.Component<ExcalidrawProps, AppState> {
}, },
this.state, this.state,
); );
return [viewportX, viewportY]; return [
viewportX - this.state.offsetLeft,
viewportY - this.state.offsetTop,
];
}, },
onChange: withBatchedUpdates((text) => { onChange: withBatchedUpdates((text) => {
updateElement(text); updateElement(text);

View File

@ -93,7 +93,7 @@ export const textWysiwyg = ({
editable.wrap = "off"; editable.wrap = "off";
Object.assign(editable.style, { Object.assign(editable.style, {
position: "fixed", position: "absolute",
display: "inline-block", display: "inline-block",
minHeight: "1em", minHeight: "1em",
backfaceVisibility: "hidden", backfaceVisibility: "hidden",

View File

@ -18,7 +18,8 @@ Please add the latest change on the top under the correct section.
### Fixes ### Fixes
- Scope css variables so that host css vars don't clash with excalidraw[#3199](https://github.com/excalidraw/excalidraw/pull/3199). - Position text editor absolute and fix the offsets so it doesn't remain fixed when the container is scrolled [#3200](https://github.com/excalidraw/excalidraw/pull/3200).
- Scope CSS variables so that host CSS vars don't clash with excalidraw [#3199](https://github.com/excalidraw/excalidraw/pull/3199).
--- ---