Skip to content

Commit 5147237

Browse files
committed
have ref prop
1 parent 80693cf commit 5147237

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/components/repl.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export interface ReplProps {
4141
current: string;
4242
setCurrent: (tabId: string) => void;
4343
onEditorReady?: (editor: mEditor.IStandaloneCodeEditor) => unknown;
44+
ref?: HTMLDivElement | ((el: HTMLDivElement) => void) | undefined;
4445
}
4546

4647
export const Repl: Component<ReplProps> = (props) => {
@@ -262,7 +263,12 @@ export const Repl: Component<ReplProps> = (props) => {
262263

263264
return (
264265
<div
265-
ref={(el) => setGrid(el)}
266+
ref={(el) => {
267+
setGrid(el);
268+
if (props.ref) {
269+
(props.ref as (el: HTMLDivElement) => void)(el);
270+
}
271+
}}
266272
class="relative grid bg-blueGray-50 h-full overflow-hidden text-blueGray-900 dark:text-blueGray-50 font-sans"
267273
classList={{
268274
'wrapper--forced': props.isHorizontal,

0 commit comments

Comments
 (0)