Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

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

Saul-Mirone3ebac1d39d65
diff --git a/blocksuite/affine/blocks/root/src/edgeless/edgeless-root-service.ts b/blocksuite/affine/blocks/root/src/edgeless/edgeless-root-service.ts
index d45bee3599..31515d42c1 100644
--- a/blocksuite/affine/blocks/root/src/edgeless/edgeless-root-service.ts
+++ b/blocksuite/affine/blocks/root/src/edgeless/edgeless-root-service.ts
@@ -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;
}
diff --git a/blocksuite/affine/blocks/root/src/root-service.ts b/blocksuite/affine/blocks/root/src/root-service.ts
index fd71c3a058..5d0673c3b4 100644
--- a/blocksuite/affine/blocks/root/src/root-service.ts
+++ b/blocksuite/affine/blocks/root/src/root-service.ts
@@ -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;
- }
}