@wordpress/block-library
Version:
Block library for the WordPress editor.
48 lines (44 loc) • 784 B
JavaScript
const tableContentPasteSchema = ( { phrasingContentSchema } ) => ( {
tr: {
allowEmpty: true,
children: {
th: {
allowEmpty: true,
children: phrasingContentSchema,
attributes: [ 'scope' ],
},
td: {
allowEmpty: true,
children: phrasingContentSchema,
},
},
},
} );
const tablePasteSchema = ( args ) => ( {
table: {
children: {
thead: {
allowEmpty: true,
children: tableContentPasteSchema( args ),
},
tfoot: {
allowEmpty: true,
children: tableContentPasteSchema( args ),
},
tbody: {
allowEmpty: true,
children: tableContentPasteSchema( args ),
},
},
},
} );
const transforms = {
from: [
{
type: 'raw',
selector: 'table',
schema: tablePasteSchema,
},
],
};
export default transforms;