From d7ac9d1bfcf56886d0147bc053cea3a410673c2f Mon Sep 17 00:00:00 2001 From: Book Pauk Date: Wed, 31 Jul 2024 11:30:31 +0700 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=BB=D1=83=D1=87=D1=88=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BE=D1=82=D0=BE=D0=B1=D1=80=D0=B0=D0=B6=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=BF=D1=80=D0=B8=D0=BC=D0=B5=D1=87=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Reader/TextPage/TextPage.vue | 8 +++-- client/components/Reader/share/BookParser.js | 31 +++++++++++-------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/client/components/Reader/TextPage/TextPage.vue b/client/components/Reader/TextPage/TextPage.vue index 47cd9711..f95eeb1a 100644 --- a/client/components/Reader/TextPage/TextPage.vue +++ b/client/components/Reader/TextPage/TextPage.vue @@ -38,9 +38,9 @@ - +
@@ -148,6 +148,7 @@ class TextPage { noteDialogVisible = false; noteId = ''; + noteTitle = ''; noteHtml = ''; created() { @@ -1271,6 +1272,7 @@ class TextPage { if (note) { if (orig) {//show dialog this.noteId = noteId; + this.noteTitle = `[${note.title?.trim()}]`; this.noteHtml = note.xml .replace(/

/g, '

') .replace(//g, '
').replace(/<\/stanza>/g, '') diff --git a/client/components/Reader/share/BookParser.js b/client/components/Reader/share/BookParser.js index 79c28749..f627c118 100644 --- a/client/components/Reader/share/BookParser.js +++ b/client/components/Reader/share/BookParser.js @@ -402,17 +402,6 @@ export default class BookParser { bodyIndex++; } - if (tag == 'title') { - newParagraph(); - isFirstTitlePara = true; - bold = true; - center = true; - - inTitle = true; - curTitle = {paraIndex, title: '', inset: sectionLevel, bodyIndex, subtitles: []}; - this.contents.push(curTitle); - } - if (tag == 'section') { if (!isFirstSection) newParagraph(); @@ -431,12 +420,24 @@ export default class BookParser { note.noteParaIndex = paraIndex; note.xml = ''; + note.title = ''; noteId = id; } } } + if (tag == 'title') { + newParagraph(); + isFirstTitlePara = true; + bold = true; + center = true; + + inTitle = true; + curTitle = {paraIndex, title: '', inset: sectionLevel, bodyIndex, subtitles: []}; + this.contents.push(curTitle); + } + if (tag == 'emphasis' || tag == 'strong' || tag == 'sup' || tag == 'sub') { growParagraph(`<${tag}>`, 0); } @@ -642,8 +643,12 @@ export default class BookParser { else growParagraph(' ', 1); - if (!inTitle && inNotesBody && noteId) { - this.notes[noteId].xml += text; + if (inNotesBody && noteId) { + if (inTitle) { + this.notes[noteId].title += text; + } else { + this.notes[noteId].xml += text; + } } } };