@@ -66,10 +66,16 @@ export default function Edit( { attributes, setAttributes } ) {
6666 } , [ ] ) ;
6767
6868 const { autoupdate } = attributes ;
69- const boxColors = useSelect ( ( select ) => {
70- return select ( blockEditorStore ) . getSettings ( ) ?. colors || [ ] ;
69+ const editorSettings = useSelect ( ( select ) => {
70+ return select ( blockEditorStore ) . getSettings ( ) || { } ;
7171 } , [ ] ) ;
72+ const boxColors = editorSettings . colors || [ ] ;
7273 const selectedBoxColor = attributes . box_color ;
74+ const wrapperEnabled = attributes . wrapper || attributes . box_style ;
75+ const settingsUrl =
76+ editorSettings . simpletocSettingsUrl ||
77+ window . simpletocEditorSettings ?. settingsUrl ||
78+ '' ;
7379
7480 const { returnisSaving, returnisSavingNonPostEntityChanges } = useSelect (
7581 ( select ) => {
@@ -459,11 +465,19 @@ export default function Edit( { attributes, setAttributes } ) {
459465 < PanelRow >
460466 < ToggleControl
461467 label = { __ ( 'Wrapper div' , 'simpletoc' ) }
462- help = { __ (
463- 'Additionally adds the role "navigation" and ARIA attributes.' ,
464- 'simpletoc'
465- ) }
466- checked = { attributes . wrapper }
468+ help = {
469+ attributes . box_style
470+ ? __ (
471+ 'Enabled automatically while box style is active.' ,
472+ 'simpletoc'
473+ )
474+ : __ (
475+ 'Additionally adds the role "navigation" and ARIA attributes.' ,
476+ 'simpletoc'
477+ )
478+ }
479+ checked = { wrapperEnabled }
480+ disabled = { attributes . box_style }
467481 onChange = { ( ) =>
468482 setAttributes ( {
469483 wrapper : ! attributes . wrapper ,
@@ -486,6 +500,24 @@ export default function Edit( { attributes, setAttributes } ) {
486500 }
487501 />
488502 </ PanelRow >
503+ { settingsUrl && (
504+ < PanelRow >
505+ < BaseControl
506+ id = "simpletoc-global-settings-link"
507+ help = { __ (
508+ 'Global SimpleTOC settings can enforce these options for all blocks.' ,
509+ 'simpletoc'
510+ ) }
511+ >
512+ < ExternalLink href = { settingsUrl } >
513+ { __ (
514+ 'Open global SimpleTOC settings' ,
515+ 'simpletoc'
516+ ) }
517+ </ ExternalLink >
518+ </ BaseControl >
519+ </ PanelRow >
520+ ) }
489521 </ PanelBody >
490522 </ Panel >
491523 </ InspectorControls >
0 commit comments