fix: error catch (#181)

This commit is contained in:
DiamondThree
2022-08-10 18:45:20 +08:00
committed by GitHub
parent 696a7785e0
commit d7ddffe3f8

View File

@@ -81,7 +81,9 @@ export const CommandMenu = ({ editor, hooks, style }: CommandMenuProps) => {
const checkIfShowCommandMenu = useCallback(
async (event: React.KeyboardEvent<HTMLDivElement>) => {
const { type, anchorNode } = editor.selection.currentSelectInfo;
// console.log(await editor.getBlockById(anchorNode.id));
if (!anchorNode?.id) {
return;
}
const activeBlock = await editor.getBlockById(anchorNode.id);
if (activeBlock.type === Protocol.Block.Type.page) {
return;