Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix(goal): open a line after an uploaded video in the create-goal editor (#22268)

Rdmclin26b4bed2e1eee
diff --git a/src/features/AgentGoals/CreateGoalModal/CreateGoalContent.tsx b/src/features/AgentGoals/CreateGoalModal/CreateGoalContent.tsx
index ecc9c4440bf..eee83fd9eb7 100644
--- a/src/features/AgentGoals/CreateGoalModal/CreateGoalContent.tsx
+++ b/src/features/AgentGoals/CreateGoalModal/CreateGoalContent.tsx
@@ -51,6 +51,7 @@ import { shinyTextStyles } from '@/styles';
import GoalAgentPill from '../GoalAgentPill';
import { buildGoalAgents, buildGoalCreateInput, buildReviewedGoalContent } from './goalConfig';
import { createFallbackGoalCriterion, generateGoalCriteria } from './goalCriteria';
+import { GOAL_INSTRUCTION_EDITOR_PROPS } from './goalEditor';
import {
deriveGoalTitle,
resolveDraftedTitle,
@@ -565,11 +566,11 @@ const CreateGoalContent = memo<CreateGoalContentProps>((props) => {
<GeneratingBorder className={styles.inputShell} generating={step === 'preparing'}>
<div className={styles.inputScroller}>
<EditorCanvas
+ {...GOAL_INSTRUCTION_EDITOR_PROPS}
disabled={!canCreate || step === 'preparing'}
editor={editor}
editorData={{ content: plan.instruction }}
entityId={'create-goal-description'}
- floatingToolbar={false}
placeholder={t('createGoal.instructionPlaceholder')}
style={{ fontSize: 14, minHeight: 206, padding: 16 }}
onContentChange={handleContentChange}
@@ -617,7 +618,12 @@ const CreateGoalContent = memo<CreateGoalContentProps>((props) => {
</>
)}
</Flexbox>
- <ActionIcon className={styles.close} icon={X} onClick={close} />
+ <ActionIcon
+ className={styles.close}
+ icon={X}
+ title={t('close', { ns: 'common' })}
+ onClick={close}
+ />
</Flexbox>
{step === 'review' && (
@@ -625,11 +631,11 @@ const CreateGoalContent = memo<CreateGoalContentProps>((props) => {
<Flexbox className={styles.reviewSection} gap={10}>
<Flexbox className={styles.instructionEditor}>
<EditorCanvas
+ {...GOAL_INSTRUCTION_EDITOR_PROPS}
disabled={!canCreate}
editor={editor}
editorData={{ content: plan.instruction }}
entityId={'create-goal-instruction'}
- floatingToolbar={false}
placeholder={t('createGoal.instructionPlaceholder')}
style={{ fontSize: 13, minHeight: 32 }}
onContentChange={handleContentChange}
@@ -665,6 +671,7 @@ const CreateGoalContent = memo<CreateGoalContentProps>((props) => {
<ActionIcon
icon={Pencil}
size={'small'}
+ title={t('edit', { ns: 'common' })}
onClick={(event) => {
event.stopPropagation();
editCriterion(index);
diff --git a/src/features/AgentGoals/CreateGoalModal/goalEditor.test.ts b/src/features/AgentGoals/CreateGoalModal/goalEditor.test.ts
new file mode 100644
index 00000000000..420b9e4ef9f
--- /dev/null
+++ b/src/features/AgentGoals/CreateGoalModal/goalEditor.test.ts
@@ -0,0 +1,15 @@
+import { describe, expect, it } from 'vitest';
+
+import { GOAL_INSTRUCTION_EDITOR_PROPS } from './goalEditor';
+
+describe('GOAL_INSTRUCTION_EDITOR_PROPS', () => {
+ // T-3387: a video uploaded into the goal description was the last block, so
+ // there was no line under it to keep typing on.
+ it('opens a line after block attachments such as videos', () => {
+ expect(GOAL_INSTRUCTION_EDITOR_PROPS.blockImageCaretGuard).toBe(true);
+ });
+
+ it('keeps the formatting toolbar off in the compact modal editors', () => {
+ expect(GOAL_INSTRUCTION_EDITOR_PROPS.floatingToolbar).toBe(false);
+ });
+});
diff --git a/src/features/AgentGoals/CreateGoalModal/goalEditor.ts b/src/features/AgentGoals/CreateGoalModal/goalEditor.ts
new file mode 100644
index 00000000000..33c7cc18766
--- /dev/null
+++ b/src/features/AgentGoals/CreateGoalModal/goalEditor.ts
@@ -0,0 +1,11 @@
+/**
+ * Props both create-goal instruction editors share.
+ *
+ * `blockImageCaretGuard` opens an empty line after a block attachment (video,
+ * block image): inserted at the end of the description, it otherwise leaves
+ * no line to keep writing on (T-3387).
+ */
+export const GOAL_INSTRUCTION_EDITOR_PROPS = {
+ blockImageCaretGuard: true,
+ floatingToolbar: false,
+} as const;