refactor(core): move block collection to affine and implement as doc (#9514)

This commit is contained in:
Saul-Mirone
2025-01-04 06:28:55 +00:00
parent 4cb186def2
commit dcf4993265
39 changed files with 595 additions and 192 deletions
@@ -17,6 +17,7 @@ import {
type DraftModel,
type Query,
Slice,
Text,
} from '@blocksuite/store';
import { render, type TemplateResult } from 'lit';
@@ -407,7 +408,7 @@ export function createLinkedDocFromSlice(
const linkedDoc = doc.collection.createDoc({});
linkedDoc.load(() => {
const rootId = linkedDoc.addBlock('affine:page', {
title: new doc.Text(docTitle),
title: new Text(docTitle),
});
linkedDoc.addBlock('affine:surface', {}, rootId);
const noteId = linkedDoc.addBlock('affine:note', {}, rootId);
@@ -22,6 +22,7 @@ import {
referenceToNode,
} from '@blocksuite/affine-shared/utils';
import { Bound, throttle } from '@blocksuite/global/utils';
import { Text } from '@blocksuite/store';
import { computed } from '@preact/signals-core';
import { html, nothing } from 'lit';
import { property, queryAsync, state } from 'lit/decorators.js';
@@ -171,7 +172,7 @@ export class EmbedLinkedDocBlockComponent extends EmbedBlockComponent<EmbedLinke
...this.referenceInfo$.peek(),
},
});
const text = new doc.Text(yText);
const text = new Text(yText);
doc.addBlock(
'affine:paragraph',
@@ -29,6 +29,7 @@ import {
BlockViewType,
type GetDocOptions,
type Query,
Text,
} from '@blocksuite/store';
import { computed } from '@preact/signals-core';
import { html, type PropertyValues } from 'lit';
@@ -280,7 +281,7 @@ export class EmbedSyncedDocBlockComponent extends EmbedBlockComponent<EmbedSynce
...this.referenceInfo,
},
});
const text = new doc.Text(yText);
const text = new Text(yText);
doc.addBlock(
'affine:paragraph',