Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
EYHN committed Dec 23, 2024
1 parent dd5db86 commit 761734e
Show file tree
Hide file tree
Showing 29 changed files with 41 additions and 93 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ export function revertUpdate(
snapshotStateVector
);
const undoManager = new UndoManager(
// oxlint-disable array-callback-return
[...snapshotDoc.share.keys()].map(key => {
const type = getMetadata(key);
if (type === 'Text') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ import {
type useConfirmModal,
} from '@affine/component';
import { WorkspaceServerService } from '@affine/core/modules/cloud';
import {
type DocRecord,
DocService,
DocsService,
} from '@affine/core/modules/doc';
import { type DocService, DocsService } from '@affine/core/modules/doc';
import type { EditorService } from '@affine/core/modules/editor';
import { EditorSettingService } from '@affine/core/modules/editor-setting';
import { resolveLinkToDoc } from '@affine/core/modules/navigation';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import type {
DatabaseRow,
DatabaseValueCell,
} from '@affine/core/modules/doc-info/types';
import { WorkbenchService } from '@affine/core/modules/workbench';
import { ViewService } from '@affine/core/modules/workbench';
import { ViewService, WorkbenchService } from '@affine/core/modules/workbench';
import type { AffineDNDData } from '@affine/core/types/dnd';
import { useI18n } from '@affine/i18n';
import { track } from '@affine/track';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { notify, useConfirmModal } from '@affine/component';
import { AuthService, ServersService } from '@affine/core/modules/cloud';
import { GlobalDialogService } from '@affine/core/modules/dialogs';
import { Workspace, WorkspacesService } from '@affine/core/modules/workspace';
import type { Workspace } from '@affine/core/modules/workspace';
import { WorkspacesService } from '@affine/core/modules/workspace';
import { useI18n } from '@affine/i18n';
import { useLiveData, useService } from '@toeverything/infra';
import { useCallback } from 'react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
Workspace,
type Workspace,
type WorkspaceMetadata,
WorkspacesService,
} from '@affine/core/modules/workspace';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { BlockSuiteEditor as Editor } from './blocksuite/block-suite-editor';
import * as styles from './page-detail-editor.css';

declare global {
// oxlint-disable-next-line no-var
var currentEditor: AffineEditorContainer | undefined;
}

Expand Down
6 changes: 3 additions & 3 deletions packages/frontend/core/src/desktop/pages/workspace/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ declare global {
/**
* @internal debug only
*/

// oxlint-disable-next-line no-var
var currentWorkspace: Workspace | undefined;

// oxlint-disable-next-line no-var
var exportWorkspaceSnapshot: (docs?: string[]) => Promise<void>;
// oxlint-disable-next-line no-var
var importWorkspaceSnapshot: () => Promise<void>;
interface WindowEventMap {
'affine:workspace:change': CustomEvent<{ id: string }>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ const RandomBars = ({ count, header }: { count: number; header?: boolean }) => {
/>
) : null}
{Array.from({ length: count }).map((_, index) => (
// oxlint-disable-next-line eslint-plugin-react(no-array-index-key)
<RandomBar key={index} />
))}
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Store } from '@toeverything/infra';
import { map } from 'rxjs';

import { GlobalStateService } from '../../storage';
import type { GlobalStateService } from '../../storage';
import { BUILD_IN_SERVERS } from '../constant';
import type { ServerConfig, ServerMetadata } from '../types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { LiveData, Service } from '@toeverything/infra';
import { Observable } from 'rxjs';
import { Array as YArray } from 'yjs';

import { WorkspaceService } from '../../workspace';
import type { WorkspaceService } from '../../workspace';

const SETTING_KEY = 'setting';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
Entity,
generateFractionalIndexingKeyBetween,
LiveData,
} from '@toeverything/infra';
import { LiveData } from '@toeverything/infra';

import type { DocCustomPropertyInfo } from '../../db/schema/schema';
import type { DocPropertiesStore } from '../stores/doc-properties';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { DocMode } from '@blocksuite/affine/blocks';
import { Entity } from '@toeverything/infra';
import { LiveData } from '@toeverything/infra';
import { Entity, LiveData } from '@toeverything/infra';
import { map } from 'rxjs';

import type { DocsStore } from '../stores/docs';
Expand Down
3 changes: 1 addition & 2 deletions packages/frontend/core/src/modules/doc/entities/record.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { DocMode } from '@blocksuite/affine/blocks';
import type { DocMeta } from '@blocksuite/affine/store';
import { Entity } from '@toeverything/infra';
import { LiveData } from '@toeverything/infra';
import { Entity, LiveData } from '@toeverything/infra';

import type { DocProperties } from '../../db';
import type { DocPropertiesStore } from '../stores/doc-properties';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Store } from '@toeverything/infra';
import { yjsObserveByPath, yjsObserveDeep } from '@toeverything/infra';
import { Store, yjsObserveByPath, yjsObserveDeep } from '@toeverything/infra';
import { differenceBy, isNil, omitBy } from 'lodash-es';
import { combineLatest, map, switchMap } from 'rxjs';
import { AbstractType as YAbstractType } from 'yjs';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { isEmpty, omit } from 'lodash-es';
import { map, type Observable, switchMap } from 'rxjs';
import { z } from 'zod';

