mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-18 17:52:02 +03:00
fix(plugin): hide left menu when block change
This commit is contained in:
parent
ffdf247517
commit
00f5f239b2
@ -168,6 +168,12 @@ export const GroupMenu = function ({ editor, hooks }: GroupMenuProps) {
|
||||
|
||||
useEffect(() => {
|
||||
setShowMenu(false);
|
||||
|
||||
if (groupBlock) {
|
||||
const unobserve = groupBlock.onUpdate(() => setGroupBlock(null));
|
||||
return unobserve;
|
||||
}
|
||||
return undefined;
|
||||
}, [groupBlock]);
|
||||
|
||||
return (
|
||||
|
@ -184,6 +184,14 @@ export const LeftMenuDraggable: FC<LeftMenuProps> = props => {
|
||||
return () => sub.unsubscribe();
|
||||
}, [blockInfo, editor]);
|
||||
|
||||
useEffect(() => {
|
||||
if (block?.block != null) {
|
||||
const unobserve = block.block.onUpdate(() => setBlock(undefined));
|
||||
return unobserve;
|
||||
}
|
||||
return undefined;
|
||||
}, [block?.block]);
|
||||
|
||||
useEffect(() => {
|
||||
const sub = lineInfo.subscribe(data => {
|
||||
if (data == null) {
|
||||
|
Loading…
Reference in New Issue
Block a user