Skip to content

Commit e0394c5

Browse files
committed
Revert "Merge pull request #3818 from Agenta-AI/fix/ui-improvements-editor-sidebar"
This reverts commit 3616e17, reversing changes made to ae99182.
1 parent 3616e17 commit e0394c5

File tree

7 files changed

+55
-163
lines changed

7 files changed

+55
-163
lines changed

web/oss/src/components/Editor/plugins/markdown/markdownPlugin.tsx

Lines changed: 14 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -123,47 +123,20 @@ const MarkdownPlugin = ({id}: {id: string}) => {
123123
return editor.registerCommand(
124124
KEY_ENTER_COMMAND,
125125
(event) => {
126-
let handled = false
127-
editor.update(
128-
() => {
129-
const selection = $getSelection()
130-
if (!$isRangeSelection(selection)) return
131-
132-
const anchorNode = selection.anchor.getNode()
133-
const topNode = anchorNode.getTopLevelElementOrThrow()
134-
135-
if ($isCodeNode(topNode) && topNode.getLanguage() === "markdown") {
136-
event?.preventDefault()
137-
138-
// Save scroll position before inserting text to prevent
139-
// the browser from auto-scrolling to the bottom
140-
const rootElement = editor.getRootElement()
141-
const scrollContainer = rootElement?.closest(
142-
".agenta-editor-wrapper",
143-
) as HTMLElement | null
144-
const savedScrollTop = scrollContainer?.scrollTop ?? 0
145-
const savedElementScrollTop = rootElement?.scrollTop ?? 0
146-
147-
selection.insertRawText("\n")
148-
149-
// Restore scroll position after DOM update
150-
if (scrollContainer) {
151-
requestAnimationFrame(() => {
152-
scrollContainer.scrollTop = savedScrollTop
153-
})
154-
}
155-
if (rootElement) {
156-
requestAnimationFrame(() => {
157-
rootElement.scrollTop = savedElementScrollTop
158-
})
159-
}
160-
161-
handled = true
162-
}
163-
},
164-
{discrete: true},
165-
)
166-
return handled
126+
editor.update(() => {
127+
const selection = $getSelection()
128+
if (!$isRangeSelection(selection)) return false
129+
130+
const anchorNode = selection.anchor.getNode()
131+
const topNode = anchorNode.getTopLevelElementOrThrow()
132+
133+
if ($isCodeNode(topNode) && topNode.getLanguage() === "markdown") {
134+
event?.preventDefault()
135+
selection.insertRawText("\n")
136+
return true
137+
}
138+
})
139+
return true
167140
},
168141
COMMAND_PRIORITY_HIGH,
169142
)

web/oss/src/components/Playground/Components/Menus/SelectVariant/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ const SelectVariant = ({
304304

305305
// Normal mode: standard picker
306306
return (
307-
<div style={style ?? {width: 200}}>
307+
<div style={style ?? {width: 120}}>
308308
<EntityPicker<PlaygroundRevisionSelectionResult>
309309
variant="tree-select"
310310
adapter={adapter}

web/oss/src/styles/code-editor-styles.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.code-editor {
22
/* === Editor container === */
33
.editor-code {
4-
font-family: "SF Mono", "JetBrains Mono", "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
4+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
55
position: relative;
66
white-space: pre;
77
tab-size: 2;
@@ -10,6 +10,7 @@
1010
/* Initialize CSS counter for line numbers */
1111
counter-reset: line-number;
1212

13+
font-family: Menlo, Consolas, Monaco, monospace;
1314
display: block;
1415
line-height: 1.53;
1516
font-size: 13px;

web/oss/src/styles/editor-theme.css

Lines changed: 14 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ h1 {
4141
max-width: 100%;
4242
color: #000;
4343
position: relative;
44-
line-height: 24px;
44+
line-height: 20px;
4545
font-weight: 400;
4646
text-align: left;
4747
border-top-left-radius: 10px;
@@ -98,11 +98,10 @@ h1 {
9898
}
9999

100100
.editor-text-code {
101-
background-color: rgba(221, 223, 225, 0.49);
102-
padding: 2px 0.35rem;
103-
font-family: "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, Consolas, Monaco, monospace;
104-
font-size: 90%;
105-
border-radius: 3px;
101+
background-color: rgb(240, 242, 245);
102+
padding: 1px 0.25rem;
103+
font-family: Menlo, Consolas, Monaco, monospace;
104+
font-size: 94%;
106105
}
107106

108107
.editor-link {
@@ -128,7 +127,7 @@ h1 {
128127

129128
.code-only .editor-code {
130129
background-color: rgb(240, 242, 245);
131-
font-family: "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, Consolas, Monaco, monospace;
130+
font-family: Menlo, Consolas, Monaco, monospace;
132131
display: block;
133132
padding: 8px 8px 8px 52px;
134133
line-height: 1.53;
@@ -185,73 +184,23 @@ h1 {
185184
}
186185

187186
.editor-heading-h1 {
188-
font-size: 28px;
187+
font-size: 18px;
189188
color: rgb(5, 5, 5);
190-
font-weight: 700;
189+
font-weight: 400;
191190
margin: 0;
192-
margin-top: 24px;
193191
margin-bottom: 12px;
194192
padding: 0;
195-
padding-bottom: 8px;
196-
letter-spacing: -0.3px;
197-
line-height: 1.4;
198-
border-bottom: 1px solid #e0e0e0;
193+
line-height: 1.5;
199194
}
200195

201196
.editor-heading-h2 {
202-
font-size: 24px;
203-
color: rgb(5, 5, 5);
204-
font-weight: 600;
205-
margin: 0;
206-
margin-top: 20px;
207-
margin-bottom: 10px;
208-
padding: 0;
209-
padding-bottom: 6px;
210-
line-height: 1.35;
211-
border-bottom: 1px solid #e0e0e0;
212-
}
213-
214-
.editor-heading-h3 {
215-
font-size: 20px;
216-
color: rgb(5, 5, 5);
217-
font-weight: 600;
218-
margin: 0;
219-
margin-top: 18px;
220-
margin-bottom: 8px;
221-
padding: 0;
222-
line-height: 1.35;
223-
}
224-
225-
.editor-heading-h4 {
226-
font-size: 18px;
227-
color: rgb(5, 5, 5);
228-
font-weight: 600;
229-
margin: 0;
230-
margin-top: 16px;
231-
margin-bottom: 6px;
232-
padding: 0;
233-
line-height: 1.35;
234-
}
235-
236-
.editor-heading-h5 {
237-
font-size: 16px;
238-
color: rgb(5, 5, 5);
239-
font-weight: 600;
240-
margin: 0;
241-
margin-top: 14px;
242-
margin-bottom: 4px;
243-
padding: 0;
244-
line-height: 1.35;
245-
}
246-
247-
.editor-heading-h6 {
248-
font-size: 14px;
249-
color: rgb(37, 37, 37);
250-
font-weight: 600;
197+
font-size: 15px;
198+
color: rgb(101, 103, 107);
199+
font-weight: 700;
251200
margin: 0;
252-
margin-top: 12px;
253-
margin-bottom: 4px;
201+
margin-top: 10px;
254202
padding: 0;
203+
text-transform: uppercase;
255204
line-height: 1.35;
256205
}
257206

web/oss/src/styles/globals.css

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ body {
6767
}
6868

6969
.editor-input > p {
70-
margin-top: 5px !important;
71-
margin-bottom: 8px !important;
70+
margin-top: 4px !important;
71+
margin-bottom: 4px !important;
7272
}
7373

7474
.hover-button-wrapper {
@@ -180,26 +180,22 @@ body {
180180

181181
.editor-inner:not(.code-editor) {
182182
.editor-code {
183-
background-color: rgba(223, 224, 227, 0.28);
184-
font-family: "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, Consolas, Monaco, monospace;
183+
background-color: rgb(240, 242, 245);
184+
font-family: Menlo, Consolas, Monaco, monospace;
185185
display: block;
186186
padding: 8px;
187187
line-height: 1.53;
188-
font-size: 13.5px;
188+
font-size: 13px;
189189
margin: 0;
190-
margin-top: 12px;
191-
margin-bottom: 12px;
190+
margin-top: 8px;
191+
margin-bottom: 8px;
192192
overflow-x: auto;
193193
position: relative;
194194
tab-size: 2;
195-
border-radius: 6px;
196-
border: 1px solid rgba(108, 112, 118, 0.05);
197195
}
198196

199197
> .editor-input.markdown-view > .editor-code {
200198
background-color: transparent;
201-
border: none;
202-
font-size: 14px;
203199
}
204200
> .editor-input:not(.markdown-view) > .editor-code {
205201
&:after {

web/oss/src/styles/tokens/antd-themeConfig.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@
924924
"lineWidth": 1,
925925
"lineHeight": 1.6666666666666667,
926926
"fontSizeLG": 14,
927-
"fontSize": 13,
927+
"fontSize": 12,
928928
"controlItemBgActive": "#f5f7fa",
929929
"controlHeightSM": 24,
930930
"controlHeightLG": 34,
@@ -944,12 +944,12 @@
944944
"itemSelectedBg": "#f5f7fa",
945945
"itemHoverColor": "#1c2c3d",
946946
"itemHoverBg": "rgba(5, 23, 41, 0.06)",
947-
"itemHeight": 32,
947+
"itemHeight": 28,
948948
"itemDisabledColor": "#bdc7d1",
949949
"itemColor": "#586673",
950950
"itemBorderRadius": 10,
951951
"itemBg": "#ffffff",
952-
"iconSize": 14,
952+
"iconSize": 12,
953953
"horizontalItemSelectedColor": "#1c2c3d",
954954
"horizontalItemSelectedBg": "rgba(0, 0, 0, 0)",
955955
"horizontalItemHoverColor": "#1c2c3d",

web/packages/agenta-ui/src/Editor/plugins/markdown/markdownPlugin.tsx

Lines changed: 14 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -124,47 +124,20 @@ const MarkdownPlugin = ({id}: {id: string}) => {
124124
return editor.registerCommand(
125125
KEY_ENTER_COMMAND,
126126
(event) => {
127-
let handled = false
128-
editor.update(
129-
() => {
130-
const selection = $getSelection()
131-
if (!$isRangeSelection(selection)) return
132-
133-
const anchorNode = selection.anchor.getNode()
134-
const topNode = anchorNode.getTopLevelElementOrThrow()
135-
136-
if ($isCodeNode(topNode) && topNode.getLanguage() === "markdown") {
137-
event?.preventDefault()
138-
139-
// Save scroll position before inserting text to prevent
140-
// the browser from auto-scrolling to the bottom
141-
const rootElement = editor.getRootElement()
142-
const scrollContainer = rootElement?.closest(
143-
".agenta-editor-wrapper",
144-
) as HTMLElement | null
145-
const savedScrollTop = scrollContainer?.scrollTop ?? 0
146-
const savedElementScrollTop = rootElement?.scrollTop ?? 0
147-
148-
selection.insertRawText("\n")
149-
150-
// Restore scroll position after DOM update
151-
if (scrollContainer) {
152-
requestAnimationFrame(() => {
153-
scrollContainer.scrollTop = savedScrollTop
154-
})
155-
}
156-
if (rootElement) {
157-
requestAnimationFrame(() => {
158-
rootElement.scrollTop = savedElementScrollTop
159-
})
160-
}
161-
162-
handled = true
163-
}
164-
},
165-
{discrete: true},
166-
)
167-
return handled
127+
editor.update(() => {
128+
const selection = $getSelection()
129+
if (!$isRangeSelection(selection)) return false
130+
131+
const anchorNode = selection.anchor.getNode()
132+
const topNode = anchorNode.getTopLevelElementOrThrow()
133+
134+
if ($isCodeNode(topNode) && topNode.getLanguage() === "markdown") {
135+
event?.preventDefault()
136+
selection.insertRawText("\n")
137+
return true
138+
}
139+
})
140+
return true
168141
},
169142
COMMAND_PRIORITY_HIGH,
170143
)

0 commit comments

Comments
 (0)