Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
perpending
/
wp-content
/
plugins
/
seo-by-rank-math
/
includes
/
modules
/
schema
/
blocks
/
toc
/
assets
/
src
:
deprecated.js
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
import { linearToNestedHeadingList } from './utils' import { useBlockProps } from '@wordpress/block-editor' import List from './list' const attributes = { title: { type: 'text', }, headings: { type: 'array', items: { type: 'object', }, }, listStyle: { type: 'text', }, titleWrapper: { type: 'text', default: 'h2', }, excludeHeadings: { type: 'array', }, } const v1 = { attributes, save( { attributes } ) { if ( attributes.headings.length === 0 ) { return null } const TitleWrapper = attributes.titleWrapper const headings = linearToNestedHeadingList( attributes.headings ) const ListStyle = attributes.listStyle return ( <div { ...useBlockProps.save() }> { attributes.title && <TitleWrapper dangerouslySetInnerHTML={ { __html: attributes.title } }></TitleWrapper> } <nav> <ListStyle> <List headings={ headings } ListStyle={ ListStyle } isSave={ true } /> </ListStyle> </nav> </div> ) }, } export default [ v1 ]