generated from eea/volto-addon-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add dropdown menu for items in toc getting out of viewport - re…
…fs #254302
- Loading branch information
1 parent
6b9c132
commit db39fec
Showing
3 changed files
with
231 additions
and
8 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
src/customizations/volto/components/manage/Blocks/ToC/Schema.jsx
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,51 @@ | ||
const TableOfContentsSchema = ({ data }) => { | ||
const { variation = 'default' } = data; | ||
|
||
return { | ||
title: 'Table of Contents', | ||
fieldsets: [ | ||
{ | ||
id: 'default', | ||
title: 'Default', | ||
fields: [ | ||
'title', | ||
'hide_title', | ||
...(variation === 'default' ? ['ordered'] : ['sticky']), | ||
'levels', | ||
], | ||
}, | ||
], | ||
properties: { | ||
title: { | ||
title: 'Block title', | ||
}, | ||
hide_title: { | ||
title: 'Hide title', | ||
type: 'boolean', | ||
}, | ||
levels: { | ||
title: 'Entries', | ||
isMulti: true, | ||
choices: [ | ||
['h1', 'h1'], | ||
['h2', 'h2'], | ||
['h3', 'h3'], | ||
['h4', 'h4'], | ||
['h5', 'h5'], | ||
['h6', 'h6'], | ||
], | ||
}, | ||
ordered: { | ||
title: 'Ordered', | ||
type: 'boolean', | ||
}, | ||
sticky: { | ||
title: 'Sticky', | ||
type: 'boolean', | ||
}, | ||
}, | ||
required: [], | ||
}; | ||
}; | ||
|
||
export default TableOfContentsSchema; |
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
36 changes: 36 additions & 0 deletions
36
src/customizations/volto/components/manage/Blocks/ToC/variations/horizontal-menu.less
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,36 @@ | ||
.table-of-contents.horizontalMenu.sticky-toc { | ||
position: fixed !important; | ||
z-index: 1 !important; | ||
top: 0 !important; | ||
width: inherit; | ||
} | ||
|
||
.table-of-contents.horizontalMenu .hidden { | ||
z-index: -1; | ||
pointer-events: none; | ||
visibility: hidden; | ||
} | ||
|
||
.table-of-contents.horizontalMenu .hidden-dropdown { | ||
display: none !important; | ||
} | ||
|
||
.table-of-contents.horizontalMenu .item.toc-dropdown { | ||
position: absolute !important; | ||
right: 0; | ||
height: 100%; | ||
} | ||
|
||
.table-of-contents.horizontalMenu > .ui.menu { | ||
position: relative; | ||
} | ||
|
||
.table-of-contents.horizontalMenu .item.toc-dropdown .focused > a { | ||
border: 2px solid black !important; | ||
border-radius: 4px; | ||
} | ||
|
||
.ui.menu .dropdown.item .menu { | ||
right: 0; | ||
left: auto; | ||
} |