Skip to content

Commit

Permalink
fix(core): fix falsy e2e (#6027)
Browse files Browse the repository at this point in the history
  • Loading branch information
EYHN committed Mar 5, 2024
1 parent 5d8dea0 commit dce3b59
Showing 1 changed file with 19 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,25 +205,27 @@ export const BlocksuiteEditorContainer = forwardRef<

useEffect(() => {
if (blockElement) {
requestIdleCallback(() => {
if (mode === 'page') {
blockElement.scrollIntoView({
behavior: 'smooth',
block: 'center',
inline: 'center',
affineEditorContainerProxy.updateComplete
.then(() => {
if (mode === 'page') {
blockElement.scrollIntoView({
behavior: 'smooth',
block: 'center',
inline: 'center',
});
}
const selectManager = affineEditorContainerProxy.host?.selection;
if (!blockElement.path.length || !selectManager) {
return;
}
const newSelection = selectManager.create('block', {
path: blockElement.path,
});
}
const selectManager = affineEditorContainerProxy.host?.selection;
if (!blockElement.path.length || !selectManager) {
return;
}
const newSelection = selectManager.create('block', {
path: blockElement.path,
});
selectManager.set([newSelection]);
});
selectManager.set([newSelection]);
})
.catch(console.error);
}
}, [blockElement, affineEditorContainerProxy.host?.selection, mode]);
}, [blockElement, affineEditorContainerProxy, mode]);

return (
<div
Expand Down

0 comments on commit dce3b59

Please sign in to comment.