Browse Source

Поправки багов

Book Pauk 6 years ago
parent
commit
3fd404f022
1 changed files with 9 additions and 3 deletions
  1. 9 3
      client/components/Reader/share/BookParser.js

+ 9 - 3
client/components/Reader/share/BookParser.js

@@ -61,6 +61,11 @@ export default class BookParser {
         };
 
         const growParagraph = (text, len) => {
+            if (paraIndex < 0) {
+                newParagraph(text, len);
+                return;
+            }
+
             let p = para[paraIndex];
             if (p) {
                 paraOffset -= p.length;
@@ -99,13 +104,13 @@ export default class BookParser {
             }
 
             if (tag == 'title') {
-                newParagraph(' ', 1);
+                //newParagraph(' ', 1);
                 bold = true;
                 center = true;
             }
 
             if (tag == 'subtitle') {
-                newParagraph(' ', 1);
+                //newParagraph(' ', 1);
                 bold = true;
             }
         };
@@ -138,7 +143,6 @@ export default class BookParser {
             text = he.decode(text);
             text = text.replace(/>/g, '&gt;');
             text = text.replace(/</g, '&lt;');
-            text = text.replace(/[\t\n\r]/g, ' ');
 
             if (text != ' ' && text.trim() == '')
                 text = text.trim();
@@ -146,6 +150,8 @@ export default class BookParser {
             if (text == '')
                 return;
 
+            text = text.replace(/[\t\n\r]/g, ' ');
+
             switch (path) {
                 case '/fictionbook/description/title-info/author/first-name':
                     fb2.firstName = text;