Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(plugin): remove onscroll

austaras455feedce5b3
diff --git a/libs/components/editor-core/src/RenderRoot.tsx b/libs/components/editor-core/src/RenderRoot.tsx
index 7a4e520f65..21c6c903fe 100644
--- a/libs/components/editor-core/src/RenderRoot.tsx
+++ b/libs/components/editor-core/src/RenderRoot.tsx
@@ -11,8 +11,6 @@ import {
type ReturnUnobserve,
} from '@toeverything/datasource/db-service';
import { addNewGroup } from './recast-block';
-import { useIsOnDrag } from './hooks';
-import { HookType } from './editor';
interface RenderRootProps {
editor: BlockEditor;
@@ -157,10 +155,6 @@ export const RenderRoot: FC<PropsWithChildren<RenderRootProps>> = ({
editor.getHooks().onRootNodeDrop(event);
};
- const onScroll = (event: React.UIEvent) => {
- editor.getHooks().onRootNodeScroll(event);
- };
-
return (
<RootContext.Provider value={{ editor, editorElement }}>
<Container
@@ -183,7 +177,6 @@ export const RenderRoot: FC<PropsWithChildren<RenderRootProps>> = ({
onDragOverCapture={onDragOverCapture}
onDragEnd={onDragEnd}
onDrop={onDrop}
- isOnDrag={isOnDrag}
>
<Content style={{ maxWidth: pageWidth + 'px' }}>
{children}
diff --git a/libs/components/editor-core/src/editor/plugin/hooks.ts b/libs/components/editor-core/src/editor/plugin/hooks.ts
index b20ee0defa..1e6e94f842 100644
--- a/libs/components/editor-core/src/editor/plugin/hooks.ts
+++ b/libs/components/editor-core/src/editor/plugin/hooks.ts
@@ -187,8 +187,4 @@ export class Hooks implements HooksRunner, PluginHooks {
public beforeCut(e: ClipboardEvent): void {
this._runHook(HookType.BEFORE_CUT, e);
}
-
- public onRootNodeScroll(e: React.UIEvent): void {
- this.run_hook(HookType.ON_ROOTNODE_SCROLL, e);
- }
}
diff --git a/libs/components/editor-core/src/editor/types.ts b/libs/components/editor-core/src/editor/types.ts
index 24d8f6a641..6d4112ba66 100644
--- a/libs/components/editor-core/src/editor/types.ts
+++ b/libs/components/editor-core/src/editor/types.ts
@@ -174,7 +174,6 @@ export enum HookType {
AFTER_ON_NODE_DRAG_OVER = 'afterOnNodeDragOver',
BEFORE_COPY = 'beforeCopy',
BEFORE_CUT = 'beforeCut',
- ON_ROOTNODE_SCROLL = 'onRootNodeScroll',
}
export interface HookBaseArgs {
@@ -226,7 +225,6 @@ export interface HooksRunner {
) => void;
beforeCopy: (e: ClipboardEvent) => void;
beforeCut: (e: ClipboardEvent) => void;
- onRootNodeScroll: (e: React.UIEvent) => void;
}
export type AnyFunction = (...args: any[]) => any;