#2077 Rythmer les Tables des matières

This commit is contained in:
2023-06-14 11:53:04 +02:00
parent d9402c6145
commit d76c8b502a
2 changed files with 20 additions and 6 deletions
+13 -1
View File
@@ -892,6 +892,12 @@ section[role="main-content"]{
} }
} }
section.tocitem{
&[level="1"]:not([type="front"]),
&[level="2"]{
padding-top: 0.4em;
}
}
.toc-title{ .toc-title{
@include title4grey; @include title4grey;
@@ -912,7 +918,13 @@ section[role="main-content"]{
pointer-events: none; pointer-events: none;
} }
} }
h2.toc-title{font-size: 1.1em;} h2.toc-title{
font-size: 1.1em;
color: $bleuroilight;
&:hover, &.loaded{
color: $bleuroi;
}
}
h3.toc-title{font-size: 1em;} h3.toc-title{font-size: 1em;}
h4.toc-title{font-size: 0.9em;} h4.toc-title{font-size: 0.9em;}
h5.toc-title{font-size: 0.8em;} h5.toc-title{font-size: 0.8em;}
+7 -5
View File
@@ -26,15 +26,16 @@
opened: isOpened, opened: isOpened,
disabled: isDisabled disabled: isDisabled
}" }"
:type="item.type"
:level="level"
> >
<a <a
:href="'/texts/'+editionid+'/'+item.uuid" :href="'/texts/'+editionid+'/'+item.uuid"
:uuid="item.uuid" :uuid="item.uuid"
v-html="title"
@click.prevent="onclick" @click.prevent="onclick"
@keyup.enter="onclick" @keyup.enter="onclick"
> />
{{ title }}
</a>
</component> </component>
<ul <ul
v-if="children.length" v-if="children.length"
@@ -96,7 +97,7 @@ export default {
title () { title () {
// this shoudn't be necessary // this shoudn't be necessary
if (this.item.title && Array.isArray(this.item.title)) { if (this.item.title && Array.isArray(this.item.title)) {
return this.truncate(this.item.title.join(' '), 50, true) return this.truncate(this.item.title.join(' '), 80, true)
} else if (this.item.title) { } else if (this.item.title) {
return this.truncate(this.item.title, 80, true) return this.truncate(this.item.title, 80, true)
} else { } else {
@@ -150,6 +151,7 @@ export default {
} }
}, },
created () { created () {
console.log('TocItem created', this.item)
this.flat_indexes = [] this.flat_indexes = []
Object.keys(this.item.indexes[0]).forEach(index => { Object.keys(this.item.indexes[0]).forEach(index => {
this.item.indexes[0][index].forEach(element => { this.item.indexes[0][index].forEach(element => {
@@ -181,7 +183,7 @@ export default {
const subString = str.slice(0, n - 1) // the original check const subString = str.slice(0, n - 1) // the original check
return (useWordBoundary return (useWordBoundary
? subString.slice(0, subString.lastIndexOf(' ')) ? subString.slice(0, subString.lastIndexOf(' '))
: subString) + ' ...' : subString) + '&nbsp;...'
}, },
onclick (e) { onclick (e) {
console.log('clicked on toc text', this.item, e) console.log('clicked on toc text', this.item, e)