From 07c3dfeea610e96decdb5ddb2199e0145ff18f0c Mon Sep 17 00:00:00 2001 From: weige <772752726@qq.com> Date: Wed, 27 May 2026 10:00:26 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9A=90=E8=97=8F=E6=8F=90=E7=A4=BA=E8=AF=8D?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E8=8A=82=E7=82=B9=E4=B8=8A=E7=9A=84=E6=9C=AA?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/__tests__/PromptNode.test.tsx | 21 ++++++ src/components/nodes/PromptNode.tsx | 67 +------------------- 2 files changed, 22 insertions(+), 66 deletions(-) diff --git a/src/components/__tests__/PromptNode.test.tsx b/src/components/__tests__/PromptNode.test.tsx index aa6a160f..6a5a1ea8 100644 --- a/src/components/__tests__/PromptNode.test.tsx +++ b/src/components/__tests__/PromptNode.test.tsx @@ -126,6 +126,27 @@ describe("PromptNode", () => { expect(mockRemoveNode).toHaveBeenCalledWith("test-prompt-1"); }); + it("should hide unavailable rich text actions while editing", () => { + render( + + + + ); + + fireEvent.doubleClick(screen.getByRole("button", { name: "Double-click to edit" })); + + expect(screen.queryByLabelText("Body")).not.toBeInTheDocument(); + expect(screen.queryByLabelText("Align text")).not.toBeInTheDocument(); + expect(screen.queryByLabelText("Numbered list")).not.toBeInTheDocument(); + expect(screen.queryByLabelText("Bold")).not.toBeInTheDocument(); + expect(screen.queryByLabelText("Italic")).not.toBeInTheDocument(); + expect(screen.queryByLabelText("Strikethrough")).not.toBeInTheDocument(); + expect(screen.queryByLabelText("Link")).not.toBeInTheDocument(); + expect(screen.queryByLabelText("Table")).not.toBeInTheDocument(); + expect(screen.queryByLabelText("Expand editor")).not.toBeInTheDocument(); + expect(screen.getByRole("button", { name: "Delete" })).toBeInTheDocument(); + }); + it("should render text output handle", () => { const { container } = render( diff --git a/src/components/nodes/PromptNode.tsx b/src/components/nodes/PromptNode.tsx index d800377d..5035239d 100644 --- a/src/components/nodes/PromptNode.tsx +++ b/src/components/nodes/PromptNode.tsx @@ -45,22 +45,6 @@ function DeleteIcon() { ); } -function ToolbarDivider() { - return ; -} - -function StaticToolbarItem({ label, children }: { label: string; children: React.ReactNode }) { - return ( - - {children} - - ); -} - export function PromptNode({ id, data, selected }: NodeProps) { const { t } = useI18n(); const nodeData = data; @@ -200,61 +184,12 @@ export function PromptNode({ id, data, selected }: NodeProps) { {isEditing && ( { e.preventDefault(); e.stopPropagation(); }} > - - - {t("prompt.bodyStyle")} - - - - - - - - - - - - - - - - - - - - B - - - I - - - S - - - - - - - - - - - - - - - - - - - -