🤯 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.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🐛 fix(task): let task content blocks be dragged to reorder (#21032)
Rdmclin2c35060aaab60
diff --git a/src/features/AgentTasks/AgentTaskDetail/TaskInstruction.tsx b/src/features/AgentTasks/AgentTaskDetail/TaskInstruction.tsxindex c95ddc57865..3c87171e9f8 100644--- a/src/features/AgentTasks/AgentTaskDetail/TaskInstruction.tsx+++ b/src/features/AgentTasks/AgentTaskDetail/TaskInstruction.tsx@@ -14,6 +14,7 @@ import { lambdaClient } from '@/libs/trpc/client';import { useTaskStore } from '@/store/task';import { taskDetailSelectors } from '@/store/task/selectors';+import { TASK_INSTRUCTION_EXTRA_PLUGINS } from './taskInstructionPlugins';import { useTaskInstructionAutosave } from './useTaskInstructionAutosave';// Stable lock RPC binding for the task resource.@@ -140,6 +141,7 @@ const TaskInstruction = memo(() => {editor={editor}editorData={editorData}entityId={taskId}+ extraPlugins={TASK_INSTRUCTION_EXTRA_PLUGINS}placeholder={t('taskDetail.instructionPlaceholder')}onContentChange={handleContentChange}/>diff --git a/src/features/AgentTasks/AgentTaskDetail/taskInstructionPlugins.test.ts b/src/features/AgentTasks/AgentTaskDetail/taskInstructionPlugins.test.tsnew file mode 100644index 00000000000..2bb3b3e4b2d--- /dev/null+++ b/src/features/AgentTasks/AgentTaskDetail/taskInstructionPlugins.test.ts@@ -0,0 +1,14 @@+import { ReactBlockPlugin } from '@lobehub/editor';+import { describe, expect, it } from 'vitest';++import { TASK_INSTRUCTION_EXTRA_PLUGINS } from './taskInstructionPlugins';++describe('TASK_INSTRUCTION_EXTRA_PLUGINS', () => {+ it('mounts the block drag handle so content blocks such as images can be moved by dragging', () => {+ const blockPlugin = TASK_INSTRUCTION_EXTRA_PLUGINS.find(+ (plugin) => Array.isArray(plugin) && plugin[0] === ReactBlockPlugin,+ );++ expect(blockPlugin).toEqual([ReactBlockPlugin, { anchorPadding: 0 }]);+ });+});diff --git a/src/features/AgentTasks/AgentTaskDetail/taskInstructionPlugins.ts b/src/features/AgentTasks/AgentTaskDetail/taskInstructionPlugins.tsnew file mode 100644index 00000000000..13105010462--- /dev/null+++ b/src/features/AgentTasks/AgentTaskDetail/taskInstructionPlugins.ts@@ -0,0 +1,12 @@+import { ReactBlockPlugin } from '@lobehub/editor';+import { Editor } from '@lobehub/editor/react';++/**+ * Extra editor plugins for the task instruction. The block drag handle (same+ * as the page editor) lets an image or paragraph be dragged to a new position+ * instead of cut and pasted. `anchorPadding: 0` keeps the text aligned with the+ * title; the handle floats in the left gutter.+ */+export const TASK_INSTRUCTION_EXTRA_PLUGINS = [+ Editor.withProps(ReactBlockPlugin, { anchorPadding: 0 }),+];