mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-25 06:18:45 +08:00
refactor(editor): cleanup dead code (#9294)
This commit is contained in:
@@ -1,69 +1,12 @@
|
||||
import {
|
||||
type BlockComponent,
|
||||
type BlockStdScope,
|
||||
type DndEventState,
|
||||
type EditorHost,
|
||||
Extension,
|
||||
type ExtensionType,
|
||||
StdIdentifier,
|
||||
} from '@blocksuite/block-std';
|
||||
import { type Container, createIdentifier } from '@blocksuite/global/di';
|
||||
import type { Point } from '@blocksuite/global/utils';
|
||||
import { Job, Slice, type SliceSnapshot } from '@blocksuite/store';
|
||||
|
||||
export type DropType = 'before' | 'after' | 'in';
|
||||
export type OnDragStartProps = {
|
||||
state: DndEventState;
|
||||
startDragging: (
|
||||
blocks: BlockComponent[],
|
||||
state: DndEventState,
|
||||
dragPreview?: HTMLElement,
|
||||
dragPreviewOffset?: Point
|
||||
) => void;
|
||||
anchorBlockId: string | null;
|
||||
editorHost: EditorHost;
|
||||
};
|
||||
|
||||
export type OnDragEndProps = {
|
||||
state: DndEventState;
|
||||
draggingElements: BlockComponent[];
|
||||
dropBlockId: string;
|
||||
dropType: DropType | null;
|
||||
dragPreview: HTMLElement;
|
||||
noteScale: number;
|
||||
editorHost: EditorHost;
|
||||
};
|
||||
|
||||
export type OnDragMoveProps = {
|
||||
state: DndEventState;
|
||||
draggingElements?: BlockComponent[];
|
||||
};
|
||||
|
||||
export type DragHandleOption = {
|
||||
flavour: string | RegExp;
|
||||
edgeless?: boolean;
|
||||
onDragStart?: (props: OnDragStartProps) => boolean;
|
||||
onDragMove?: (props: OnDragMoveProps) => boolean;
|
||||
onDragEnd?: (props: OnDragEndProps) => boolean;
|
||||
};
|
||||
|
||||
export const DragHandleConfigIdentifier = createIdentifier<DragHandleOption>(
|
||||
'AffineDragHandleIdentifier'
|
||||
);
|
||||
|
||||
export function DragHandleConfigExtension(
|
||||
option: DragHandleOption
|
||||
): ExtensionType {
|
||||
return {
|
||||
setup: di => {
|
||||
const key =
|
||||
typeof option.flavour === 'string'
|
||||
? option.flavour
|
||||
: option.flavour.source;
|
||||
di.addImpl(DragHandleConfigIdentifier(key), () => option);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export const DndApiExtensionIdentifier = createIdentifier<DNDAPIExtension>(
|
||||
'AffineDndApiIdentifier'
|
||||
|
||||
Reference in New Issue
Block a user