Timothy Jaeryang Baek 3 months ago
parent
commit
49e57b6d13

+ 0 - 1
src/lib/components/chat/ChatControls.svelte

@@ -13,7 +13,6 @@
 	import Overview from './Overview.svelte';
 	import EllipsisVertical from '../icons/EllipsisVertical.svelte';
 	import Artifacts from './Artifacts.svelte';
-	import { min } from '@floating-ui/utils';
 
 	export let history;
 	export let models = [];

+ 3 - 1
src/lib/components/common/RichTextInput.svelte

@@ -499,7 +499,9 @@
 				TaskItem.configure({
 					nested: true
 				}),
-				CharacterCount,
+				CharacterCount.configure({
+					mode: 'nodeSize'
+				}),
 				...(autocomplete
 					? [
 							AIAutocompletion.configure({

+ 10 - 2
src/lib/components/notes/NoteEditor.svelte

@@ -104,6 +104,9 @@
 	let files = [];
 	let messages = [];
 
+	let wordCount = 0;
+	let charCount = 0;
+
 	let versionIdx = null;
 	let selectedModelId = null;
 
@@ -878,12 +881,12 @@ Provide the enhanced notes in markdown format. Use markdown syntax for headings,
 								<div class="flex items-center gap-1 px-1">
 									<div>
 										{$i18n.t('{{count}} words', {
-											count: editor.storage.characterCount.words()
+											count: wordCount
 										})}
 									</div>
 									<div>
 										{$i18n.t('{{count}} characters', {
-											count: editor.storage.characterCount.characters()
+											count: charCount
 										})}
 									</div>
 								</div>
@@ -949,6 +952,11 @@ Provide the enhanced notes in markdown format. Use markdown syntax for headings,
 							onChange={(content) => {
 								note.data.content.html = content.html;
 								note.data.content.md = content.md;
+
+								if (editor) {
+									wordCount = editor.storage.characterCount.words();
+									charCount = editor.storage.characterCount.characters();
+								}
 							}}
 						/>
 					</div>