mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-01 09:30:01 +08:00
feat(editor): replace slot with rxjs subject (#10768)
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
"@toeverything/theme": "^1.1.12",
|
||||
"@vanilla-extract/css": "^1.17.0",
|
||||
"lit": "^3.2.0",
|
||||
"rxjs": "^7.8.1",
|
||||
"yjs": "^13.6.21",
|
||||
"zod": "^3.23.8"
|
||||
},
|
||||
|
||||
@@ -355,7 +355,10 @@ describe('stash/pop', () => {
|
||||
elementModel.stash('strokeWidth');
|
||||
|
||||
const onchange = vi.fn();
|
||||
model.elementUpdated.once(({ id }) => onchange(id));
|
||||
const subscription = model.elementUpdated.subscribe(({ id }) => {
|
||||
subscription.unsubscribe();
|
||||
onchange(id);
|
||||
});
|
||||
|
||||
elementModel.strokeWidth = 10;
|
||||
expect(onchange).toHaveBeenCalledWith(id);
|
||||
@@ -449,7 +452,10 @@ describe('local decorator', () => {
|
||||
|
||||
const onchange = vi.fn();
|
||||
|
||||
model.elementUpdated.once(({ id }) => onchange(id));
|
||||
const subscription = model.elementUpdated.subscribe(({ id }) => {
|
||||
subscription.unsubscribe();
|
||||
onchange(id);
|
||||
});
|
||||
elementModel.display = false;
|
||||
|
||||
expect(elementModel.display).toBe(false);
|
||||
|
||||
@@ -159,7 +159,7 @@ export class TestAffineEditorContainer extends SignalWatcher(
|
||||
super.connectedCallback();
|
||||
|
||||
this._disposables.add(
|
||||
this.doc.slots.rootAdded.on(() => this.requestUpdate())
|
||||
this.doc.slots.rootAdded.subscribe(() => this.requestUpdate())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user