mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-22 16:57:00 +08:00
refactor(editor): move file drop manager to components (#9264)
This commit is contained in:
@@ -2,10 +2,6 @@ import { RootBlockSchema } from '@blocksuite/affine-model';
|
||||
import type { BlockComponent } from '@blocksuite/block-std';
|
||||
import { BlockService } from '@blocksuite/block-std';
|
||||
|
||||
import {
|
||||
FileDropManager,
|
||||
type FileDropOptions,
|
||||
} from '../_common/components/file-drop-manager.js';
|
||||
import {
|
||||
HtmlTransformer,
|
||||
MarkdownTransformer,
|
||||
@@ -16,12 +12,6 @@ import type { RootBlockComponent } from './types.js';
|
||||
export abstract class RootService extends BlockService {
|
||||
static override readonly flavour = RootBlockSchema.model.flavour;
|
||||
|
||||
private readonly _fileDropOptions: FileDropOptions = {
|
||||
flavour: this.flavour,
|
||||
};
|
||||
|
||||
readonly fileDropManager = new FileDropManager(this, this._fileDropOptions);
|
||||
|
||||
transformers = {
|
||||
markdown: MarkdownTransformer,
|
||||
html: HtmlTransformer,
|
||||
@@ -64,18 +54,6 @@ export abstract class RootService extends BlockService {
|
||||
override mounted() {
|
||||
super.mounted();
|
||||
|
||||
this.disposables.addFromEvent(
|
||||
this.host,
|
||||
'dragover',
|
||||
this.fileDropManager.onDragOver
|
||||
);
|
||||
|
||||
this.disposables.addFromEvent(
|
||||
this.host,
|
||||
'dragleave',
|
||||
this.fileDropManager.onDragLeave
|
||||
);
|
||||
|
||||
this.disposables.add(
|
||||
this.std.event.add('pointerDown', ctx => {
|
||||
const state = ctx.get('pointerState');
|
||||
|
||||
Reference in New Issue
Block a user