fundon
2024-09-18 06:20:27 +00:00
parent eb47c0336c
commit 46f8237a46
2 changed files with 12 additions and 3 deletions

View File

@@ -1,3 +1,5 @@
import { notify } from '@affine/component';
import { I18n } from '@affine/i18n';
import type { BlockStdScope, SelectionManager } from '@blocksuite/block-std';
import type {
DocMode,
@@ -38,7 +40,10 @@ function scrollAnchoringInEdgelessMode(
bounds = Bound.fromXYWH(deserializeXYWH(model.xywh));
}
if (!bounds) return;
if (!bounds) {
notify.error({ title: I18n['Block not found']() });
return;
}
const { zoom, centerX, centerY } = service.getFitToScreenData(
[20, 20, 100, 20],
@@ -72,7 +77,10 @@ function scrollAnchoringInEdgelessMode(
function scrollAnchoringInPageMode(service: PageRootService, id: string) {
const blockComponent = service.std.view.getBlock(id);
if (!blockComponent) return;
if (!blockComponent) {
notify.error({ title: I18n['Block not found']() });
return;
}
blockComponent.scrollIntoView({
behavior: 'instant',

View File

@@ -1613,5 +1613,6 @@
"unnamed": "unnamed",
"upgradeBrowser": "Please upgrade to the latest version of Chrome for the best experience.",
"will be moved to Trash": "{{title}} will be moved to trash",
"will delete member": "will delete member"
"will delete member": "will delete member",
"Block not found": "Block not found"
}