fix: error catch (#181)
This commit is contained in:
@@ -81,7 +81,9 @@ export const CommandMenu = ({ editor, hooks, style }: CommandMenuProps) => {
|
|||||||
const checkIfShowCommandMenu = useCallback(
|
const checkIfShowCommandMenu = useCallback(
|
||||||
async (event: React.KeyboardEvent<HTMLDivElement>) => {
|
async (event: React.KeyboardEvent<HTMLDivElement>) => {
|
||||||
const { type, anchorNode } = editor.selection.currentSelectInfo;
|
const { type, anchorNode } = editor.selection.currentSelectInfo;
|
||||||
// console.log(await editor.getBlockById(anchorNode.id));
|
if (!anchorNode?.id) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const activeBlock = await editor.getBlockById(anchorNode.id);
|
const activeBlock = await editor.getBlockById(anchorNode.id);
|
||||||
if (activeBlock.type === Protocol.Block.Type.page) {
|
if (activeBlock.type === Protocol.Block.Type.page) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user