From a51150c72938750b29b00da0664098c8fff75626 Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Tue, 15 Dec 2020 23:01:58 +0700 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE?= =?UTF-8?q?=D1=80=D0=B8=D0=BD=D0=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/components/Reader/ContentsPage/ContentsPage.vue | 3 +-- client/components/Reader/share/BookParser.js | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/components/Reader/ContentsPage/ContentsPage.vue b/client/components/Reader/ContentsPage/ContentsPage.vue index e1f2d9a1..112d12b0 100644 --- a/client/components/Reader/ContentsPage/ContentsPage.vue +++ b/client/components/Reader/ContentsPage/ContentsPage.vue @@ -195,7 +195,6 @@ class ContentsPage extends Vue { const ims = parsed.images; for (i = 0; i < ims.length; i++) { const image = ims[i]; - let {id} = parsed.imageHrefToId(image.href); const label = `Изображение ${image.num}`; const indentStyle = getIndentStyle(1); @@ -203,7 +202,7 @@ class ContentsPage extends Vue { const p = parsed.para[image.paraIndex]; newImages.push({perc: (p.offset/parsed.textLength*100).toFixed(0), label, key: i, offset: p.offset, - indentStyle, labelStyle, type: (parsed.binary[id] ? parsed.binary[id].type : '')}); + indentStyle, labelStyle, type: (parsed.binary[image.id] ? parsed.binary[image.id].type : '')}); } this.images = newImages; diff --git a/client/components/Reader/share/BookParser.js b/client/components/Reader/share/BookParser.js index cec2f762..2355ccc8 100644 --- a/client/components/Reader/share/BookParser.js +++ b/client/components/Reader/share/BookParser.js @@ -204,6 +204,7 @@ export default class BookParser { let attrs = sax.getAttrsSync(tail); if (attrs.href && attrs.href.value) { const href = attrs.href.value; + const {id} = this.imageHrefToId(href); if (href[0] == '#') {//local if (inPara && !this.showInlineImagesInCenter && !center) growParagraph(``, 0); @@ -211,7 +212,7 @@ export default class BookParser { newParagraph(`${' '.repeat(maxImageLineCount)}`, maxImageLineCount); imageIndex++; - this.images.push({paraIndex, num: imageIndex, href}); + this.images.push({paraIndex, num: imageIndex, id}); if (inPara && this.showInlineImagesInCenter) newParagraph(' ', 1); @@ -220,7 +221,7 @@ export default class BookParser { newParagraph(`${' '.repeat(maxImageLineCount)}`, maxImageLineCount); imageIndex++; - this.images.push({paraIndex, num: imageIndex, href}); + this.images.push({paraIndex, num: imageIndex, id}); } } }