fix(core): should be bound to the correct object (#8121)

<img width="795" alt="Screenshot 2024-09-05 at 18 05 35" src="https://github.com/user-attachments/assets/46f277e9-9be6-4f71-b765-fc442a3a9c64">
This commit is contained in:
fundon 2024-09-05 14:46:04 +00:00
parent d3f50a2e38
commit 017e89f458
No known key found for this signature in database
GPG Key ID: 398BFA91AC539CF7

View File

@ -181,20 +181,20 @@ export class Editor extends Entity {
>('rich-text');
title?.inlineEditor.focusEnd();
}
unsubs.push(
focusAt$
.distinctUntilChanged(
(a, b) => a?.id === b?.id && a?.refreshKey === b?.refreshKey
)
.subscribe(params => {
if (params?.id) {
const std = editorContainer.host?.std;
if (std) {
scrollAnchoring(std, this.mode$.value, params.id);
}
const subscription = focusAt$
.distinctUntilChanged(
(a, b) => a?.id === b?.id && a?.refreshKey === b?.refreshKey
)
.subscribe(params => {
if (params?.id) {
const std = editorContainer.host?.std;
if (std) {
scrollAnchoring(std, this.mode$.value, params.id);
}
}).unsubscribe
);
}
});
unsubs.push(subscription.unsubscribe.bind(subscription));
const edgelessPage = editorContainer.host?.querySelector(
'affine-edgeless-root'
@ -205,13 +205,13 @@ export class Editor extends Entity {
this.isPresenting$.next(
edgelessPage.edgelessTool.type === 'frameNavigator'
);
unsubs.push(
edgelessPage.slots.edgelessToolUpdated.on(() => {
this.isPresenting$.next(
edgelessPage.edgelessTool.type === 'frameNavigator'
);
}).dispose
);
const disposable = edgelessPage.slots.edgelessToolUpdated.on(() => {
this.isPresenting$.next(
edgelessPage.edgelessTool.type === 'frameNavigator'
);
});
unsubs.push(disposable.dispose.bind(disposable));
}
return () => {