diff --git a/src-web/components/App.tsx b/src-web/components/App.tsx
index c3cba9f8..f2119190 100644
--- a/src-web/components/App.tsx
+++ b/src-web/components/App.tsx
@@ -2,12 +2,12 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { listen } from '@tauri-apps/api/event';
import { MotionConfig } from 'framer-motion';
import { HelmetProvider } from 'react-helmet-async';
-import { AppRouter } from './AppRouter';
import { requestsQueryKey } from '../hooks/useRequests';
import { responsesQueryKey } from '../hooks/useResponses';
import { DEFAULT_FONT_SIZE } from '../lib/constants';
import type { HttpRequest, HttpResponse } from '../lib/models';
import { convertDates } from '../lib/models';
+import { AppRouter } from './AppRouter';
const queryClient = new QueryClient();
diff --git a/src-web/components/RequestPane.tsx b/src-web/components/RequestPane.tsx
index a942dd4a..94b12487 100644
--- a/src-web/components/RequestPane.tsx
+++ b/src-web/components/RequestPane.tsx
@@ -21,18 +21,16 @@ export function RequestPane({ fullHeight, className }: Props) {
if (activeRequest === null) return null;
return (
-
-
- updateRequest.mutate({ method })}
- onUrlChange={(url) => updateRequest.mutate({ url })}
- sendRequest={sendRequest.mutate}
- />
-
+
+
updateRequest.mutate({ method })}
+ onUrlChange={(url) => updateRequest.mutate({ url })}
+ sendRequest={sendRequest.mutate}
+ />
@@ -66,6 +63,7 @@ export function RequestPane({ fullHeight, className }: Props) {
key={activeRequest.id}
useTemplating
className="!bg-gray-50"
+ heightMode={fullHeight ? 'full' : 'auto'}
defaultValue={activeRequest.body ?? ''}
contentType="application/json"
onChange={(body) => updateRequest.mutate({ body })}
diff --git a/src-web/components/ResponsePane.tsx b/src-web/components/ResponsePane.tsx
index f2bb314d..145f4272 100644
--- a/src-web/components/ResponsePane.tsx
+++ b/src-web/components/ResponsePane.tsx
@@ -43,10 +43,9 @@ export const ResponsePane = memo(function ResponsePane({ className }: Props) {
}
return (
-
diff --git a/src-web/components/Workspaces.tsx b/src-web/components/Workspaces.tsx
index f87ffcfe..467e266e 100644
--- a/src-web/components/Workspaces.tsx
+++ b/src-web/components/Workspaces.tsx
@@ -1,4 +1,5 @@
import { Button } from './core/Button';
+import { Editor } from './core/Editor';
import { Heading } from './core/Heading';
import { VStack } from './core/Stacks';
import { useWorkspaces } from '../hooks/useWorkspaces';
@@ -13,6 +14,7 @@ export default function Workspaces() {
{w.name}
))}
+
);
}
diff --git a/src-web/components/core/Editor/Editor.css b/src-web/components/core/Editor/Editor.css
index 65002f2b..dcf53b04 100644
--- a/src-web/components/core/Editor/Editor.css
+++ b/src-web/components/core/Editor/Editor.css
@@ -30,7 +30,7 @@
/* Style gutters */
.cm-gutters {
- @apply border-0 text-gray-500/60;
+ @apply border-0 text-gray-500/60 opacity-95;
.cm-gutterElement {
@apply cursor-default;
diff --git a/src-web/components/core/Editor/Editor.tsx b/src-web/components/core/Editor/Editor.tsx
index d343ac1c..894f21d0 100644
--- a/src-web/components/core/Editor/Editor.tsx
+++ b/src-web/components/core/Editor/Editor.tsx
@@ -40,6 +40,7 @@ export function _Editor({
singleLine,
}: _EditorProps) {
const cm = useRef<{ view: EditorView; langHolder: Compartment } | null>(null);
+ const wrapperRef = useRef(null);
// Unmount the editor
useUnmount(() => {
@@ -67,10 +68,9 @@ export function _Editor({
view.dispatch({ effects: langHolder.reconfigure(ext) });
}, [contentType]);
- // Initialize the editor
- const initDivRef = (el: HTMLDivElement | null) => {
- if (el === null || cm.current !== null) return;
-
+ // Initialize the editor when ref mounts
+ useEffect(() => {
+ if (wrapperRef.current === null || cm.current !== null) return;
try {
const langHolder = new Compartment();
const langExt = getLanguageExtension({ contentType, useTemplating });
@@ -79,7 +79,7 @@ export function _Editor({
extensions: [
langHolder.of(langExt),
...getExtensions({
- container: el,
+ container: wrapperRef.current,
onChange: handleChange,
onFocus: handleFocus,
readOnly,
@@ -90,18 +90,22 @@ export function _Editor({
}),
],
});
- const view = new EditorView({ state, parent: el });
+ const view = new EditorView({ state, parent: wrapperRef.current });
cm.current = { view, langHolder };
- syncGutterBg({ parent: el, className });
if (autoFocus) view.focus();
} catch (e) {
console.log('Failed to initialize Codemirror', e);
}
- };
+ }, [wrapperRef.current]);
+
+ useEffect(() => {
+ if (wrapperRef.current === null) return;
+ syncGutterBg({ parent: wrapperRef.current, className });
+ }, [className]);
return (
-
- Variables
+
+ Variables
);
+ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
+
+
+ ,
+);