mirror of
https://github.com/facebook/lexical.git
synced 2025-08-06 16:39:33 +08:00

committed by
acywatson

parent
22a5d8511f
commit
d9559c07a4
@ -16,7 +16,12 @@ import {
|
||||
TableNode,
|
||||
TableRowNode,
|
||||
} from '@lexical/table';
|
||||
import {$createParagraphNode, $getSelection, $isRootNode} from 'lexical';
|
||||
import {
|
||||
$createParagraphNode,
|
||||
$getSelection,
|
||||
$isRangeSelection,
|
||||
$isRootNode,
|
||||
} from 'lexical';
|
||||
import {useEffect} from 'react';
|
||||
import invariant from 'shared/invariant';
|
||||
|
||||
@ -38,7 +43,7 @@ export default function TablePlugin(): React$Node {
|
||||
if (type === 'insertTable') {
|
||||
const {columns, rows} = payload;
|
||||
const selection = $getSelection();
|
||||
if (selection === null) {
|
||||
if (!$isRangeSelection(selection)) {
|
||||
return true;
|
||||
}
|
||||
const focus = selection.focus;
|
||||
|
Reference in New Issue
Block a user