mirror of
https://github.com/facebook/lexical.git
synced 2025-08-06 16:39:33 +08:00
Add UI components to Lexical Playground (#1211)
* Add UI components to Lexical Playground * Add autofocus plugin * Fix test
This commit is contained in:

committed by
acywatson

parent
1b6e5d254e
commit
fa107c93fb
@ -26,8 +26,9 @@ export default function TablePlugin(): React$Node {
|
||||
useEffect(() => {
|
||||
const removeCommandListener = editor.addListener(
|
||||
'command',
|
||||
(type) => {
|
||||
(type, payload) => {
|
||||
if (type === 'insertTable') {
|
||||
const {columns, rows} = payload;
|
||||
$log('handleAddTable');
|
||||
const selection = $getSelection();
|
||||
if (selection === null) {
|
||||
@ -37,7 +38,7 @@ export default function TablePlugin(): React$Node {
|
||||
|
||||
if (focusNode !== null) {
|
||||
const topLevelNode = focusNode.getTopLevelElementOrThrow();
|
||||
const tableNode = $createTableNodeWithDimensions(3, 3);
|
||||
const tableNode = $createTableNodeWithDimensions(rows, columns);
|
||||
topLevelNode.insertAfter(tableNode);
|
||||
tableNode.insertAfter($createParagraphNode());
|
||||
const firstCell = tableNode
|
||||
|
Reference in New Issue
Block a user