mirror of
https://github.com/gedoor/legado.git
synced 2025-08-10 00:52:30 +00:00
fix(web): 字数计算考虑换行符
This commit is contained in:
@@ -41,9 +41,8 @@ const calculateWordCount = (paragraph) => {
|
||||
const imgPattern = /<img[^>]*src="[^"]*(?:"[^>]+\})?"[^>]*>/g;
|
||||
//内嵌图片文字为1
|
||||
const imagePlaceHolder = " ";
|
||||
return paragraph.trim().replaceAll(imgPattern, imagePlaceHolder).length;
|
||||
return paragraph.replaceAll(imgPattern, imagePlaceHolder).length;
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
Reference in New Issue
Block a user