add: should be able to remove those comments

This commit is contained in:
Luke Leppan 2023-03-30 01:14:00 +02:00
parent 141c39dbb7
commit 8e7860d510
No known key found for this signature in database
GPG key ID: D35B272CE58AE00A
2 changed files with 10 additions and 1 deletions

View file

@ -10,6 +10,7 @@ import {
getWordCount, getWordCount,
getCitationCount, getCitationCount,
getFootnoteCount, getFootnoteCount,
cleanComments,
} from "../utils/StatUtils"; } from "../utils/StatUtils";
export default class StatsManager { export default class StatsManager {
@ -108,6 +109,9 @@ export default class StatsManager {
} }
public async change(text: string) { public async change(text: string) {
if (this.plugin.settings.countComments) {
text = cleanComments(text);
}
const fileName = this.workspace.getActiveFile().path; const fileName = this.workspace.getActiveFile().path;
const currentWords = getWordCount(text); const currentWords = getWordCount(text);
const currentCharacters = getCharacterCount(text); const currentCharacters = getCharacterCount(text);

View file

@ -7,6 +7,7 @@ import {
getCitationCount, getCitationCount,
getFootnoteCount, getFootnoteCount,
getPageCount, getPageCount,
cleanComments,
} from "src/utils/StatUtils"; } from "src/utils/StatUtils";
import { debounce } from "obsidian"; import { debounce } from "obsidian";
@ -25,7 +26,7 @@ export default class StatusBar {
); );
this.statusBarEl.classList.add("mod-clickable"); this.statusBarEl.classList.add("mod-clickable");
this.statusBarEl.setAttribute("aria-label", "Coming Soon"); this.statusBarEl.setAttribute("aria-label", "!!!");
this.statusBarEl.setAttribute("aria-label-position", "top"); this.statusBarEl.setAttribute("aria-label-position", "top");
this.statusBarEl.addEventListener("click", (ev: MouseEvent) => this.statusBarEl.addEventListener("click", (ev: MouseEvent) =>
this.onClick(ev) this.onClick(ev)
@ -44,6 +45,10 @@ export default class StatusBar {
const sb = this.plugin.settings.statusBar; const sb = this.plugin.settings.statusBar;
let display = ""; let display = "";
if (!this.plugin.settings.countComments) {
text = cleanComments(text);
}
for (let i = 0; i < sb.length; i++) { for (let i = 0; i < sb.length; i++) {
const sbItem = sb[i]; const sbItem = sb[i];