File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
src/components/EditorCanvas Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 1- import { useMemo , useState , useRef } from "react" ;
1+ import { useMemo , useState , useRef , useEffect } from "react" ;
22import { Action , ObjectType , Tab , State } from "../../data/constants" ;
33import { Input , Button , Popover } from "@douyinfe/semi-ui" ;
44import ColorPicker from "../EditorSidePanel/ColorPicker" ;
@@ -169,6 +169,14 @@ export default function Note({ data, onPointerDown }) {
169169 ) ;
170170 } , [ selectedElement , data , bulkSelectedElements ] ) ;
171171
172+ useEffect ( ( ) => {
173+ const textarea = document . getElementById ( `note_${ data . id } ` ) ;
174+ textarea . style . height = "0" ;
175+ textarea . style . height = textarea . scrollHeight + "px" ;
176+ const newHeight = textarea . scrollHeight + 42 ;
177+ updateNote ( data . id , { height : newHeight } ) ;
178+ } ) ;
179+
172180 return (
173181 < g
174182 onPointerEnter = { ( e ) => e . isPrimary && setHovered ( true ) }
@@ -364,4 +372,4 @@ export default function Note({ data, onPointerDown }) {
364372 </ foreignObject >
365373 </ g >
366374 ) ;
367- }
375+ }
You can’t perform that action at this time.
0 commit comments