diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-editor/blocksuite-editor-container.tsx b/packages/frontend/core/src/components/blocksuite/block-suite-editor/blocksuite-editor-container.tsx
index 348ac8ba0a..64efa78a9c 100644
--- a/packages/frontend/core/src/components/blocksuite/block-suite-editor/blocksuite-editor-container.tsx
+++ b/packages/frontend/core/src/components/blocksuite/block-suite-editor/blocksuite-editor-container.tsx
@@ -164,11 +164,12 @@ export const BlocksuiteEditorContainer = forwardRef<
]);
const handleClickPageModeBlank = useCallback(() => {
+ if (shared || page.readonly) return;
affineEditorContainerProxy.host?.std.command.exec(
'appendParagraph' as never,
{}
);
- }, [affineEditorContainerProxy]);
+ }, [affineEditorContainerProxy, page, shared]);
return (
-
+
{!shared && displayBiDirectionalLink ? (
) : null}
diff --git a/tests/affine-cloud/e2e/share-page.spec.ts b/tests/affine-cloud/e2e/share-page.spec.ts
index 63c3ba6520..87a22ca91e 100644
--- a/tests/affine-cloud/e2e/share-page.spec.ts
+++ b/tests/affine-cloud/e2e/share-page.spec.ts
@@ -120,6 +120,54 @@ test('share page should have toc', async ({ page, browser }) => {
}
});
+test('append paragraph should be disabled in shared mode', async ({
+ page,
+ browser,
+}) => {
+ await page.reload();
+ await waitForEditorLoad(page);
+ await createLocalWorkspace(
+ {
+ name: 'test',
+ },
+ page
+ );
+ await enableCloudWorkspaceFromShareButton(page);
+ const title = getBlockSuiteEditorTitle(page);
+ await title.pressSequentially('TEST TITLE', {
+ delay: 50,
+ });
+
+ // enable share page and copy page link
+ await enableShare(page);
+ await page.getByTestId('share-menu-copy-link-button').click();
+ await page.getByTestId('share-link-menu-copy-page').click();
+
+ {
+ const context = await browser.newContext();
+ await skipOnboarding(context);
+ const url: string = await page.evaluate(() =>
+ navigator.clipboard.readText()
+ );
+ const page2 = await context.newPage();
+ await page2.goto(url);
+ await waitForEditorLoad(page2);
+
+ const paragraph = page2.locator('affine-paragraph');
+ const numParagraphs = await paragraph.count();
+
+ let error = null;
+ try {
+ await page2.locator('[data-testid=page-editor-blank]').click();
+ } catch (e) {
+ error = e;
+ }
+ expect(error).toBeNull();
+
+ expect(await paragraph.count()).toBe(numParagraphs);
+ }
+});
+
test('share page with default edgeless', async ({ page, browser }) => {
await page.reload();
await waitForEditorLoad(page);