Skip to content

Commit dbcd8d1

Browse files
authored
Merge branch 'main' into main
2 parents 8e85ba4 + 405e736 commit dbcd8d1

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"lodash": "^4.17.21",
3636
"luxon": "^3.7.1",
3737
"nanoid": "^5.1.5",
38-
"node-sql-parser": "^5.3.12",
38+
"node-sql-parser": "^5.3.13",
3939
"oracle-sql-parser": "^0.1.0",
4040
"react": "^18.2.0",
4141
"react-dom": "^18.2.0",

src/components/EditorCanvas/Note.jsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useMemo, useState, useRef } from "react";
1+
import { useMemo, useState, useRef, useEffect } from "react";
22
import { Action, ObjectType, Tab, State } from "../../data/constants";
33
import { Input, Button, Popover } from "@douyinfe/semi-ui";
44
import ColorPicker from "../EditorSidePanel/ColorPicker";
@@ -179,6 +179,14 @@ export default function Note({ data, onPointerDown }) {
179179
const width = data.width ?? noteWidth;
180180
const MIN_NOTE_WIDTH = 120;
181181

182+
useEffect(() => {
183+
const textarea = document.getElementById(`note_${data.id}`);
184+
textarea.style.height = "0";
185+
textarea.style.height = textarea.scrollHeight + "px";
186+
const newHeight = textarea.scrollHeight + 42;
187+
updateNote(data.id, { height: newHeight });
188+
}, [data.id, updateNote]);
189+
182190
return (
183191
<g
184192
onPointerEnter={(e) => e.isPrimary && setHovered(true)}
@@ -506,4 +514,4 @@ export default function Note({ data, onPointerDown }) {
506514
</foreignObject>
507515
</g>
508516
);
509-
}
517+
}

0 commit comments

Comments
 (0)