Skip to content
Open
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions client/src/components/bodyEditor/BodyEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type BodyEditorProps = {
contentType: string;
setContentType: any;
setContentTypeHeader: any;
setEditorView?: any;
};

function BodyEditor({
Expand All @@ -28,6 +29,7 @@ function BodyEditor({
contentType,
setContentType,
setContentTypeHeader,
setEditorView,
}: BodyEditorProps) {
const toast = useToast();
function handleBeautifyClick() {
Expand Down Expand Up @@ -71,6 +73,7 @@ function BodyEditor({
setContent={setContent}
selectedEnvData={selectedEnvData}
contentType={contentType}
setEditorView={setEditorView}
/>
);
}
Expand Down
10 changes: 9 additions & 1 deletion client/src/components/bodyEditor/BodyTextEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ type BodyTextEditorProps = {
setContent: any;
selectedEnvData: Record<string, string>;
contentType: string;
setEditorView?: any;
};

function BodyTextEditor({
content,
setContent,
selectedEnvData,
contentType,
setEditorView,
}: BodyTextEditorProps) {
const { colorMode } = useColorMode();

Expand All @@ -51,7 +53,7 @@ function BodyTextEditor({

const ref = useRef<HTMLDivElement>(null);

const { setContainer } = useCodeMirror({
const { setContainer, view } = useCodeMirror({
container: ref.current,
onChange: (value: string) => setContent(value),
extensions: [extensions],
Expand All @@ -60,6 +62,12 @@ function BodyTextEditor({
style: { height: '100%' },
});

useEffect(() => {
if (view && setEditorView) {
setEditorView(view);
}
}, [view, setEditorView]);

useEffect(() => {
if (ref.current) {
setContainer(ref.current);
Expand Down
Loading