mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 05:37:32 +00:00
feat(editor): replace slot with rxjs subject (#10768)
This commit is contained in:
@@ -24,7 +24,8 @@
|
||||
"@toeverything/theme": "^1.1.12",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"lit": "^3.2.0",
|
||||
"lodash-es": "^4.17.21"
|
||||
"lodash-es": "^4.17.21",
|
||||
"rxjs": "^7.8.1"
|
||||
},
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
|
||||
@@ -303,14 +303,14 @@ export class AffineDocRemoteSelectionWidget extends WidgetComponent {
|
||||
);
|
||||
|
||||
this.disposables.add(
|
||||
this.std.store.slots.blockUpdated.on(() => {
|
||||
this.std.store.slots.blockUpdated.subscribe(() => {
|
||||
this._updateSelectionsThrottled(this._remoteSelections.peek());
|
||||
})
|
||||
);
|
||||
|
||||
const gfx = this.std.get(GfxControllerIdentifier);
|
||||
this.disposables.add(
|
||||
gfx.viewport.viewportUpdated.on(() => {
|
||||
gfx.viewport.viewportUpdated.subscribe(() => {
|
||||
const selections = this._remoteSelections.peek();
|
||||
this._updateSelections(selections);
|
||||
})
|
||||
|
||||
@@ -184,27 +184,31 @@ export class EdgelessRemoteSelectionWidget extends WidgetComponent<RootBlockMode
|
||||
|
||||
if (this.surface) {
|
||||
_disposables.add(
|
||||
this.surface.elementAdded.on(this._updateOnElementChange)
|
||||
this.surface.elementAdded.subscribe(this._updateOnElementChange)
|
||||
);
|
||||
_disposables.add(
|
||||
this.surface.elementRemoved.on(this._updateOnElementChange)
|
||||
this.surface.elementRemoved.subscribe(this._updateOnElementChange)
|
||||
);
|
||||
_disposables.add(
|
||||
this.surface.elementUpdated.on(this._updateOnElementChange)
|
||||
this.surface.elementUpdated.subscribe(this._updateOnElementChange)
|
||||
);
|
||||
}
|
||||
|
||||
_disposables.add(doc.slots.blockUpdated.on(this._updateOnElementChange));
|
||||
|
||||
_disposables.add(
|
||||
this.selection.slots.remoteUpdated.on(this._updateRemoteRects)
|
||||
);
|
||||
_disposables.add(
|
||||
this.selection.slots.remoteCursorUpdated.on(this._updateRemoteCursor)
|
||||
doc.slots.blockUpdated.subscribe(this._updateOnElementChange)
|
||||
);
|
||||
|
||||
_disposables.add(
|
||||
this.gfx.viewport.viewportUpdated.on(() => {
|
||||
this.selection.slots.remoteUpdated.subscribe(this._updateRemoteRects)
|
||||
);
|
||||
_disposables.add(
|
||||
this.selection.slots.remoteCursorUpdated.subscribe(
|
||||
this._updateRemoteCursor
|
||||
)
|
||||
);
|
||||
|
||||
_disposables.add(
|
||||
this.gfx.viewport.viewportUpdated.subscribe(() => {
|
||||
this._updateTransform();
|
||||
})
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user