Skip to content

Commit

Permalink
fix(core): should be bound to the correct object (#8121)
Browse files Browse the repository at this point in the history
  • Loading branch information
fundon committed Sep 5, 2024
1 parent d3f50a2 commit 017e89f
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions packages/frontend/core/src/modules/editor/entities/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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 () => {
Expand Down

0 comments on commit 017e89f

Please sign in to comment.