import { WorkspaceEngineBeforeStart, WorkspaceService } from '../../workspace';
import type { WorkspaceService } from '../../workspace';
import { WorkspaceEngineBeforeStart } from '../../workspace';
import { DocsIndexer } from '../entities/docs-indexer';

@OnEvent(WorkspaceEngineBeforeStart, s => s.handleWorkspaceEngineBeforeStart)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
Text as YText,
} from 'yjs';

import { getAFFiNEWorkspaceSchema } from '../../workspace';
import { getAFFiNEWorkspaceSchema } from '../../workspace/global-schema';
import type { BlockIndexSchema, DocIndexSchema } from '../schema';
import type {
WorkerIngoingMessage,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { OnEvent, Service } from '@toeverything/infra';

import { DocsService } from '../../doc';
import { Workspace, WorkspaceInitialized } from '../../workspace';
import type { Workspace } from '../../workspace';
import { WorkspaceInitialized } from '../../workspace';
import {
EditorSetting,
type EditorSettingExt,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ class WorkspacePropertiesAdapter {
setJournalPageDateString(id: string, date: string) {
this.ensurePageProperties(id);
const pageProperties = this.pageProperties?.[id];
// oxlint-disable-next-line no-non-null-assertion
pageProperties!.system[PageSystemPropertyId.Journal].value = date;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Entity } from '@toeverything/infra';
import { LiveData } from '@toeverything/infra';
import { Entity, LiveData } from '@toeverything/infra';
import { NEVER } from 'rxjs';

import type { GlobalStateService } from '../../storage';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { DocMode } from '@blocksuite/affine/blocks';
import { Entity, MemoryMemento } from '@toeverything/infra';
import { LiveData } from '@toeverything/infra';
import { Entity, LiveData, MemoryMemento } from '@toeverything/infra';

export class GlobalContext extends Entity {
memento = new MemoryMemento();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { OnEvent, Service } from '@toeverything/infra';

import { DocCreated, DocRecord } from '../../doc';
import type { DocRecord } from '../../doc';
import { DocCreated } from '../../doc';
import type { EditorSettingService } from '../../editor-setting';
import type { EdgelessDefaultTheme } from '../../editor-setting/schema';
import type { AppThemeService } from './theme';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ import {
import type { GlobalState } from '../../storage';
import {
getAFFiNEWorkspaceSchema,
Workspace,
type Workspace,
type WorkspaceEngineProvider,
type WorkspaceFlavourProvider,
WorkspaceFlavoursProvider,
type WorkspaceFlavoursProvider,
type WorkspaceMetadata,
type WorkspaceProfileInfo,
} from '../../workspace';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
getAFFiNEWorkspaceSchema,
type WorkspaceEngineProvider,
type WorkspaceFlavourProvider,
WorkspaceFlavoursProvider,
type WorkspaceFlavoursProvider,
type WorkspaceMetadata,
type WorkspaceProfileInfo,
} from '../../workspace';
Expand Down
10 changes: 7 additions & 3 deletions packages/frontend/core/src/modules/workspace/entities/engine.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { Entity } from '@toeverything/infra';
import { AwarenessEngine, BlobEngine, DocEngine } from '@toeverything/infra';
import { throwIfAborted } from '@toeverything/infra';
import {
AwarenessEngine,
BlobEngine,
DocEngine,
Entity,
throwIfAborted,
} from '@toeverything/infra';
import type { Doc as YDoc } from 'yjs';

import { WorkspaceEngineBeforeStart } from '../events';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Entity } from '@toeverything/infra';
import { LiveData } from '@toeverything/infra';
import { Entity, LiveData } from '@toeverything/infra';
import { combineLatest, map, of, switchMap } from 'rxjs';

import type { WorkspaceMetadata } from '../metadata';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DebugLogger } from '@affine/debug';
import { Entity } from '@toeverything/infra';
import {
effect,
Entity,
fromPromise,
LiveData,
onComplete,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { DocCollection } from '@blocksuite/affine/store';
import { Entity } from '@toeverything/infra';
import { LiveData } from '@toeverything/infra';
import { Entity, LiveData } from '@toeverything/infra';
import { nanoid } from 'nanoid';
import { Observable } from 'rxjs';
import type { Awareness } from 'y-protocols/awareness.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { DocCollection } from '@blocksuite/affine/store';
import type { LiveData } from '@toeverything/infra';
import {
type AwarenessConnection,
type BlobStorage,
createIdentifier,
type DocServer,
type DocStorage,
type LiveData,
} from '@toeverything/infra';

import type { WorkspaceProfileInfo } from '../entities/profile';
Expand Down

0 comments on commit 761734e

Please sign in to comment.