|
@@ -137,11 +137,7 @@ export const countSelectWord = (range: Range) => {
|
|
|
const selectText = range.toString();
|
|
|
if (selectText) {
|
|
|
fetchPost("/api/block/getContentWordCount", {"content": range.toString()}, (response) => {
|
|
|
- document.querySelector("#status .status__counter").innerHTML = `<span class="ft__on-surface">${window.siyuan.languages.runeCount}</span>
|
|
|
- ${response.data.runeCount}
|
|
|
-<span class="fn__space"></span>
|
|
|
-<span class="ft__on-surface">${window.siyuan.languages.wordCount}</span>
|
|
|
- ${response.data.wordCount}<span class="fn__space"></span>`;
|
|
|
+ renderStatusbarCounter(response.data.runeCount, response.data.wordCount);
|
|
|
});
|
|
|
} else {
|
|
|
document.querySelector("#status .status__counter").innerHTML = "";
|
|
@@ -156,11 +152,7 @@ export const countBlockWord = (ids: string[]) => {
|
|
|
}
|
|
|
if (ids.length > 0) {
|
|
|
fetchPost("/api/block/getBlocksWordCount", {ids}, (response) => {
|
|
|
- document.querySelector("#status .status__counter").innerHTML = `<span class="ft__on-surface">${window.siyuan.languages.runeCount}</span>
|
|
|
- ${response.data.runeCount}
|
|
|
-<span class="fn__space"></span>
|
|
|
-<span class="ft__on-surface">${window.siyuan.languages.wordCount}</span>
|
|
|
- ${response.data.wordCount}<span class="fn__space"></span>`;
|
|
|
+ renderStatusbarCounter(response.data.runeCount, response.data.wordCount);
|
|
|
});
|
|
|
} else {
|
|
|
document.querySelector("#status .status__counter").innerHTML = "";
|
|
@@ -168,3 +160,10 @@ export const countBlockWord = (ids: string[]) => {
|
|
|
/// #endif
|
|
|
};
|
|
|
|
|
|
+export const renderStatusbarCounter = (runeCount: number, wordCount: number) => {
|
|
|
+ document.querySelector("#status .status__counter").innerHTML = `<span class="ft__on-surface">${window.siyuan.languages.runeCount}</span>
|
|
|
+ ${runeCount}
|
|
|
+<span class="fn__space"></span>
|
|
|
+<span class="ft__on-surface">${window.siyuan.languages.wordCount}</span>
|
|
|
+ ${wordCount}<span class="fn__space"></span>`;
|
|
|
+}
|