{"version":3,"file":"edit.cjs","names":["alignLeft","__","alignCenter","alignRight","_x","useState","useColorProps","useBorderProps","useBackgroundProps","useBlockEditingMode","useRef","useToolsPanelDropdownMenuProps","createTable","useCallback","updateSelectedCell","getCellAttribute","toggleSection","insertRow","deleteRow","insertColumn","deleteColumn","isEmptyTableSection","tableRowBefore","tableRowAfter","tableRowDelete","tableColumnBefore","tableColumnAfter","tableColumnDelete","useBlockProps","BlockControls","AlignmentControl","ToolbarDropdownMenu","table","InspectorControls","ToolsPanel","ToolsPanelItem","ToggleControl","hasSplitBorders","Placeholder","BlockIcon","icon","TextControl","Button","Caption","memo","RichText"],"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. Only react to the\n\t// block going from selected to deselected: a cell receives focus (and is\n\t// set as the selected cell) before the block itself becomes selected.\n\tconst [ prevIsSingleSelected, setPrevIsSingleSelected ] =\n\t\tuseState( isSingleSelected );\n\tif ( isSingleSelected !== prevIsSingleSelected ) {\n\t\tsetPrevIsSingleSelected( isSingleSelected );\n\t\tif ( ! isSingleSelected ) {\n\t\t\tsetSelectedCell();\n\t\t}\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":";;;;;;;;;;;;;;;;;;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