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

View File

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