fix(web): 字数计算考虑换行符

This commit is contained in:
Xwite
2023-05-09 18:19:18 +08:00
parent 8c730266a7
commit 596ea46916
2 changed files with 6 additions and 6 deletions

View File

@@ -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>