Skip to content

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

packages/frontend/core/src/modules/editor/utils/scroll-anchoring.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { notify } from '@affine/component';
2+
import { I18n } from '@affine/i18n';
13
import type { BlockStdScope, SelectionManager } from '@blocksuite/block-std';
24
import type {
35
DocMode,
@@ -38,7 +40,10 @@ function scrollAnchoringInEdgelessMode(
3840
bounds = Bound.fromXYWH(deserializeXYWH(model.xywh));
3941
}
4042

41-
if (!bounds) return;
43+
if (!bounds) {
44+
notify.error({ title: I18n['Block not found']() });
45+
return;
46+
}
4247

4348
const { zoom, centerX, centerY } = service.getFitToScreenData(
4449
[20, 20, 100, 20],
@@ -72,7 +77,10 @@ function scrollAnchoringInEdgelessMode(
7277

7378
function scrollAnchoringInPageMode(service: PageRootService, id: string) {
7479
const blockComponent = service.std.view.getBlock(id);
75-
if (!blockComponent) return;
80+
if (!blockComponent) {
81+
notify.error({ title: I18n['Block not found']() });
82+
return;
83+
}
7684

7785
blockComponent.scrollIntoView({
7886
behavior: 'instant',

packages/frontend/i18n/src/resources/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1613,5 +1613,6 @@
16131613
"unnamed": "unnamed",
16141614
"upgradeBrowser": "Please upgrade to the latest version of Chrome for the best experience.",
16151615
"will be moved to Trash": "{{title}} will be moved to trash",
1616-
"will delete member": "will delete member"
1616+
"will delete member": "will delete member",
1617+
"Block not found": "Block not found"
16171618
}

0 commit comments

Comments
 (0)