Skip to content

Commit

Permalink
fix(core): notify block not found
Browse files Browse the repository at this point in the history
  • Loading branch information
fundon committed Sep 13, 2024
1 parent b133262 commit 9d93721
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -38,7 +40,10 @@ function scrollAnchoringInEdgelessMode(
bounds = Bound.fromXYWH(deserializeXYWH(model.xywh));
}

if (!bounds) return;
if (!bounds) {
notify.warning({ title: I18n['Block not found']() });
return;
}

const { zoom, centerX, centerY } = service.getFitToScreenData(
[20, 20, 100, 20],
Expand Down Expand Up @@ -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.warning({ title: I18n['Block not found']() });
return;
}

blockComponent.scrollIntoView({
behavior: 'instant',
Expand Down

0 comments on commit 9d93721

Please sign in to comment.