feat(editor): replace slot with rxjs subject (#10768)

This commit is contained in:
Mirone
2025-03-12 11:29:24 +09:00
committed by GitHub
parent 19f978d9aa
commit cd63e0ed8b
302 changed files with 1405 additions and 1251 deletions

View File

@@ -21,6 +21,7 @@
"@types/lodash-es": "^4.17.12",
"fractional-indexing": "^3.2.0",
"lodash-es": "^4.17.21",
"rxjs": "^7.8.1",
"yjs": "^13.6.21",
"zod": "^3.23.8"
},

View File

@@ -12,8 +12,9 @@ export type RootBlockProps = {
export class RootBlockModel extends BlockModel<RootBlockProps> {
constructor() {
super();
this.created.once(() => {
this.doc.slots.rootAdded.on(id => {
const createdSubscription = this.created.subscribe(() => {
createdSubscription.unsubscribe();
this.doc.slots.rootAdded.subscribe(id => {
const model = this.doc.getBlockById(id);
if (model instanceof RootBlockModel) {
const newDocMeta = this.doc.workspace.meta.getDocMeta(model.doc.id);