mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-17 14:27:02 +08:00
fix(core): fix falsy e2e (#6027)
This commit is contained in:
@@ -205,25 +205,27 @@ export const BlocksuiteEditorContainer = forwardRef<
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (blockElement) {
|
if (blockElement) {
|
||||||
requestIdleCallback(() => {
|
affineEditorContainerProxy.updateComplete
|
||||||
if (mode === 'page') {
|
.then(() => {
|
||||||
blockElement.scrollIntoView({
|
if (mode === 'page') {
|
||||||
behavior: 'smooth',
|
blockElement.scrollIntoView({
|
||||||
block: 'center',
|
behavior: 'smooth',
|
||||||
inline: 'center',
|
block: 'center',
|
||||||
|
inline: 'center',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const selectManager = affineEditorContainerProxy.host?.selection;
|
||||||
|
if (!blockElement.path.length || !selectManager) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const newSelection = selectManager.create('block', {
|
||||||
|
path: blockElement.path,
|
||||||
});
|
});
|
||||||
}
|
selectManager.set([newSelection]);
|
||||||
const selectManager = affineEditorContainerProxy.host?.selection;
|
})
|
||||||
if (!blockElement.path.length || !selectManager) {
|
.catch(console.error);
|
||||||
return;
|
|
||||||
}
|
|
||||||
const newSelection = selectManager.create('block', {
|
|
||||||
path: blockElement.path,
|
|
||||||
});
|
|
||||||
selectManager.set([newSelection]);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}, [blockElement, affineEditorContainerProxy.host?.selection, mode]);
|
}, [blockElement, affineEditorContainerProxy, mode]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|||||||
Reference in New Issue
Block a user