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

This commit is contained in:
Xwite committed 2023-05-09 18:19:45 +08:00
1 parent 1dca4f9395
commit 82c18bddc9
2 files changed
+6 -6

No files matched your search

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