mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-18 19:51:38 +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(() => {
|
useEffect(() => {
|
||||||
setShowMenu(false);
|
setShowMenu(false);
|
||||||
|
|
||||||
|
if (groupBlock) {
|
||||||
|
const unobserve = groupBlock.onUpdate(() => setGroupBlock(null));
|
||||||
|
return unobserve;
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
}, [groupBlock]);
|
}, [groupBlock]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -184,6 +184,14 @@ export const LeftMenuDraggable: FC<LeftMenuProps> = props => {
|
|||||||
return () => sub.unsubscribe();
|
return () => sub.unsubscribe();
|
||||||
}, [blockInfo, editor]);
|
}, [blockInfo, editor]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (block?.block != null) {
|
||||||
|
const unobserve = block.block.onUpdate(() => setBlock(undefined));
|
||||||
|
return unobserve;
|
||||||
|
}
|
||||||
|
return undefined;
|
||||||
|
}, [block?.block]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const sub = lineInfo.subscribe(data => {
|
const sub = lineInfo.subscribe(data => {
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user