Skip to content

Commit

Permalink
Remove levels choices h1,h4,h5 and h6 from Toc block (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
iRohitSingh authored Jul 24, 2023
1 parent b007acf commit 47369c3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions news/178.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove levels choices h1,h4,h5 and h6 from Toc block @iRohitSingh
7 changes: 7 additions & 0 deletions src/components/Blocks/Toc/schema.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const tocBlockSchemaEnhancer = ({ formData, schema, intl }) => {
schema.properties.levels.choices = [
['h2', 'h2'],
['h3', 'h3'],
];
return schema;
};
7 changes: 7 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { AccordionSchemaEnhancer } from './components/Blocks/Accordion/schema';
import gridSVG from './icons/block_icn_grid.svg';
import accordionSVG from './icons/block_icn_accordion.svg';
import EventView from './components/Theme/EventView';
import { tocBlockSchemaEnhancer } from './components/Blocks/Toc/schema';

const BG_COLORS = [
{ name: 'transparent', label: 'Transparent' },
Expand Down Expand Up @@ -256,6 +257,12 @@ const applyConfig = (config) => {

config.views.contentTypesViews.Event = EventView;

// TOC Block
config.blocks.blocksConfig.toc = {
...config.blocks.blocksConfig.toc,
schemaEnhancer: tocBlockSchemaEnhancer,
};

return config;
};

Expand Down

0 comments on commit 47369c3

Please sign in to comment.