💄 status

This commit is contained in:
Vanessa 2022-06-28 18:17:43 +08:00
parent e1f6953a42
commit b20c1fec0c
3 changed files with 12 additions and 2 deletions

View File

@ -249,6 +249,7 @@ progressLoading: 400
&__counter {
font-size: 12px;
display: flex;
flex-shrink: 0;
}

View File

@ -133,7 +133,11 @@ 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}`;
document.querySelector("#status .status__counter").innerHTML = `<span class="ft__on-surface">${window.siyuan.languages.runeCount}</span>
&nbsp;${response.data.runeCount}
<span class="fn__space"></span>
<span class="ft__on-surface">${window.siyuan.languages.wordCount}</span>
&nbsp;${response.data.wordCount}<span class="fn__space"></span>`;
});
} else {
document.querySelector("#status .status__counter").innerHTML = "";
@ -146,7 +150,11 @@ 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}`;
document.querySelector("#status .status__counter").innerHTML = `<span class="ft__on-surface">${window.siyuan.languages.runeCount}</span>
&nbsp;${response.data.runeCount}
<span class="fn__space"></span>
<span class="ft__on-surface">${window.siyuan.languages.wordCount}</span>
&nbsp;${response.data.wordCount}<span class="fn__space"></span>`;
});
} else {
document.querySelector("#status .status__counter").innerHTML = "";

View File

@ -823,6 +823,7 @@ export class WYSIWYG {
mouseElement = newMouseElement;
}
hideElements(["select"], protyle);
countBlockWord([]);
let firstElement = document.elementFromPoint(newLeft - 1, newTop);
if (!firstElement) {
return;