refactor(editor): remove dead code (#11709)

This commit is contained in:
Saul-Mirone
2025-04-15 12:40:36 +00:00
parent 96e58316f7
commit 3ebac1d39d
2 changed files with 0 additions and 45 deletions

View File

@@ -6,7 +6,6 @@ import {
type SurfaceBlockModel,
type SurfaceContext,
} from '@blocksuite/affine-block-surface';
import { TemplateJob } from '@blocksuite/affine-gfx-template';
import {
type ConnectorElementModel,
RootBlockSchema,
@@ -39,8 +38,6 @@ export class EdgelessRootService extends RootService implements SurfaceContext {
private readonly _surface: SurfaceBlockModel;
TemplateJob = TemplateJob;
get blocks(): GfxBlockElementModel[] {
return this.layer.blocks;
}

View File

@@ -1,48 +1,6 @@
import { RootBlockSchema } from '@blocksuite/affine-model';
import {
getBlockSelectionsCommand,
getImageSelectionsCommand,
getSelectedBlocksCommand,
getTextSelectionCommand,
} from '@blocksuite/affine-shared/commands';
import type { BlockComponent } from '@blocksuite/std';
import { BlockService } from '@blocksuite/std';
import type { RootBlockComponent } from './types.js';
export abstract class RootService extends BlockService {
static override readonly flavour = RootBlockSchema.model.flavour;
get selectedBlocks() {
let result: BlockComponent[] = [];
this.std.command
.chain()
.tryAll(chain => [
chain.pipe(getTextSelectionCommand),
chain.pipe(getImageSelectionsCommand),
chain.pipe(getBlockSelectionsCommand),
])
.pipe(getSelectedBlocksCommand)
.pipe(({ selectedBlocks }) => {
if (!selectedBlocks) return;
result = selectedBlocks;
})
.run();
return result;
}
get selectedModels() {
return this.selectedBlocks.map(block => block.model);
}
get viewportElement() {
const rootId = this.std.store.root?.id;
if (!rootId) return null;
const rootComponent = this.std.view.getBlock(
rootId
) as RootBlockComponent | null;
if (!rootComponent) return null;
const viewportElement = rootComponent.viewportElement;
return viewportElement;
}
}