18 lines
462 B
TypeScript
18 lines
462 B
TypeScript
import { useEffect, useRef } from 'react';
|
|
import { BaseEditor } from '../../editor/editor';
|
|
|
|
export const FileEditor = () => {
|
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
useEffect(() => {
|
|
const editor = new BaseEditor();
|
|
if (containerRef.current) {
|
|
editor.createEditor(containerRef.current);
|
|
}
|
|
return () => {
|
|
editor.destroyEditor();
|
|
};
|
|
}, []);
|
|
|
|
return <div ref={containerRef} className='w-full h-full'></div>;
|
|
};
|