Skip to content

Commit 1eab60f

Browse files
committed
text editor
1 parent 7f3556b commit 1eab60f

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/components/Navbar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function Navbar() {
3737
</Link>
3838
<span className="ml-2 border border-slate-300 bg-slate-100 text-slate-700 text-xs font-semibold px-2 py-1 rounded-full flex items-center gap-1.5">
3939
<Info className="h-3 w-3" />
40-
Beta
40+
Political Unit (EOSG)
4141
</span>
4242
</div>
4343

src/components/RichTextEditor.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ export function RichTextEditor({
123123
return editor.getText().length;
124124
};
125125

126+
const getWordCount = () => {
127+
const text = editor.getText().trim();
128+
if (!text) return 0;
129+
return text.split(/\s+/).length;
130+
};
131+
126132
const handleImageUpload = () => {
127133
fileInputRef.current?.click();
128134
};
@@ -172,7 +178,7 @@ export function RichTextEditor({
172178
};
173179

174180
return (
175-
<div className="space-y-2">
181+
<div>
176182
{/* Toolbar */}
177183
<div className={`rounded-t border p-2 ${
178184
error
@@ -463,7 +469,7 @@ export function RichTextEditor({
463469
</div>
464470

465471
{/* Editor */}
466-
<div className={`rounded-b border ${
472+
<div className={`rounded-b border -mt-1 ${
467473
error
468474
? 'border-t-0 border-red-500 bg-red-50'
469475
: 'border-t-0 border-slate-300 bg-slate-50'
@@ -475,9 +481,9 @@ export function RichTextEditor({
475481
</div>
476482

477483
{/* Character count and error */}
478-
<div className="flex items-start justify-between text-xs">
484+
<div className="flex items-start justify-between text-xs mt-2">
479485
<div className="text-slate-500">
480-
{getCharacterCount()} characters
486+
{getCharacterCount()} characters | {getWordCount()} words
481487
</div>
482488
{error && (
483489
<div className="flex items-center gap-1 text-red-600">

0 commit comments

Comments
 (0)