Skip to content

Commit

Permalink
fix(plugin): hide left menu when block change
Browse files Browse the repository at this point in the history
  • Loading branch information
Austaras committed Aug 10, 2022
1 parent ffdf247 commit 00f5f23
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 00f5f23

Please sign in to comment.