-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify table block and address other tests
- Loading branch information
Showing
36 changed files
with
1,441 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
import { RichText } from '@wordpress/editor'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { name as rowName } from './row'; | ||
|
||
export const name = 'core/table-cell'; | ||
|
||
export const settings = { | ||
title: __( 'Table Cell' ), | ||
|
||
description: __( 'Add some basic text.' ), | ||
|
||
parent: [ rowName ], | ||
|
||
icon: 'editor-table', | ||
|
||
category: 'common', | ||
|
||
keywords: [ __( 'text' ) ], | ||
|
||
supports: { | ||
className: false, | ||
}, | ||
|
||
attributes: { | ||
content: { | ||
type: 'object', | ||
source: 'rich-text', | ||
selector: 'td,th', | ||
}, | ||
}, | ||
|
||
edit( { attributes, setAttributes } ) { | ||
return ( | ||
<RichText | ||
value={ attributes.content } | ||
onChange={ ( content ) => { | ||
setAttributes( { content } ); | ||
} } | ||
placeholder={ __( 'Add cell content' ) } | ||
/> | ||
); | ||
}, | ||
|
||
save( { attributes } ) { | ||
return ( | ||
<RichText.Content tagName="td" value={ attributes.content } /> | ||
); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
import { InnerBlocks } from '@wordpress/editor'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import { name as tableName } from '.'; | ||
import { name as cellName } from './cell'; | ||
|
||
export const name = 'core/table-row'; | ||
|
||
export const settings = { | ||
title: __( 'Table Row' ), | ||
|
||
parent: [ tableName ], | ||
|
||
icon: 'editor-table', | ||
|
||
description: __( 'A single column within a columns block.' ), | ||
|
||
category: 'common', | ||
|
||
supports: { | ||
className: false, | ||
}, | ||
|
||
edit() { | ||
return ( | ||
<InnerBlocks | ||
template={ [ [ cellName ], [ cellName ] ] } | ||
templateLock="all" | ||
allowedBlocks={ [ cellName ] } | ||
/> | ||
); | ||
}, | ||
|
||
save() { | ||
return <tr><InnerBlocks.Content /></tr>; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.