enh: note word/char counter

This commit is contained in:
Timothy Jaeryang Baek
2025-07-09 13:38:54 +04:00
parent 6ee4274b3b
commit 3b9f4a6f5e
4 changed files with 38 additions and 1 deletions

View File

@@ -82,6 +82,7 @@
export let id: null | string = null;
let editor = null;
let note = null;
const newNote = {
@@ -872,6 +873,21 @@ Provide the enhanced notes in markdown format. Use markdown syntax for headings,
<span> You </span>
</button>
{#if editor}
<div class="flex items-center gap-1 px-1">
<div>
{$i18n.t('{{count}} words', {
count: editor.storage.characterCount.words()
})}
</div>
<div>
{$i18n.t('{{count}} characters', {
count: editor.storage.characterCount.characters()
})}
</div>
</div>
{/if}
</div>
</div>
@@ -923,6 +939,7 @@ Provide the enhanced notes in markdown format. Use markdown syntax for headings,
<RichTextInput
bind:this={inputElement}
bind:editor
className="input-prose-sm px-0.5"
bind:value={note.data.content.json}
html={note.data?.content?.html}