mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-23 13:29:02 +08:00
feat(editor): replace spec provider with extension manager (#11861)
Closes: BS-3273
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import {
|
||||
type ViewExtensionContext,
|
||||
ViewExtensionProvider,
|
||||
} from '@blocksuite/affine-ext-loader';
|
||||
|
||||
import { effects } from '../effects';
|
||||
import {
|
||||
MigratingEdgelessEditorBlockSpecs,
|
||||
MigratingPageEditorBlockSpecs,
|
||||
MigratingPreviewEdgelessEditorBlockSpecs,
|
||||
MigratingPreviewPageEditorBlockSpecs,
|
||||
} from './migrating';
|
||||
|
||||
export class MigratingViewExtension extends ViewExtensionProvider {
|
||||
override name = 'migrating';
|
||||
|
||||
override effect() {
|
||||
super.effect();
|
||||
effects();
|
||||
}
|
||||
|
||||
override setup(context: ViewExtensionContext) {
|
||||
super.setup(context);
|
||||
const scope = context.scope;
|
||||
if (scope === 'preview-page') {
|
||||
context.register(MigratingPreviewPageEditorBlockSpecs);
|
||||
return;
|
||||
}
|
||||
if (scope === 'preview-edgeless') {
|
||||
context.register(MigratingPreviewEdgelessEditorBlockSpecs);
|
||||
return;
|
||||
}
|
||||
if (scope === 'page' || scope === 'mobile-page') {
|
||||
context.register(MigratingPageEditorBlockSpecs);
|
||||
return;
|
||||
}
|
||||
if (scope === 'edgeless' || scope === 'mobile-edgeless') {
|
||||
context.register(MigratingEdgelessEditorBlockSpecs);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user