diff --git a/client/components/Reader/ContentsPage/ContentsPage.vue b/client/components/Reader/ContentsPage/ContentsPage.vue
index a3784b31..1b21d8b5 100644
--- a/client/components/Reader/ContentsPage/ContentsPage.vue
+++ b/client/components/Reader/ContentsPage/ContentsPage.vue
@@ -1,8 +1,67 @@
');
+ const textParts = titleParts.filter(v => v).map(v => v.replace(/( |<([^>]+)>)/ig, ''));
+ return textParts.join(' ';
+ } else if (inTitle) {
+ curTitle.title += ' ';
+ }
+
para[paraIndex] = p;
paraOffset += p.length;
};
@@ -163,6 +171,13 @@ export default class BookParser {
p.length += len;
p.text += text;
+
+ if (inSubtitle) {
+ curSubtitle.title += text;
+ } else if (inTitle) {
+ curTitle.title += text;
+ }
+
para[paraIndex] = p;
paraOffset += p.length;
};
@@ -218,7 +233,8 @@ export default class BookParser {
bold = true;
center = true;
- curTitle = {paraIndex, subtitles: []};
+ inTitle = true;
+ curTitle = {paraIndex, title: '', subtitles: []};
this.contents.push(curTitle);
}
@@ -247,7 +263,8 @@ export default class BookParser {
bold = true;
center = true;
- curSubtitle = {paraIndex};
+ inSubtitle = true;
+ curSubtitle = {paraIndex, title: ''};
curTitle.subtitles.push(curSubtitle);
}
@@ -278,6 +295,7 @@ export default class BookParser {
isFirstTitlePara = false;
bold = false;
center = false;
+ inTitle = false;
}
if (tag == 'emphasis' || tag == 'strong') {
@@ -292,6 +310,7 @@ export default class BookParser {
isFirstTitlePara = false;
bold = false;
center = false;
+ inSubtitle = false;
}
if (tag == 'epigraph') {
diff --git a/client/quasar.js b/client/quasar.js
index 2567ca54..0410d9d1 100644
--- a/client/quasar.js
+++ b/client/quasar.js
@@ -32,6 +32,8 @@ import {QPopupProxy} from 'quasar/src/components/popup-proxy';
import {QDialog} from 'quasar/src/components/dialog';
import {QChip} from 'quasar/src/components/chip';
import {QTree} from 'quasar/src/components/tree';
+import {QExpansionItem} from 'quasar/src/components/expansion-item';
+
const components = {
//QLayout,
@@ -58,7 +60,8 @@ const components = {
QPopupProxy,
QDialog,
QChip,
- QTree
+ QTree,
+ QExpansionItem,
};
//directives
');
+ }
+
+ let i = 0;
+ const newContents = [];
+ parsed.contents.forEach((cont) => {
+ const label = prepareLabel(cont.title);
+
+ let j = 0;
+ const list = [];
+ cont.subtitles.forEach((sub) => {
+ const l = prepareLabel(sub.title);
+ const p = parsed.para[sub.paraIndex];
+ list.push({perc: (p.offset/parsed.textLength*100).toFixed(2), label: l, key: j});
+ j++;
+ });
+
+ const p = parsed.para[cont.paraIndex];
+ newContents.push({perc: (p.offset/parsed.textLength*100).toFixed(0), label, key: i, list});
+
+ i++;
+ });
+
+ this.contents = newContents;
}
close() {
@@ -45,4 +135,22 @@ class ContentsPage extends Vue {
diff --git a/client/components/Reader/Reader.vue b/client/components/Reader/Reader.vue
index 00c6dc81..6a5d1704 100644
--- a/client/components/Reader/Reader.vue
+++ b/client/components/Reader/Reader.vue
@@ -616,10 +616,14 @@ class Reader extends Vue {
contentsPageToggle() {
this.contentsPageActive = !this.contentsPageActive;
- if (this.contentsPageActive) {
+ const page = this.$refs.page;
+ if (this.contentsPageActive && this.activePage == 'TextPage' && page.parsed) {
this.closeAllWindows();
- this.$refs.contentsPage.init();
this.contentsPageActive = true;
+
+ this.$nextTick(() => {
+ this.$refs.contentsPage.init(this.mostRecentBook(), page.parsed);
+ });
} else {
this.contentsPageActive = false;
}
diff --git a/client/components/Reader/share/BookParser.js b/client/components/Reader/share/BookParser.js
index f7a8a887..8a44a0a9 100644
--- a/client/components/Reader/share/BookParser.js
+++ b/client/components/Reader/share/BookParser.js
@@ -53,9 +53,11 @@ export default class BookParser {
let dimPromises = [];
//оглавление
- this.contents = [];//[{paraIndex: