refactor(editor): remove service global type (#10129)

Closes: [BS-2566](https://linear.app/affine-design/issue/BS-2566/remove-global-types-in-service)
This commit is contained in:
Saul-Mirone
2025-02-12 11:46:10 +00:00
parent 6730122108
commit e7cc710f8e
11 changed files with 14 additions and 77 deletions

View File

@@ -1,4 +1,5 @@
import type { SurfaceBlockModel } from '@blocksuite/blocks';
import { BlockServiceIdentifier } from '@blocksuite/block-std';
import type { PageRootService, SurfaceBlockModel } from '@blocksuite/blocks';
import type { PointLocation } from '@blocksuite/global/utils';
import { beforeEach, expect, test } from 'vitest';
@@ -24,7 +25,9 @@ const fieldChecker: Record<string, (value: any) => boolean> = {
const skipFields = new Set(['_lastXYWH']);
const snapshotTest = async (snapshotUrl: string, elementsCount: number) => {
const pageService = window.editor.host!.std.getService('affine:page');
const pageService = window.editor.host!.std.getOptional(
BlockServiceIdentifier('affine:page')
) as PageRootService;
if (!pageService) {
throw new Error('page service not found');
}