Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/components/EditorCanvas/Note.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useMemo, useState, useRef } from "react";
import { useMemo, useState, useRef, useEffect } from "react";
import { Action, ObjectType, Tab, State } from "../../data/constants";
import { Input, Button, Popover } from "@douyinfe/semi-ui";
import ColorPicker from "../EditorSidePanel/ColorPicker";
Expand Down Expand Up @@ -169,6 +169,14 @@
);
}, [selectedElement, data, bulkSelectedElements]);

useEffect(() => {
const textarea = document.getElementById(`note_${data.id}`);
textarea.style.height = "0";
textarea.style.height = textarea.scrollHeight + "px";
const newHeight = textarea.scrollHeight + 42;
updateNote(data.id, { height: newHeight });
}, []);

Check warning on line 178 in src/components/EditorCanvas/Note.jsx

View workflow job for this annotation

GitHub Actions / build (20.x)

React Hook useEffect has missing dependencies: 'data.id' and 'updateNote'. Either include them or remove the dependency array

Check warning on line 178 in src/components/EditorCanvas/Note.jsx

View workflow job for this annotation

GitHub Actions / build (18.x)

React Hook useEffect has missing dependencies: 'data.id' and 'updateNote'. Either include them or remove the dependency array

return (
<g
onPointerEnter={(e) => e.isPrimary && setHovered(true)}
Expand Down
Loading