fix(core): disable append paragraph in shared page editor (#8191)

Disable append paragraph function for readonly or shared page editor.

### Before

![CleanShot 2024-09-10 at 22.26.04@2x.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/MyRfgiN4RuBxJfrza3SG/3ab206a2-8e30-4212-9d5d-3073ec489644.png)
This commit is contained in:
L-Sun
2024-09-10 15:33:52 +00:00
parent 6ce6cb33ef
commit 9038592715
3 changed files with 55 additions and 2 deletions

View File

@@ -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 (
<div

View File

@@ -223,7 +223,11 @@ export const BlocksuiteDocEditor = forwardRef<
specs={specs}
hasViewport={false}
/>
<div className={styles.docEditorGap} onClick={onClickBlank}></div>
<div
className={styles.docEditorGap}
data-testid="page-editor-blank"
onClick={onClickBlank}
></div>
{!shared && displayBiDirectionalLink ? (
<BiDirectionalLinkPanel />
) : null}