File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
apps/snow-leopard/components/document Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,9 @@ interface EditorToolbarProps {
4747}
4848
4949export function EditorToolbar ( { activeFormats } : EditorToolbarProps ) {
50+ const view = getActiveEditorView ( ) ;
51+ const textContent = view ?. state . doc . textContent || '' ;
52+ const wordCount = textContent . trim ( ) . split ( / \s + / ) . filter ( Boolean ) . length ;
5053 const buttonClass = ( format : string ) =>
5154 cn (
5255 'h-8 w-8 p-0 flex items-center justify-center rounded-md border border-border bg-background text-foreground' ,
@@ -113,6 +116,7 @@ export function EditorToolbar({ activeFormats }: EditorToolbarProps) {
113116
114117 return (
115118 < div className = "toolbar sticky top-4 z-20 w-full h-[45px] flex items-center gap-2 px-3 py-0 overflow-x-auto whitespace-nowrap rounded-lg bg-background border border-border" >
119+ { /* Toolbar left side */ }
116120 < DropdownMenu >
117121 < DropdownMenuTrigger asChild >
118122 < Button variant = "outline" className = "h-8 px-3 min-w-[7rem] flex items-center justify-between gap-2 text-sm rounded-md border border-border bg-background text-foreground" tabIndex = { 0 } >
@@ -177,6 +181,9 @@ export function EditorToolbar({ activeFormats }: EditorToolbarProps) {
177181 >
178182 < Italic className = "size-5 text-foreground" />
179183 </ ButtonWithTooltip >
184+
185+ < div className = "flex-1" />
186+ < span className = "ml-auto text-xs text-muted-foreground whitespace-nowrap pr-2" > { wordCount } word{ wordCount === 1 ? '' : 's' } </ span >
180187 </ div >
181188 ) ;
182189}
Original file line number Diff line number Diff line change @@ -105,7 +105,6 @@ function PureEditor({
105105 null
106106 ) ;
107107
108- // State refs for update preview handling
109108 const previewOriginalContentRef = useRef < string | null > ( null ) ;
110109 const previewActiveRef = useRef < boolean > ( false ) ;
111110 const lastPreviewContentRef = useRef < string | null > ( null ) ;
You can’t perform that action at this time.
0 commit comments