mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 12:55:00 +00:00
refactor(editor): cleanup dead code (#9300)
This commit is contained in:
@@ -5,10 +5,7 @@ import {
|
||||
} from '@blocksuite/block-std';
|
||||
import { literal } from 'lit/static-html.js';
|
||||
|
||||
import { DataViewBlockService } from './database-service.js';
|
||||
|
||||
export const DataViewBlockSpec: ExtensionType[] = [
|
||||
FlavourExtension('affine:data-view'),
|
||||
DataViewBlockService,
|
||||
BlockViewExtension('affine:data-view', literal`affine-data-view`),
|
||||
];
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
import { BlockService } from '@blocksuite/block-std';
|
||||
import { DatabaseSelection } from '@blocksuite/data-view';
|
||||
|
||||
import { DataViewBlockSchema } from './data-view-model.js';
|
||||
|
||||
export class DataViewBlockService extends BlockService {
|
||||
static override readonly flavour = DataViewBlockSchema.model.flavour;
|
||||
|
||||
override mounted(): void {
|
||||
super.mounted();
|
||||
this.selectionManager.register(DatabaseSelection);
|
||||
}
|
||||
}
|
||||
@@ -271,7 +271,6 @@ import { effects as blockSurfaceRefEffects } from './surface-ref-block/effects.j
|
||||
import {
|
||||
EdgelessSurfaceRefBlockComponent,
|
||||
SurfaceRefBlockComponent,
|
||||
type SurfaceRefBlockService,
|
||||
} from './surface-ref-block/index.js';
|
||||
import { SurfaceRefGenericBlockPortal } from './surface-ref-block/portal/generic-block.js';
|
||||
import { SurfaceRefNotePortal } from './surface-ref-block/portal/note.js';
|
||||
@@ -611,7 +610,6 @@ declare global {
|
||||
'affine:bookmark': BookmarkBlockService;
|
||||
'affine:database': DatabaseBlockService;
|
||||
'affine:image': ImageBlockService;
|
||||
'affine:surface-ref': SurfaceRefBlockService;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
export * from './surface-ref-block.js';
|
||||
export * from './surface-ref-block-edgeless.js';
|
||||
export * from './surface-ref-service.js';
|
||||
export {
|
||||
EdgelessSurfaceRefBlockSpec,
|
||||
PageSurfaceRefBlockSpec,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
import {
|
||||
type SurfaceBlockModel,
|
||||
SurfaceElementModel,
|
||||
@@ -46,7 +45,6 @@ import { styleMap } from 'lit/directives/style-map.js';
|
||||
import { SpecProvider } from '../_specs/index.js';
|
||||
import type { EdgelessRootPreviewBlockComponent } from '../root-block/edgeless/edgeless-root-preview-block.js';
|
||||
import { EdgelessRootService } from '../root-block/index.js';
|
||||
import type { SurfaceRefBlockService } from './surface-ref-service.js';
|
||||
import { noContentPlaceholder } from './utils.js';
|
||||
|
||||
const REF_LABEL_ICON = {
|
||||
@@ -66,10 +64,7 @@ const NO_CONTENT_REASON = {
|
||||
} as Record<string, string>;
|
||||
|
||||
@Peekable()
|
||||
export class SurfaceRefBlockComponent extends BlockComponent<
|
||||
SurfaceRefBlockModel,
|
||||
SurfaceRefBlockService
|
||||
> {
|
||||
export class SurfaceRefBlockComponent extends BlockComponent<SurfaceRefBlockModel> {
|
||||
static override styles = css`
|
||||
.affine-surface-ref {
|
||||
position: relative;
|
||||
@@ -599,8 +594,6 @@ export class SurfaceRefBlockComponent extends BlockComponent<
|
||||
|
||||
if (!this._shouldRender) return;
|
||||
|
||||
const service = this.service;
|
||||
assertExists(service, `Surface ref block must run with its service.`);
|
||||
this._initHotkey();
|
||||
this._initSpec();
|
||||
this._initReferencedModel();
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
import { SurfaceRefBlockSchema } from '@blocksuite/affine-model';
|
||||
import { BlockService } from '@blocksuite/block-std';
|
||||
|
||||
export class SurfaceRefBlockService extends BlockService {
|
||||
static override readonly flavour = SurfaceRefBlockSchema.model.flavour;
|
||||
}
|
||||
@@ -8,11 +8,9 @@ import {
|
||||
import { literal } from 'lit/static-html.js';
|
||||
|
||||
import { commands } from './commands.js';
|
||||
import { SurfaceRefBlockService } from './surface-ref-service.js';
|
||||
|
||||
export const PageSurfaceRefBlockSpec: ExtensionType[] = [
|
||||
FlavourExtension('affine:surface-ref'),
|
||||
SurfaceRefBlockService,
|
||||
CommandExtension(commands),
|
||||
BlockViewExtension('affine:surface-ref', literal`affine-surface-ref`),
|
||||
WidgetViewMapExtension('affine:surface-ref', {
|
||||
@@ -22,7 +20,6 @@ export const PageSurfaceRefBlockSpec: ExtensionType[] = [
|
||||
|
||||
export const EdgelessSurfaceRefBlockSpec: ExtensionType[] = [
|
||||
FlavourExtension('affine:surface-ref'),
|
||||
SurfaceRefBlockService,
|
||||
BlockViewExtension(
|
||||
'affine:surface-ref',
|
||||
literal`affine-edgeless-surface-ref`
|
||||
|
||||
Reference in New Issue
Block a user