Skip to content

Commit 91c4585

Browse files
committed
chore(frontend): document Editor className landing node and trim comment narration
Review follow-ups for #4555: - Document on EditorProps.className that the class lands on a different node per mode (.agenta-rich-text-editor in provider mode, the .editor-container div with noProvider), so future noProvider toggles do not silently re-style a different box. - Trim comments that narrated the history of the noProvider bug down to the standing constraints.
1 parent 4c5754d commit 91c4585

5 files changed

Lines changed: 29 additions & 30 deletions

File tree

web/packages/agenta-playground-ui/src/components/ExecutionItemComparisonView/GenerationComparisonChatOutput/index.tsx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,10 @@ const GenerationComparisonChatOutputCell = ({
151151
}}
152152
messageProps={{
153153
className: "!p-0 !mt-0 [&:nth-child(1)]:!mt-0 mt-2",
154-
// Comparison cells set their own editor padding via
155-
// editorClassName (works after the noProvider className
156-
// fix), replacing the previous
157-
// `[&_.agenta-editor-wrapper]:!p-3` container hack.
158-
// alignTextWithRole is off so the role-alignment inset
159-
// does not stack on top of this padding.
154+
// Comparison cells pad the editor body via
155+
// editorClassName; alignTextWithRole is off so the
156+
// role-alignment inset does not stack on top of this
157+
// padding.
160158
editorClassName: "!p-3",
161159
alignTextWithRole: false,
162160
headerClassName:
@@ -204,11 +202,8 @@ const GenerationComparisonChatOutputCell = ({
204202
withControls={false}
205203
hideUserMessage
206204
messageProps={{
207-
// Padding via editorClassName only (the
208-
// [&_.agenta-editor-wrapper]:!p-3 hack is removed so it does
209-
// not double up now that editorClassName works), and
210-
// alignTextWithRole off so the role-alignment inset does not
211-
// stack on top.
205+
// Padding via editorClassName only; alignTextWithRole off so
206+
// the role-alignment inset does not stack on top.
212207
className: "!p-0 !mt-0 [&:nth-child(1)]:!mt-0 mt-2",
213208
editorClassName: "!p-3",
214209
alignTextWithRole: false,

web/packages/agenta-playground-ui/src/components/adapters/VariableControlAdapter.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -550,13 +550,10 @@ const VariableControlAdapter: React.FC<VariableControlAdapterProps> = ({
550550
initialValue={effectiveValue}
551551
value={effectiveValue}
552552
// NOTE: the parent's `className` is a container/cell-strip style
553-
// (e.g. `*:!border-none px-3`) and is applied to the container
554-
// below. It must NOT be forwarded to the editor body, where it
555-
// would strip the editor's own border and gutter (see the
556-
// matching note on the code-editor branch above). It was
557-
// previously passed as `editorClassName` but silently dropped by
558-
// the `noProvider` className bug; now that the bug is fixed, the
559-
// forward is removed so it stays a container-only style.
553+
// (e.g. `*:!border-none px-3`) applied to the container below. It
554+
// must NOT be forwarded as `editorClassName` — on the editor body
555+
// it strips the editor's own border and gutter (see the matching
556+
// note on the code-editor branch above).
560557
placeholder={effectivePlaceholder}
561558
disabled={isEffectivelyDisabled}
562559
className={clsx(

web/packages/agenta-ui/src/ChatMessage/components/ChatMessageEditor.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,12 @@ const ChatMessageEditorInner: React.FC<ChatMessageEditorProps> = ({
220220
// Kaosiso QA 2026-06-02 (also reproduces in production).
221221
disableDebounce
222222
// Inset the message text and its placeholder by 8px so they line up
223-
// with the role label above. Goes through editorClassName (the proper
224-
// prop) now that the noProvider className bug is fixed. Code editors
225-
// (JSON/tool) keep their own gutter, so they are excluded via
226-
// `:not(.code-only)`. The role label is an antd button outside the
227-
// editor and is aligned via the `.agenta-chat-message-editor` rule in
228-
// globals.css. Both are skipped when alignTextWithRole is false (e.g.
229-
// the comparison view, which applies its own editor padding).
223+
// with the role label above. Code editors (JSON/tool) keep their own
224+
// gutter, so they are excluded via `:not(.code-only)`. The role label
225+
// is an antd button outside the editor, aligned by the
226+
// `.agenta-chat-message-editor` rule in globals.css. Both insets are
227+
// skipped when alignTextWithRole is false (e.g. the comparison view,
228+
// which applies its own editor padding).
230229
editorClassName={cn(
231230
alignTextWithRole &&
232231
"[&_.editor-input:not(.code-only)]:px-2 [&_.editor-placeholder]:left-2",

web/packages/agenta-ui/src/Editor/Editor.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -759,11 +759,10 @@ const EditorInner = forwardRef<HTMLDivElement, EditorProps>(
759759
<div
760760
className={clsx(
761761
"editor-container w-full overflow-hidden relative min-h-[inherit]",
762-
// In `noProvider` mode there is no EditorProvider to carry the
763-
// consumer's `className` (it normally lands on
764-
// `.agenta-rich-text-editor`), so apply it to the container here.
765-
// In provider mode EditorInner receives no `className`, so this is
766-
// a no-op and the class still lands on `.agenta-rich-text-editor`.
762+
// `noProvider` mode has no EditorProvider to carry the consumer's
763+
// `className`, so it lands here. In provider mode EditorInner
764+
// receives no `className` (the provider applies it on
765+
// `.agenta-rich-text-editor`), so it is never applied twice.
767766
className,
768767
)}
769768
>

web/packages/agenta-ui/src/Editor/types.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ export interface EditorProviderProps extends React.HTMLProps<HTMLDivElement> {
2626
}
2727

2828
export interface EditorProps extends React.HTMLProps<HTMLDivElement> {
29+
/**
30+
* Lands on a different node per mode: in provider mode on the
31+
* `.agenta-rich-text-editor` wrapper (an ancestor of the editor
32+
* container), with `noProvider` on the `.editor-container` div itself.
33+
* Descendant selectors (`[&_...]`) behave the same in both modes, but
34+
* box-level utilities (padding, width, border) style a different element
35+
* depending on the mode.
36+
*/
37+
className?: string
2938
disabled?: boolean
3039
id?: string
3140
initialEditorState?: LexicalEditor["_editorState"]

0 commit comments

Comments
 (0)