refactor(editor): cleanup dead code (#9294)

This commit is contained in:
Saul-Mirone
2024-12-24 15:27:36 +00:00
parent f5dea2a990
commit d63ba079ee
5 changed files with 2 additions and 289 deletions
@@ -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'