From 7fe41d6f770038fbd3bd9155547352eda71a59eb Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Wed, 16 Jan 2019 21:33:31 +0700 Subject: [PATCH] =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D0=BA=D0=B8=D0=B9=20=D1=80?= =?UTF-8?q?=D0=B5=D1=84=D0=B0=D0=BA=D1=82=D0=BE=D1=80=D0=B8=D0=BD=D0=B3,?= =?UTF-8?q?=20=D0=BF=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=BF?= =?UTF-8?q?=D0=B0=D1=80=D1=81=D0=B5=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/components/Reader/TextPage/TextPage.vue | 4 ++-- client/components/Reader/share/BookParser.js | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/client/components/Reader/TextPage/TextPage.vue b/client/components/Reader/TextPage/TextPage.vue index e220b7b2..78bdb078 100644 --- a/client/components/Reader/TextPage/TextPage.vue +++ b/client/components/Reader/TextPage/TextPage.vue @@ -160,8 +160,8 @@ class TextPage extends Vue { if (this.textAlignJustify && !line.last) { const words = text.split(' '); if (words.length > 1) { - let space = canvas.width - line.width + spaceWidth*(words.length - 1); - space = space/(words.length - 1); + const spaceCount = words.length - 1; + const space = (canvas.width - line.width + spaceWidth*spaceCount)/spaceCount; let x = 0; for (const word of words) { diff --git a/client/components/Reader/share/BookParser.js b/client/components/Reader/share/BookParser.js index feb0d8df..f50b8e51 100644 --- a/client/components/Reader/share/BookParser.js +++ b/client/components/Reader/share/BookParser.js @@ -109,7 +109,11 @@ export default class BookParser { }); parser.on('textNode', (text) => { - text = text.trim(); + if (text != ' ' && text.trim() == '') + text = text.trim(); + + if (text == '') + return; switch (path) { case '/FictionBook/description/title-info/author/first-name': @@ -144,16 +148,10 @@ export default class BookParser { fb2.annotation += text; } - if (text == '') - return; - if (path.indexOf('/FictionBook/body/title') == 0) { newParagraph(text, text.length); } - if (text == '') - return; - if (path.indexOf('/FictionBook/body/section') == 0) { switch (tag) { case 'p':