mirror of
https://github.com/notion-enhancer/notion-enhancer.git
synced 2025-04-10 15:39:01 +00:00
fix(word-counter): #761 count words using chars outside latin alphabet
This commit is contained in:
parent
ec738cd03f
commit
e25f2db188
@ -43,8 +43,8 @@ export default async (api, db) => {
|
|||||||
const updateStats = debounce(() => {
|
const updateStats = debounce(() => {
|
||||||
if (!document.contains($page)) $page = document.querySelector(page);
|
if (!document.contains($page)) $page = document.querySelector(page);
|
||||||
if (!$page) return;
|
if (!$page) return;
|
||||||
const text = $page.innerText,
|
const text = $page.innerText.trim(),
|
||||||
words = text.split(/[^\w]+/).length,
|
words = text.length ? text.split(/\s+/).length : 0,
|
||||||
sentences = text.split(".").filter((s) => s.trim()).length,
|
sentences = text.split(".").filter((s) => s.trim()).length,
|
||||||
blocks = $page.querySelectorAll("[data-block-id]").length;
|
blocks = $page.querySelectorAll("[data-block-id]").length;
|
||||||
$wordCount.setCount(words);
|
$wordCount.setCount(words);
|
||||||
|
Loading…
Reference in New Issue
Block a user