From 68159086a91a477be25a774740ee80ade7d70515 Mon Sep 17 00:00:00 2001
From: ngqile
Date: Thu, 3 Dec 2026 16:12:59 +0800
Subject: [PATCH] fix(pages): empty rich text on the canvas gets room and a
faded cue
A new Text section was a thin line under its Add section button, with nothing
to click or read.
Co-Authored-By: Claude Opus 5.5
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
---
.../app/components/pages/CmsBlocks.edit.test.tsx | 9 +++++++++
solvway-admin-portal/app/components/pages/CmsEdit.tsx | 5 ++++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/solvway-admin-portal/app/components/pages/CmsBlocks.edit.test.tsx b/solvway-admin-portal/app/components/pages/CmsBlocks.edit.test.tsx
index c351e81..7d20bd4 100644
--- a/solvway-admin-portal/app/components/pages/CmsBlocks.edit.test.tsx
+++ b/solvway-admin-portal/app/components/pages/CmsBlocks.edit.test.tsx
@@ -93,6 +93,15 @@ describe("LandingPage in edit mode", () => {
expect(screen.getAllByText("Body copy")).toHaveLength(1);
});
+ it("offers empty rich text as a spot to type: a faded cue that goes once there is text", async () => {
+ const { rerender } = render();
+ await screen.findByRole("textbox", { name: "Content" });
+ const cue = screen.getByText("Content", { selector: "p[aria-hidden]" });
+ expect(cue.parentElement!.className).toContain("[&_.ProseMirror]:min-h-24");
+ rerender(Hi
" }])} edit={editor()} preview />);
+ expect(screen.queryByText("Content", { selector: "p[aria-hidden]" })).not.toBeInTheDocument();
+ });
+
it("renders no editing without edit mode", () => {
render();
expect(document.querySelector("[contenteditable]")).toBeNull();
diff --git a/solvway-admin-portal/app/components/pages/CmsEdit.tsx b/solvway-admin-portal/app/components/pages/CmsEdit.tsx
index 950dd6a..5fce674 100644
--- a/solvway-admin-portal/app/components/pages/CmsEdit.tsx
+++ b/solvway-admin-portal/app/components/pages/CmsEdit.tsx
@@ -169,7 +169,10 @@ export function RichSpot({ index, html, className, children }: { index: number;
const edit = useEdit();
if (!edit) return <>{children}>;
return (
-
+
+ {/* An empty editor is a thin line under the section's Add section button: it gets room, and a faded cue like
+ the plain fields' marks the spot to type. */}
+ {html ? null :
{t("PagesContent")}
}
edit.html(index, value)} />
);