Compare commits

...

3 Commits

Author SHA1 Message Date
dependabot[bot]
7cf7ec7889
Merge 6aa0d9a239 into 0337e465de 2024-06-16 10:41:42 +08:00
Horis
0337e465de 优化 2024-06-14 12:12:08 +08:00
dependabot[bot]
6aa0d9a239
Bump eslint from 8.57.0 to 9.4.0 in /modules/web
Bumps [eslint](https://github.com/eslint/eslint) from 8.57.0 to 9.4.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.57.0...v9.4.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-06-03 04:55:19 +00:00
6 changed files with 9 additions and 14 deletions

View File

@ -188,7 +188,6 @@ class ContentProcessor private constructor(
mContent = mContent.replace('\u00A0', ' ')
}
val contents = arrayListOf<String>()
val paragraphIndent = ReadBookConfig.paragraphIndent
mContent.split("\n").forEach { str ->
val paragraph = str.trim {
it.code <= 0x20 || it == ' '
@ -197,14 +196,10 @@ class ContentProcessor private constructor(
if (contents.isEmpty() && includeTitle) {
contents.add(paragraph)
} else {
contents.add("$paragraphIndent$paragraph")
contents.add("${ReadBookConfig.paragraphIndent}$paragraph")
}
}
}
if (contents.isEmpty()) {
contents.add("${paragraphIndent}加载正文失败")
contents.add("${paragraphIndent}内容处理后为空")
}
return BookContent(sameTitleRemoved, contents, effectiveReplaceRules)
}

View File

@ -218,7 +218,7 @@ abstract class BaseReadAloudService : BaseService(),
}
nowSpeak = textChapter.getParagraphNum(readAloudNumber + 1, readAloudByPage) - 1
if (!readAloudByPage && startPos == 0 && !toLast) {
pos = page.lines.first().chapterPosition -
pos = page.chapterPosition -
textChapter.paragraphs[nowSpeak].chapterPosition
}
if (toLast) {
@ -226,7 +226,7 @@ abstract class BaseReadAloudService : BaseService(),
readAloudNumber = textChapter.getLastParagraphPosition()
nowSpeak = contentList.lastIndex
if (page.paragraphs.size == 1) {
pos = page.lines.first().chapterPosition -
pos = page.chapterPosition -
textChapter.paragraphs[nowSpeak].chapterPosition
}
}

View File

@ -112,7 +112,7 @@ data class TextChapter(
*/
fun getReadLength(pageIndex: Int): Int {
if (pageIndex < 0) return 0
return pages[min(pageIndex, lastIndex)].lines.first().chapterPosition
return pages[min(pageIndex, lastIndex)].chapterPosition
/*
var length = 0
val maxIndex = min(pageIndex, pages.size)
@ -224,14 +224,13 @@ data class TextChapter(
return -1
}
val bIndex = pages.fastBinarySearchBy(charIndex, 0, pageSize) {
it.lines.first().chapterPosition
it.chapterPosition
}
val index = abs(bIndex + 1) - 1
// 判断是否已经排版到 charIndex ,没有则返回 -1
if (!isCompleted && index == pageSize - 1) {
val page = pages[index]
val line = page.lines.first()
val pageEndPos = line.chapterPosition + page.charSize
val pageEndPos = page.chapterPosition + page.charSize
if (charIndex > pageEndPos) {
return -1
}

View File

@ -45,6 +45,7 @@ data class TextPage(
val lines: List<TextLine> get() = textLines
val lineSize: Int get() = textLines.size
val charSize: Int get() = text.length.coerceAtLeast(1)
val chapterPosition: Int get() = textLines.first().chapterPosition
val searchResult = hashSetOf<TextColumn>()
var isMsgPage: Boolean = false
var canvasRecorder = CanvasRecorderFactory.create(true)

View File

@ -177,7 +177,7 @@ class TextChapterLayout(
val contents = bookContent.textList
var absStartX = paddingLeft
var durY = 0f
if (ReadBookConfig.titleMode != 2 || bookChapter.isVolume) {
if (ReadBookConfig.titleMode != 2 || bookChapter.isVolume || contents.isEmpty()) {
//标题非隐藏
displayTitle.splitNotBlank("\n").forEach { text ->
setTypeText(

View File

@ -27,7 +27,7 @@
},
"devDependencies": {
"@vitejs/plugin-vue": "^5.0.4",
"eslint": "^8.40.0",
"eslint": "^9.4.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-vue": "^9.12.0",