diff --git a/client/components/Reader/ContentsPage/ContentsPage.vue b/client/components/Reader/ContentsPage/ContentsPage.vue index 9a34364a..ab792883 100644 --- a/client/components/Reader/ContentsPage/ContentsPage.vue +++ b/client/components/Reader/ContentsPage/ContentsPage.vue @@ -16,6 +16,7 @@ class="no-mp bg-grey-4 text-grey-7" > + @@ -56,6 +57,24 @@ +
+
+
+
+
+
+
+
+
{{ item.perc }}%
+
+
+
+
+ Изображения отсутствуют +
+
+
+
Раздел находится в разработке @@ -84,6 +103,7 @@ export default @Component({ class ContentsPage extends Vue { selectedTab = 'contents'; contents = []; + images = []; created() { } @@ -166,6 +186,22 @@ class ContentsPage extends Vue { }); this.contents = newContents; + + //формируем newImages + const newImages = []; + const ims = parsed.images; + for (i = 0; i < ims.length; i++) { + const image = ims[i]; + + const label = `Изображение ${image.num}`; + const indentStyle = getIndentStyle(0); + const labelStyle = getLabelStyle(0); + + const p = parsed.para[image.paraIndex]; + newImages.push({perc: (p.offset/parsed.textLength*100).toFixed(0), label, key: i, offset: p.offset, indentStyle, labelStyle}); + } + + this.images = newImages; } async expandClick(key) { diff --git a/client/components/Reader/share/BookParser.js b/client/components/Reader/share/BookParser.js index 0e2bc97d..9d4b1bb1 100644 --- a/client/components/Reader/share/BookParser.js +++ b/client/components/Reader/share/BookParser.js @@ -54,12 +54,14 @@ export default class BookParser { //оглавление this.contents = []; + this.images = []; let curTitle = {paraIndex: -1, title: '', subtitles: []}; let curSubtitle = {paraIndex: -1, title: ''}; let inTitle = false; let inSubtitle = false; let sectionLevel = 0; let bodyIndex = 0; + let imageIndex = 0; let paraIndex = -1; let paraOffset = 0; @@ -207,11 +209,18 @@ export default class BookParser { growParagraph(``, 0); else newParagraph(`${' '.repeat(maxImageLineCount)}`, maxImageLineCount); + + imageIndex++; + this.images.push({paraIndex, num: imageIndex}); + if (inPara && this.showInlineImagesInCenter) newParagraph(' ', 1); } else {//external dimPromises.push(getExternalImageDimensions(href)); newParagraph(`${' '.repeat(maxImageLineCount)}`, maxImageLineCount); + + imageIndex++; + this.images.push({paraIndex, num: imageIndex}); } } }