mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-19 07:17:00 +08:00
chore(editor): move legacy doc collection to test workspace (#9507)
This commit is contained in:
@@ -14,17 +14,18 @@ import {
|
||||
titleMiddleware,
|
||||
} from '@blocksuite/affine/blocks';
|
||||
import type { ServiceProvider } from '@blocksuite/affine/global/di';
|
||||
import type { JobMiddleware, Schema } from '@blocksuite/affine/store';
|
||||
import { Job } from '@blocksuite/affine/store';
|
||||
import { assertExists } from '@blocksuite/global/utils';
|
||||
import { assertExists } from '@blocksuite/affine/global/utils';
|
||||
import type {
|
||||
BlockModel,
|
||||
BlockSnapshot,
|
||||
Doc,
|
||||
DraftModel,
|
||||
JobMiddleware,
|
||||
Schema,
|
||||
Slice,
|
||||
SliceSnapshot,
|
||||
} from '@blocksuite/store';
|
||||
} from '@blocksuite/affine/store';
|
||||
import { Job } from '@blocksuite/affine/store';
|
||||
|
||||
const updateSnapshotText = (
|
||||
point: TextRangePoint,
|
||||
|
||||
@@ -4,7 +4,8 @@ import {
|
||||
markdownInlineToDeltaMatchers,
|
||||
} from '@blocksuite/affine/blocks';
|
||||
import { Container } from '@blocksuite/affine/global/di';
|
||||
import { DocCollection, Schema } from '@blocksuite/affine/store';
|
||||
import { Schema } from '@blocksuite/store';
|
||||
import { TestWorkspace } from '@blocksuite/store/test';
|
||||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import { markdownToMindmap } from '../mindmap-preview.js';
|
||||
@@ -28,7 +29,7 @@ describe('markdownToMindmap: convert markdown list to a mind map tree', () => {
|
||||
- Text D
|
||||
- Text E
|
||||
`;
|
||||
const collection = new DocCollection({ schema: new Schema() });
|
||||
const collection = new TestWorkspace({ schema: new Schema() });
|
||||
collection.meta.initialize();
|
||||
const doc = collection.createDoc();
|
||||
const nodes = markdownToMindmap(markdown, doc, provider);
|
||||
@@ -66,7 +67,7 @@ describe('markdownToMindmap: convert markdown list to a mind map tree', () => {
|
||||
- Text D
|
||||
- Text E
|
||||
`;
|
||||
const collection = new DocCollection({ schema: new Schema() });
|
||||
const collection = new TestWorkspace({ schema: new Schema() });
|
||||
collection.meta.initialize();
|
||||
const doc = collection.createDoc();
|
||||
const nodes = markdownToMindmap(markdown, doc, provider);
|
||||
@@ -98,7 +99,7 @@ describe('markdownToMindmap: convert markdown list to a mind map tree', () => {
|
||||
|
||||
test('empty case', () => {
|
||||
const markdown = '';
|
||||
const collection = new DocCollection({ schema: new Schema() });
|
||||
const collection = new TestWorkspace({ schema: new Schema() });
|
||||
collection.meta.initialize();
|
||||
const doc = collection.createDoc();
|
||||
const nodes = markdownToMindmap(markdown, doc, provider);
|
||||
|
||||
@@ -12,13 +12,7 @@ import {
|
||||
} from '@blocksuite/affine/blocks';
|
||||
import type { ServiceProvider } from '@blocksuite/affine/global/di';
|
||||
import { WithDisposable } from '@blocksuite/affine/global/utils';
|
||||
import {
|
||||
type Doc,
|
||||
type DocCollectionOptions,
|
||||
IdGeneratorType,
|
||||
Job,
|
||||
Schema,
|
||||
} from '@blocksuite/affine/store';
|
||||
import { type Doc, Job, Schema } from '@blocksuite/affine/store';
|
||||
import { css, html, LitElement, nothing } from 'lit';
|
||||
import { property, query } from 'lit/decorators.js';
|
||||
import { repeat } from 'lit/directives/repeat.js';
|
||||
@@ -102,14 +96,11 @@ export class MiniMindmapPreview extends WithDisposable(LitElement) {
|
||||
private _createTemporaryDoc() {
|
||||
const schema = new Schema();
|
||||
schema.register(MiniMindmapSchema);
|
||||
const options: DocCollectionOptions = {
|
||||
|
||||
const collection = new WorkspaceImpl({
|
||||
id: 'MINI_MINDMAP_TEMPORARY',
|
||||
schema,
|
||||
idGenerator: IdGeneratorType.NanoID,
|
||||
awarenessSources: [],
|
||||
};
|
||||
|
||||
const collection = new WorkspaceImpl(options);
|
||||
});
|
||||
collection.meta.initialize();
|
||||
collection.start();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user