Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Fix editor expansion; Add editor styling; Change body editor [WIP]

Tomas Valentad159b4094525
diff --git a/components/Editor/RouteEditor/PromptEditor.tsx b/components/Editor/RouteEditor/PromptEditor.tsx
index c30f83eb5..0eb188c9e 100644
--- a/components/Editor/RouteEditor/PromptEditor.tsx
+++ b/components/Editor/RouteEditor/PromptEditor.tsx
@@ -19,12 +19,16 @@ function PromptEditor({ onChange, block }: Props) {
flex
w-full
h-full
+ pt-6
+ border-t
+ border-slate-200
">
<EditorContent
editor={editor}
className="
flex-1
flex
+ w-[65ch]
flex-col
"
/>
diff --git a/components/Editor/RouteEditor/RequestBodyEditor.tsx b/components/Editor/RouteEditor/RequestBodyEditor.tsx
index 02cc4528a..9007a9ad9 100644
--- a/components/Editor/RouteEditor/RequestBodyEditor.tsx
+++ b/components/Editor/RouteEditor/RequestBodyEditor.tsx
@@ -17,21 +17,15 @@ function RequestBodyEditor({
flex
flex-col
items-start
- max-w-[65ch]
flex-1
- border
- border-green-800/40
- rounded-lg
">
<div className="
self-stretch
rounded-t-lg
- py-1
- px-4
font-mono
- text-slate-400
- text-sm
- bg-gray-50
+ select-none
+ text-slate-300
+ text-xs
">
{'{'}
</div>
@@ -41,21 +35,20 @@ function RequestBodyEditor({
autoCorrect="off"
spellCheck="false"
name="block"
- placeholder="fieldName: Type,"
+ placeholder="fieldName: Type"
value={block.prompt}
onChange={e => onChange(e.target.value)}
className={clsx(
'w-full',
'pl-8',
'pr-4',
- 'py-2',
+ 'py-1',
'leading-6',
'tracking-wide',
'font-mono',
'text-slate-500',
'focus:text-slate-600',
'no-scroller',
- 'bg-white',
'outline-none',
'text-sm',
'placeholder:text-slate-300',
@@ -64,12 +57,10 @@ function RequestBodyEditor({
<div className="
self-stretch
rounded-b-lg
- py-1
- px-4
font-mono
- text-slate-400
- text-sm
- bg-gray-50
+ select-none
+ text-slate-300
+ text-xs
">
{'}'}
</div>
diff --git a/components/Editor/RouteEditor/index.tsx b/components/Editor/RouteEditor/index.tsx
index 2c6878257..986a784ff 100644
--- a/components/Editor/RouteEditor/index.tsx
+++ b/components/Editor/RouteEditor/index.tsx
@@ -11,21 +11,19 @@ export interface Props {
}
function RouteEditor({ route }: Props) {
- const store = useStateStore()
- const changeRoute = store.use.changeRoute()
-
const [requestBodyBlock, updateRequestBodyBlock] = useBlock('RequestBody', route)
const [promptBlock, updatePromptBlock] = useBlock('StructuredProse', route)
return (
<div className="
- py-2
+ py-8
px-4
flex
flex-1
bg-white
justify-center
- overflow-hidden
+ overflow-auto
+ scroller
">
{!route &&
<div className="
@@ -38,15 +36,9 @@ function RouteEditor({ route }: Props) {
{route &&
<div className="
flex
- flex-1
flex-col
- bg-slate-400
- items-center
- max-w-[65ch]
- min-h-0
- overflow-auto
- scroller
- space-y-2
+ items-start
+ space-y-8
">
{requestBodyBlock &&
<RequestBodyEditor
diff --git a/styles/global.css b/styles/global.css
index 47331c371..5ae29ea2e 100644
--- a/styles/global.css
+++ b/styles/global.css
@@ -1,5 +1,5 @@
@import 'highlight.js/styles/a11y-dark.css';
-/* @import './prosemirror.css'; */
+@import './prosemirror.css';
@tailwind base;
@tailwind components;
@@ -77,11 +77,3 @@ code::-webkit-scrollbar-thumb {
@apply bg-slate-300;
@apply rounded-full;
}
-
-.ProseMirror:focus {
- outline: none;
-}
-
-.ProseMirror {
- @apply h-full w-full;
-}
diff --git a/styles/prosemirror.css b/styles/prosemirror.css
index bbb5670bb..1ecf278a5 100644
--- a/styles/prosemirror.css
+++ b/styles/prosemirror.css
@@ -1,8 +1,6 @@
.ProseMirror {
- @apply whitespace-pre-wrap prose prose-sm;
- @apply max-w-[50rem];
- @apply whitespace-pre-wrap;
-
+ @apply prose prose-base text-slate-600;
+ @apply pb-40;
/*
* NOTE: Disabling overflow anchor fixes a code cell scrolling bug
* that happens in Chrome:
@@ -25,23 +23,8 @@
@apply outline-none;
}
-.ProseMirror p,
-.ProseMirror li,
-.ProseMirror ul,
-.ProseMirror h1,
-.ProseMirror h2,
-.ProseMirror h3 {
- @apply max-w-full;
-}
-
-.ProseMirror h1,
-.ProseMirror h2 {
- @apply py-2;
- @apply border-b border-gray-400;
-}
-
.ProseMirror p {
- @apply mx-0 my-1;
+ @apply mx-0 my-0 py-0 leading-6;
@apply whitespace-pre-wrap break-words;
}
@@ -51,21 +34,6 @@
content: attr(data-placeholder);
}
-.ProseMirror li {
- @apply relative;
-}
-
-.ProseMirror ul,
-.ProseMirror ol {
- @apply pl-8;
-}
-
-.ProseMirror code {
- @apply px-1.5 py-1;
- @apply font-normal;
- @apply rounded bg-gray-300;
-}
-
@keyframes ProseMirror-cursor-blink {
to {
visibility: hidden;