refactor: remove unused code (#2484)

This commit is contained in:
Himself65
2023-05-22 17:11:18 +08:00
committed by GitHub
parent 281a068cfb
commit f01997f8ee
31 changed files with 44 additions and 1505 deletions

View File

@@ -21,7 +21,7 @@ export type EditorProps = {
page: Page;
mode: 'page' | 'edgeless';
onInit: (page: Page, editor: Readonly<EditorContainer>) => void;
onLoad?: (page: Page, editor: EditorContainer) => void;
onLoad?: (page: Page, editor: EditorContainer) => () => void;
style?: CSSProperties;
};
@@ -67,7 +67,7 @@ const BlockSuiteEditorImpl = (props: EditorProps): ReactElement => {
if (page.root === null) {
props.onInit(page, editor);
}
props.onLoad?.(page, editor);
return props.onLoad?.(page, editor);
}
}, [props.page, props.onInit, props.onLoad, editor, props, page]);

View File

@@ -103,9 +103,6 @@ export const toast = (
easing: 'cubic-bezier(0.21, 1.02, 0.73, 1)',
fill: 'forwards' as const,
}; // satisfies KeyframeAnimationOptions;
// FIXME: Vitest not support element.animate,
// can try it in `apps/web/src/components/__tests__/PinBoard.spec.tsx` `delete pivot`
typeof element.animate === 'function' && element.animate(fadeIn, options);
setTimeout(async () => {
if (typeof element.animate !== 'function') return;

View File

@@ -1,8 +1,7 @@
import { DebugLogger } from '@affine/debug';
import markdown from '@affine/templates/AFFiNE-beta-0.5.4.md';
import { ContentParser } from '@blocksuite/blocks/content-parser';
import type { Page, Workspace } from '@blocksuite/store';
import { nanoid } from '@blocksuite/store';
import type { Page } from '@blocksuite/store';
declare global {
interface Window {
@@ -57,25 +56,3 @@ export function _initPageWithDemoMarkdown(page: Page): void {
contentParser.importMarkdown(demoText, frameId);
page.workspace.setPageMeta(page.id, { title: demoTitle });
}
export function ensureRootPinboard(blockSuiteWorkspace: Workspace) {
const metas = blockSuiteWorkspace.meta.pageMetas;
const rootMeta = metas.find(m => m.isRootPinboard);
if (rootMeta) {
return rootMeta.id;
}
const rootPinboardPage = blockSuiteWorkspace.createPage(nanoid());
const title = `${blockSuiteWorkspace.meta.name}'s Pinboard`;
_initEmptyPage(rootPinboardPage, title);
blockSuiteWorkspace.meta.setPageMeta(rootPinboardPage.id, {
isRootPinboard: true,
title,
});
return rootPinboardPage.id;
}

View File

@@ -20,7 +20,6 @@ declare module '@blocksuite/store' {
init?: boolean;
// todo: support `number` in the future
isPublic?: boolean;
isRootPinboard?: boolean;
}
}

View File

@@ -1,6 +1,8 @@
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
/// <reference path='../../../apps/electron/layers/preload/preload.d.ts' />
import type { Workspace as RemoteWorkspace } from '@affine/workspace/affine/api';
import type { EditorContainer } from '@blocksuite/editor';
import type { Page } from '@blocksuite/store';
import type { Workspace as BlockSuiteWorkspace } from '@blocksuite/store';
import type { createStore } from 'jotai';
import type { FC, PropsWithChildren } from 'react';
@@ -183,6 +185,7 @@ type SettingProps<Flavour extends keyof WorkspaceRegistry> =
type PageDetailProps<Flavour extends keyof WorkspaceRegistry> =
UIBaseProps<Flavour> & {
currentPageId: string;
onLoadEditor: (page: Page, editor: EditorContainer) => () => void;
};
type PageListProps<_Flavour extends keyof WorkspaceRegistry> = {