{"version":3,"file":"edit.mjs","names":["useColorProps","useBorderProps","ToolsPanel","ToolsPanelItem","hasSplitBorders","icon"],"sources":["../../src/table/edit.jsx"],"sourcesContent":["import clsx from 'clsx';\nimport {\n\tmemo,\n\tuseCallback,\n\tuseEffect,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\tRichText,\n\tBlockIcon,\n\tAlignmentControl,\n\tuseBlockProps,\n\t__experimentalUseColorProps as useColorProps,\n\t__experimentalUseBorderProps as useBorderProps,\n\tuseBackgroundProps,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tButton,\n\tPlaceholder,\n\tTextControl,\n\tToggleControl,\n\tToolbarDropdownMenu,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport {\n\talignLeft,\n\talignRight,\n\talignCenter,\n\tblockTable as icon,\n\ttableColumnAfter,\n\ttableColumnBefore,\n\ttableColumnDelete,\n\ttableRowAfter,\n\ttableRowBefore,\n\ttableRowDelete,\n\ttable,\n} from '@wordpress/icons';\nimport {\n\tcreateTable,\n\tupdateSelectedCell,\n\tgetCellAttribute,\n\tinsertRow,\n\tdeleteRow,\n\tinsertColumn,\n\tdeleteColumn,\n\ttoggleSection,\n\tisEmptyTableSection,\n} from './state';\nimport { Caption } from '../utils/caption';\nimport { useToolsPanelDropdownMenuProps } from '../utils/hooks';\n\nconst ALIGNMENT_CONTROLS = [\n\t{\n\t\ticon: alignLeft,\n\t\ttitle: __( 'Align column left' ),\n\t\talign: 'left',\n\t},\n\t{\n\t\ticon: alignCenter,\n\t\ttitle: __( 'Align column center' ),\n\t\talign: 'center',\n\t},\n\t{\n\t\ticon: alignRight,\n\t\ttitle: __( 'Align column right' ),\n\t\talign: 'right',\n\t},\n];\n\nconst cellAriaLabel = {\n\thead: __( 'Header cell text' ),\n\tbody: __( 'Body cell text' ),\n\tfoot: __( 'Footer cell text' ),\n};\n\nconst placeholder = {\n\thead: _x( 'Header label', 'table header' ),\n\tfoot: _x( 'Footer label', 'table footer' ),\n};\n\nfunction TSection( { name, ...props } ) {\n\tconst TagName = `t${ name }`;\n\treturn <TagName { ...props } />;\n}\n\nfunction TableEdit( {\n\tattributes,\n\tsetAttributes,\n\tinsertBlocksAfter,\n\tisSelected: isSingleSelected,\n} ) {\n\tconst { hasFixedLayout, head, foot } = attributes;\n\tconst [ initialRowCount, setInitialRowCount ] = useState( 2 );\n\tconst [ initialColumnCount, setInitialColumnCount ] = useState( 2 );\n\tconst [ selectedCell, setSelectedCell ] = useState();\n\n\t// Mirror of save: `has-link-color` belongs on the figure only.\n\tconst colorProps = useColorProps( {\n\t\t...attributes,\n\t\tstyle: { ...attributes.style, elements: undefined },\n\t} );\n\tconst borderProps = useBorderProps( attributes );\n\tconst backgroundProps = useBackgroundProps( attributes );\n\tconst textAlign = attributes?.style?.typography?.textAlign;\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst tableRef = useRef();\n\tconst [ hasTableCreated, setHasTableCreated ] = useState( false );\n\n\tconst dropdownMenuProps = useToolsPanelDropdownMenuProps();\n\n\t/**\n\t * Updates the initial column count used for table creation.\n\t *\n\t * @param {number} count New initial column count.\n\t */\n\tfunction onChangeInitialColumnCount( count ) {\n\t\tsetInitialColumnCount( count );\n\t}\n\n\t/**\n\t * Updates the initial row count used for table creation.\n\t *\n\t * @param {number} count New initial row count.\n\t */\n\tfunction onChangeInitialRowCount( count ) {\n\t\tsetInitialRowCount( count );\n\t}\n\n\t/**\n\t * Creates a table based on dimensions in local state.\n\t *\n\t * @param {Object} event Form submit event.\n\t */\n\tfunction onCreateTable( event ) {\n\t\tevent.preventDefault();\n\n\t\tsetAttributes(\n\t\t\tcreateTable( {\n\t\t\t\trowCount: parseInt( initialRowCount, 10 ) || 2,\n\t\t\t\tcolumnCount: parseInt( initialColumnCount, 10 ) || 2,\n\t\t\t} )\n\t\t);\n\t\tsetHasTableCreated( true );\n\t}\n\n\t/**\n\t * Toggles whether the table has a fixed layout or not.\n\t */\n\tfunction onChangeFixedLayout() {\n\t\tsetAttributes( { hasFixedLayout: ! hasFixedLayout } );\n\t}\n\n\t/**\n\t * Changes the content of the currently selected cell.\n\t *\n\t * @param {Array} content A RichText content value.\n\t */\n\tconst onChange = useCallback(\n\t\tfunction ( content ) {\n\t\t\tif ( ! selectedCell ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tsetAttributes( ( currentAttributes ) =>\n\t\t\t\tupdateSelectedCell(\n\t\t\t\t\tcurrentAttributes,\n\t\t\t\t\tselectedCell,\n\t\t\t\t\t( cellAttributes ) => ( {\n\t\t\t\t\t\t...cellAttributes,\n\t\t\t\t\t\tcontent,\n\t\t\t\t\t} )\n\t\t\t\t)\n\t\t\t);\n\t\t},\n\t\t[ selectedCell, setAttributes ]\n\t);\n\n\t/**\n\t * Align text within the a column.\n\t *\n\t * @param {string} align The new alignment to apply to the column.\n\t */\n\tfunction onChangeColumnAlignment( align ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Convert the cell selection to a column selection so that alignment\n\t\t// is applied to the entire column.\n\t\tconst columnSelection = {\n\t\t\ttype: 'column',\n\t\t\tcolumnIndex: selectedCell.columnIndex,\n\t\t};\n\n\t\tconst newAttributes = updateSelectedCell(\n\t\t\tattributes,\n\t\t\tcolumnSelection,\n\t\t\t( cellAttributes ) => ( {\n\t\t\t\t...cellAttributes,\n\t\t\t\talign,\n\t\t\t} )\n\t\t);\n\t\tsetAttributes( newAttributes );\n\t}\n\n\t/**\n\t * Get the alignment of the currently selected cell.\n\t *\n\t * @return {string | undefined} The new alignment to apply to the column.\n\t */\n\tfunction getCellAlignment() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn getCellAttribute( attributes, selectedCell, 'align' );\n\t}\n\n\t/**\n\t * Add or remove a `head` table section.\n\t */\n\tfunction onToggleHeaderSection() {\n\t\tsetAttributes( toggleSection( attributes, 'head' ) );\n\t}\n\n\t/**\n\t * Add or remove a `foot` table section.\n\t */\n\tfunction onToggleFooterSection() {\n\t\tsetAttributes( toggleSection( attributes, 'foot' ) );\n\t}\n\n\t/**\n\t * Inserts a row at the currently selected row index, plus `delta`.\n\t *\n\t * @param {number} delta Offset for selected row index at which to insert.\n\t */\n\tfunction onInsertRow( delta ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, rowIndex } = selectedCell;\n\t\tconst newRowIndex = rowIndex + delta;\n\n\t\tsetAttributes(\n\t\t\tinsertRow( attributes, {\n\t\t\t\tsectionName,\n\t\t\t\trowIndex: newRowIndex,\n\t\t\t} )\n\t\t);\n\t\t// Select the first cell of the new row.\n\t\tsetSelectedCell( {\n\t\t\tsectionName,\n\t\t\trowIndex: newRowIndex,\n\t\t\tcolumnIndex: 0,\n\t\t\ttype: 'cell',\n\t\t} );\n\t}\n\n\t/**\n\t * Inserts a row before the currently selected row.\n\t */\n\tfunction onInsertRowBefore() {\n\t\tonInsertRow( 0 );\n\t}\n\n\t/**\n\t * Inserts a row after the currently selected row.\n\t */\n\tfunction onInsertRowAfter() {\n\t\tonInsertRow( 1 );\n\t}\n\n\t/**\n\t * Deletes the currently selected row.\n\t */\n\tfunction onDeleteRow() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, rowIndex } = selectedCell;\n\n\t\tsetSelectedCell();\n\t\tsetAttributes( deleteRow( attributes, { sectionName, rowIndex } ) );\n\t}\n\n\t/**\n\t * Inserts a column at the currently selected column index, plus `delta`.\n\t *\n\t * @param {number} delta Offset for selected column index at which to insert.\n\t */\n\tfunction onInsertColumn( delta = 0 ) {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { columnIndex } = selectedCell;\n\t\tconst newColumnIndex = columnIndex + delta;\n\n\t\tsetAttributes(\n\t\t\tinsertColumn( attributes, {\n\t\t\t\tcolumnIndex: newColumnIndex,\n\t\t\t} )\n\t\t);\n\t\t// Select the first cell of the new column.\n\t\tsetSelectedCell( {\n\t\t\trowIndex: 0,\n\t\t\tcolumnIndex: newColumnIndex,\n\t\t\ttype: 'cell',\n\t\t} );\n\t}\n\n\t/**\n\t * Inserts a column before the currently selected column.\n\t */\n\tfunction onInsertColumnBefore() {\n\t\tonInsertColumn( 0 );\n\t}\n\n\t/**\n\t * Inserts a column after the currently selected column.\n\t */\n\tfunction onInsertColumnAfter() {\n\t\tonInsertColumn( 1 );\n\t}\n\n\t/**\n\t * Deletes the currently selected column.\n\t */\n\tfunction onDeleteColumn() {\n\t\tif ( ! selectedCell ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { sectionName, columnIndex } = selectedCell;\n\n\t\tsetSelectedCell();\n\t\tsetAttributes(\n\t\t\tdeleteColumn( attributes, { sectionName, columnIndex } )\n\t\t);\n\t}\n\n\t// Clear the selected cell when the block is deselected.\n\tif ( ! isSingleSelected && selectedCell ) {\n\t\tsetSelectedCell();\n\t}\n\n\tuseEffect( () => {\n\t\tif ( hasTableCreated ) {\n\t\t\ttableRef?.current\n\t\t\t\t?.querySelector( 'td div[contentEditable=\"true\"]' )\n\t\t\t\t?.focus();\n\t\t\tsetHasTableCreated( false );\n\t\t}\n\t}, [ hasTableCreated ] );\n\n\tconst sections = [ 'head', 'body', 'foot' ].filter(\n\t\t( name ) => ! isEmptyTableSection( attributes[ name ] )\n\t);\n\n\tconst tableControls = [\n\t\t{\n\t\t\ticon: tableRowBefore,\n\t\t\ttitle: __( 'Insert row before' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertRowBefore,\n\t\t},\n\t\t{\n\t\t\ticon: tableRowAfter,\n\t\t\ttitle: __( 'Insert row after' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertRowAfter,\n\t\t},\n\t\t{\n\t\t\ticon: tableRowDelete,\n\t\t\ttitle: __( 'Delete row' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onDeleteRow,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnBefore,\n\t\t\ttitle: __( 'Insert column before' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertColumnBefore,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnAfter,\n\t\t\ttitle: __( 'Insert column after' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onInsertColumnAfter,\n\t\t},\n\t\t{\n\t\t\ticon: tableColumnDelete,\n\t\t\ttitle: __( 'Delete column' ),\n\t\t\tisDisabled: ! selectedCell,\n\t\t\tonClick: onDeleteColumn,\n\t\t},\n\t];\n\n\tconst renderedSections = sections.map( ( name ) => (\n\t\t<TSection name={ name } key={ name }>\n\t\t\t{ attributes[ name ].map( ( { cells }, rowIndex ) => (\n\t\t\t\t<tr key={ rowIndex }>\n\t\t\t\t\t{ cells.map( ( cellProps, columnIndex ) => {\n\t\t\t\t\t\tconst isSelected =\n\t\t\t\t\t\t\tselectedCell?.sectionName === name &&\n\t\t\t\t\t\t\tselectedCell?.rowIndex === rowIndex &&\n\t\t\t\t\t\t\tselectedCell?.columnIndex === columnIndex;\n\n\t\t\t\t\t\t// Important - the Cell component is memoized to improve typing performance.\n\t\t\t\t\t\t// ensure all props passed have stable references.\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<Cell\n\t\t\t\t\t\t\t\tkey={ columnIndex }\n\t\t\t\t\t\t\t\tname={ name }\n\t\t\t\t\t\t\t\trowIndex={ rowIndex }\n\t\t\t\t\t\t\t\tcolumnIndex={ columnIndex }\n\t\t\t\t\t\t\t\tonChange={\n\t\t\t\t\t\t\t\t\t// Only pass the `onChange` handler to the selectedCell.\n\t\t\t\t\t\t\t\t\t// Cell components are memoized, so it's best to avoid\n\t\t\t\t\t\t\t\t\t// passing in a value that will cause all cells to re-render\n\t\t\t\t\t\t\t\t\t// whenever it changes.\n\t\t\t\t\t\t\t\t\tisSelected ? onChange : undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsetSelectedCell={ setSelectedCell }\n\t\t\t\t\t\t\t\t{ ...cellProps }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t</tr>\n\t\t\t) ) }\n\t\t</TSection>\n\t) );\n\n\tconst isEmpty = ! sections.length;\n\n\treturn (\n\t\t<figure { ...useBlockProps( { ref: tableRef } ) }>\n\t\t\t{ ! isEmpty && blockEditingMode === 'default' && (\n\t\t\t\t<>\n\t\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t\t<AlignmentControl\n\t\t\t\t\t\t\tlabel={ __( 'Align column content' ) }\n\t\t\t\t\t\t\talignmentControls={ ALIGNMENT_CONTROLS }\n\t\t\t\t\t\t\tvalue={ getCellAlignment() }\n\t\t\t\t\t\t\tonChange={ ( nextAlign ) =>\n\t\t\t\t\t\t\t\tonChangeColumnAlignment( nextAlign )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t\t<ToolbarDropdownMenu\n\t\t\t\t\t\t\ticon={ table }\n\t\t\t\t\t\t\tlabel={ __( 'Edit table' ) }\n\t\t\t\t\t\t\tcontrols={ tableControls }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<InspectorControls>\n\t\t\t\t<ToolsPanel\n\t\t\t\t\tlabel={ __( 'Settings' ) }\n\t\t\t\t\tresetAll={ () => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\thasFixedLayout: true,\n\t\t\t\t\t\t\thead: [],\n\t\t\t\t\t\t\tfoot: [],\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t\tdropdownMenuProps={ dropdownMenuProps }\n\t\t\t\t>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => hasFixedLayout !== true }\n\t\t\t\t\t\tlabel={ __( 'Fixed width table cells' ) }\n\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\tsetAttributes( { hasFixedLayout: true } )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t>\n\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\tlabel={ __( 'Fixed width table cells' ) }\n\t\t\t\t\t\t\tchecked={ !! hasFixedLayout }\n\t\t\t\t\t\t\tonChange={ onChangeFixedLayout }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t{ ! isEmpty && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\thasValue={ () => head && head.length }\n\t\t\t\t\t\t\t\tlabel={ __( 'Header section' ) }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { head: [] } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Header section' ) }\n\t\t\t\t\t\t\t\t\tchecked={ !! ( head && head.length ) }\n\t\t\t\t\t\t\t\t\tonChange={ onToggleHeaderSection }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\t\t\thasValue={ () => foot && foot.length }\n\t\t\t\t\t\t\t\tlabel={ __( 'Footer section' ) }\n\t\t\t\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { foot: [] } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Footer section' ) }\n\t\t\t\t\t\t\t\t\tchecked={ !! ( foot && foot.length ) }\n\t\t\t\t\t\t\t\t\tonChange={ onToggleFooterSection }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t</ToolsPanel>\n\t\t\t</InspectorControls>\n\t\t\t{ ! isEmpty && (\n\t\t\t\t<table\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\tcolorProps.className,\n\t\t\t\t\t\tborderProps.className,\n\t\t\t\t\t\tbackgroundProps.className,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'has-fixed-layout': hasFixedLayout,\n\t\t\t\t\t\t\t[ `has-text-align-${ textAlign }` ]: textAlign,\n\t\t\t\t\t\t\t// This is required in the editor only to overcome\n\t\t\t\t\t\t\t// the fact the editor rewrites individual border\n\t\t\t\t\t\t\t// widths into a shorthand format.\n\t\t\t\t\t\t\t'has-individual-borders': hasSplitBorders(\n\t\t\t\t\t\t\t\tattributes?.style?.border\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t...colorProps.style,\n\t\t\t\t\t\t...borderProps.style,\n\t\t\t\t\t\t...backgroundProps.style,\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ renderedSections }\n\t\t\t\t</table>\n\t\t\t) }\n\t\t\t{ isEmpty ? (\n\t\t\t\t<Placeholder\n\t\t\t\t\tlabel={ __( 'Table' ) }\n\t\t\t\t\ticon={ <BlockIcon icon={ icon } showColors /> }\n\t\t\t\t\tinstructions={ __( 'Insert a table for sharing data.' ) }\n\t\t\t\t>\n\t\t\t\t\t<form\n\t\t\t\t\t\tclassName=\"blocks-table__placeholder-form\"\n\t\t\t\t\t\tonSubmit={ onCreateTable }\n\t\t\t\t\t>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tlabel={ __( 'Column count' ) }\n\t\t\t\t\t\t\tvalue={ initialColumnCount }\n\t\t\t\t\t\t\tonChange={ onChangeInitialColumnCount }\n\t\t\t\t\t\t\tmin=\"1\"\n\t\t\t\t\t\t\tclassName=\"blocks-table__placeholder-input\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\ttype=\"number\"\n\t\t\t\t\t\t\tlabel={ __( 'Row count' ) }\n\t\t\t\t\t\t\tvalue={ initialRowCount }\n\t\t\t\t\t\t\tonChange={ onChangeInitialRowCount }\n\t\t\t\t\t\t\tmin=\"1\"\n\t\t\t\t\t\t\tclassName=\"blocks-table__placeholder-input\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Create Table' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</form>\n\t\t\t\t</Placeholder>\n\t\t\t) : (\n\t\t\t\t<Caption\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisSelected={ isSingleSelected }\n\t\t\t\t\tinsertBlocksAfter={ insertBlocksAfter }\n\t\t\t\t\tlabel={ __( 'Table caption text' ) }\n\t\t\t\t\tshowToolbarButton={\n\t\t\t\t\t\tisSingleSelected && blockEditingMode === 'default'\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t) }\n\t\t</figure>\n\t);\n}\n\nconst Cell = memo( function ( {\n\ttag: CellTag,\n\tname,\n\tscope,\n\tcolspan,\n\trowspan,\n\trowIndex,\n\tcolumnIndex,\n\talign,\n\tcontent,\n\tonChange,\n\tsetSelectedCell,\n} ) {\n\treturn (\n\t\t<CellTag\n\t\t\tscope={ CellTag === 'th' ? scope : undefined }\n\t\t\tcolSpan={ colspan }\n\t\t\trowSpan={ rowspan }\n\t\t\tclassName={ clsx(\n\t\t\t\t{\n\t\t\t\t\t[ `has-text-align-${ align }` ]: align,\n\t\t\t\t},\n\t\t\t\t'wp-block-table__cell-content'\n\t\t\t) }\n\t\t>\n\t\t\t<RichText\n\t\t\t\tidentifier={ `${ name }.${ rowIndex }.cells.${ columnIndex }.content` }\n\t\t\t\tvalue={ content }\n\t\t\t\tonChange={ onChange }\n\t\t\t\tonFocus={ () => {\n\t\t\t\t\tsetSelectedCell( {\n\t\t\t\t\t\tsectionName: name,\n\t\t\t\t\t\trowIndex,\n\t\t\t\t\t\tcolumnIndex,\n\t\t\t\t\t\ttype: 'cell',\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\taria-label={ cellAriaLabel[ name ] }\n\t\t\t\tplaceholder={ placeholder[ name ] }\n\t\t\t/>\n\t\t</CellTag>\n\t);\n} );\n\nexport default TableEdit;\n"],"mappings":";;;;;;;;;;;AA0DA,MAAM,qBAAqB;CAC1B;EACC,MAAM;EACN,OAAO,GAAI,mBAAoB;EAC/B,OAAO;CACR;CACA;EACC,MAAM;EACN,OAAO,GAAI,qBAAsB;EACjC,OAAO;CACR;CACA;EACC,MAAM;EACN,OAAO,GAAI,oBAAqB;EAChC,OAAO;CACR;AACD;AAEA,MAAM,gBAAgB;CACrB,MAAM,GAAI,kBAAmB;CAC7B,MAAM,GAAI,gBAAiB;CAC3B,MAAM,GAAI,kBAAmB;AAC9B;AAEA,MAAM,cAAc;CACnB,MAAM,GAAI,gBAAgB,cAAe;CACzC,MAAM,GAAI,gBAAgB,cAAe;AAC1C;AAEA,SAAS,SAAU,EAAE,MAAM,GAAG,SAAU;CACvC,MAAM,UAAU,IAAK;CACrB,OAAO,oBAAC,SAAD,EAAS,GAAK,MAAS,CAAA;AAC/B;AA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