mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-20 07:47:19 +08:00
refactor(core): move workspace implementation to affine (#9504)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { WorkspaceImpl } from '@affine/core/modules/workspace/impl/workspace';
|
||||
import type {
|
||||
EditorHost,
|
||||
TextRangePoint,
|
||||
@@ -14,7 +15,7 @@ import {
|
||||
} from '@blocksuite/affine/blocks';
|
||||
import type { ServiceProvider } from '@blocksuite/affine/global/di';
|
||||
import type { JobMiddleware, Schema } from '@blocksuite/affine/store';
|
||||
import { DocCollection, Job } from '@blocksuite/affine/store';
|
||||
import { Job } from '@blocksuite/affine/store';
|
||||
import { assertExists } from '@blocksuite/global/utils';
|
||||
import type {
|
||||
BlockModel,
|
||||
@@ -207,7 +208,7 @@ export async function markDownToDoc(
|
||||
additionalMiddlewares?: JobMiddleware[]
|
||||
) {
|
||||
// Should not create a new doc in the original collection
|
||||
const collection = new DocCollection({
|
||||
const collection = new WorkspaceImpl({
|
||||
schema,
|
||||
});
|
||||
collection.meta.initialize();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { WorkspaceImpl } from '@affine/core/modules/workspace/impl/workspace';
|
||||
import { BlockStdScope, type EditorHost } from '@blocksuite/affine/block-std';
|
||||
import {
|
||||
type AffineAIPanelWidgetConfig,
|
||||
@@ -6,7 +7,7 @@ import {
|
||||
import { AffineSchemas } from '@blocksuite/affine/blocks/schemas';
|
||||
import { WithDisposable } from '@blocksuite/affine/global/utils';
|
||||
import type { Doc } from '@blocksuite/affine/store';
|
||||
import { DocCollection, Schema } from '@blocksuite/affine/store';
|
||||
import { Schema } from '@blocksuite/affine/store';
|
||||
import { css, html, LitElement, nothing } from 'lit';
|
||||
import { property, query } from 'lit/decorators.js';
|
||||
import { createRef, type Ref, ref } from 'lit/directives/ref.js';
|
||||
@@ -54,7 +55,7 @@ export class AISlidesRenderer extends WithDisposable(LitElement) {
|
||||
|
||||
private _doc!: Doc;
|
||||
|
||||
private _docCollection: DocCollection | null = null;
|
||||
private _docCollection: WorkspaceImpl | null = null;
|
||||
|
||||
@query('editor-host')
|
||||
private accessor _editorHost!: EditorHost;
|
||||
@@ -220,7 +221,7 @@ export class AISlidesRenderer extends WithDisposable(LitElement) {
|
||||
super.connectedCallback();
|
||||
|
||||
const schema = new Schema().register(AffineSchemas);
|
||||
const collection = new DocCollection({
|
||||
const collection = new WorkspaceImpl({
|
||||
schema,
|
||||
id: 'SLIDES_PREVIEW',
|
||||
});
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { WorkspaceImpl } from '@affine/core/modules/workspace/impl/workspace.js';
|
||||
import { BlockStdScope, type EditorHost } from '@blocksuite/affine/block-std';
|
||||
import {
|
||||
MarkdownAdapter,
|
||||
@@ -13,7 +14,6 @@ import type { ServiceProvider } from '@blocksuite/affine/global/di';
|
||||
import { WithDisposable } from '@blocksuite/affine/global/utils';
|
||||
import {
|
||||
type Doc,
|
||||
DocCollection,
|
||||
type DocCollectionOptions,
|
||||
IdGeneratorType,
|
||||
Job,
|
||||
@@ -109,7 +109,7 @@ export class MiniMindmapPreview extends WithDisposable(LitElement) {
|
||||
awarenessSources: [],
|
||||
};
|
||||
|
||||
const collection = new DocCollection(options);
|
||||
const collection = new WorkspaceImpl(options);
|
||||
collection.meta.initialize();
|
||||
collection.start();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user