mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-24 09:52:49 +08:00
feat(editor): replace slot with rxjs subject (#10768)
This commit is contained in:
@@ -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"
|
||||
},
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user