Skip to content

🤯 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.

✨ feat(page-editor): enable block plugin with shared inline padding (#15556)

Inneid2cd9ef02356
diff --git a/src/features/PageEditor/EditorCanvas/index.tsx b/src/features/PageEditor/EditorCanvas/index.tsx
index aa997167050..052f76d7fa1 100644
--- a/src/features/PageEditor/EditorCanvas/index.tsx
+++ b/src/features/PageEditor/EditorCanvas/index.tsx
@@ -1,6 +1,8 @@
'use client';
-import { type CSSProperties } from 'react';
+import { ReactBlockPlugin } from '@lobehub/editor';
+import { Editor } from '@lobehub/editor/react';
+import { type CSSProperties, useMemo } from 'react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -24,10 +26,16 @@ const EditorCanvas = memo<EditorCanvasProps>(({ placeholder, style }) => {
const slashItems = useSlashItems();
const askCopilotItem = useAskCopilotItem(editor);
+ const extraPlugins = useMemo(
+ () => [Editor.withProps(ReactBlockPlugin, { anchorPadding: 0 })],
+ [],
+ );
+
return (
<SharedEditorCanvas
documentId={documentId}
editor={editor}
+ extraPlugins={extraPlugins}
placeholder={placeholder || t('pageEditor.editorPlaceholder')}
slashItems={slashItems}
style={style}
diff --git a/src/features/PageEditor/PageEditor.tsx b/src/features/PageEditor/PageEditor.tsx
index 4fcfad6bcbc..2fac7781975 100644
--- a/src/features/PageEditor/PageEditor.tsx
+++ b/src/features/PageEditor/PageEditor.tsx
@@ -1,6 +1,6 @@
'use client';
-import { EditorProvider } from '@lobehub/editor/react';
+import { DEFAULT_BLOCK_ANCHOR_PADDING, EditorProvider } from '@lobehub/editor/react';
import { Flexbox } from '@lobehub/ui';
import { cssVar } from 'antd-style';
import type { FC, ReactNode } from 'react';
@@ -42,7 +42,7 @@ const styles = StyleSheet.create({
position: 'relative',
},
editorContent: {
- overflowY: 'auto',
+ paddingInline: DEFAULT_BLOCK_ANCHOR_PADDING,
position: 'relative',
},
});