diff --git a/assets/css/app.scss b/assets/css/app.scss index a3cbb6f..764e8ee 100644 --- a/assets/css/app.scss +++ b/assets/css/app.scss @@ -346,6 +346,7 @@ section[role="main-content"]{ h4.toc-title{font-size: 0.882em;} h5.toc-title{font-size: 0.882em;} h6.toc-title{font-size: 0.882em;} + span.toc-title{font-size: 0.882em;} } } diff --git a/src/components/Content/EdText.vue b/src/components/Content/EdText.vue index 84e1868..5882794 100644 --- a/src/components/Content/EdText.vue +++ b/src/components/Content/EdText.vue @@ -21,7 +21,7 @@ export default { } }, beforeMount () { - console.log('EdText beforeMount') + // console.log('EdText beforeMount') if (this.tei) { this.buildTemplate() } @@ -48,7 +48,7 @@ export default { }, parseLinks () { let links = this.html.match(//g) - console.log('links', links) + // console.log('links', links) if (links) { // let domparser = new DOMParser() // let domlink @@ -98,7 +98,7 @@ export default { } }, render (h) { - console.log('EdText render()') + // console.log('EdText render()') if (!this.template) { return h('span', 'Loading ...') } else { diff --git a/src/components/Content/EdToc.vue b/src/components/Content/EdToc.vue index b8f8c45..05920d4 100644 --- a/src/components/Content/EdToc.vue +++ b/src/components/Content/EdToc.vue @@ -30,9 +30,11 @@ export default { toc: Array, loadedtextsuuids: Array }, - data: () => ({ - - }), + // watch: { + // loadedtextsuuids (n, o) { + // console.log('EdToc watch loadedtxtsuuids', o, n) + // } + // }, methods: { onClickTocItem (uuid) { this.$emit('onClickTocItem', uuid) diff --git a/src/components/Content/TocItem.vue b/src/components/Content/TocItem.vue index 895a6ab..b64c651 100644 --- a/src/components/Content/TocItem.vue +++ b/src/components/Content/TocItem.vue @@ -52,9 +52,9 @@ export default { editionid: String, loadedtextsuuids: Array }, - // data: () => ({ - // - // }) + data: () => ({ + isOpened: false + }), computed: { children () { // check if children exists and if it is an array @@ -70,7 +70,7 @@ export default { } }, titlelevel () { - return 'h' + this.level + return this.level < 7 ? `h${this.level}` : `span` }, nextLevel () { return this.level + 1 @@ -83,21 +83,25 @@ export default { return false } }, - isOpened () { - // console.log('opened', this.$route.params.textid.indexOf(this.item.uuid) >= 0) - if (typeof this.$route.params.textid !== 'undefined') { - return this.$route.params.textid.indexOf(this.item.uuid) >= 0 - } else { - return false - } - }, isLoaded () { + // this is updated when loadedtextsuuids is changing + // but not for isOpened (had to use a watcher + beforeMount) + // don't now why ? return this.loadedtextsuuids.indexOf(this.item.uuid) !== -1 } }, + watch: { + loadedtextsuuids (n, o) { + // console.log('EdTocItem watch loadedtxtsuuids', o, n) + this.isOpened = this.loadedtextsuuids.some(e => e.indexOf(this.item.uuid) >= 0) + } + }, // beforeCreate () { // console.log('editionid', this.editionid) // }, + beforeMount () { + this.isOpened = this.$route.params.textid.indexOf(this.item.uuid) >= 0 + }, methods: { onclick (e) { console.log('clicked on toc text', this.editionid, e)