@@ -27,6 +27,8 @@ import { NoteSyncProvider } from "@/renderer/main/providers/sync-provider";
2727import { YjsSyncPlugin } from "@/renderer/main/components/editor/yjs-sync-plugin" ;
2828import { CodeBlockShortcutPlugin } from "@/renderer/main/components/editor/code-block-plugin" ;
2929import { ChecklistShortcutPlugin } from "@/renderer/main/components/editor/checklist-shortcut-plugin" ;
30+ import { toast } from "sonner" ;
31+ import { useTranslation } from "react-i18next" ;
3032
3133interface NoteEditorProps {
3234 noteId : number ;
@@ -175,13 +177,17 @@ export function NoteEditor({
175177 onSyncStatusChange,
176178 onReady,
177179} : NoteEditorProps ) : React . ReactNode {
180+ const { t } = useTranslation ( ) ;
178181 const [ isLoading , setIsLoading ] = useState ( true ) ;
179182 const [ syncProvider , setSyncProvider ] = useState < NoteSyncProvider | null > (
180183 null ,
181184 ) ;
182185 const providerRef = useRef < NoteSyncProvider | null > ( null ) ;
183186 const destroyQueueRef = useRef < Array < NoteSyncProvider > > ( [ ] ) ;
184187 const onReadyCalledRef = useRef ( false ) ;
188+ const onSaveErrorRef = useRef ( ( ) =>
189+ toast . error ( t ( "settings.notes.toast.saveFailed" ) ) ,
190+ ) ;
185191
186192 // Handle sync status changes and propagate to parent
187193 const handleSyncStatusChange = useCallback (
@@ -196,6 +202,11 @@ export function NoteEditor({
196202 onReadyCalledRef . current = false ;
197203 } , [ noteId ] ) ;
198204
205+ useEffect ( ( ) => {
206+ onSaveErrorRef . current = ( ) =>
207+ toast . error ( t ( "settings.notes.toast.saveFailed" ) ) ;
208+ } , [ t ] ) ;
209+
199210 // Notify parent when editor is ready
200211 useEffect ( ( ) => {
201212 if ( ! isLoading && syncProvider && ! onReadyCalledRef . current ) {
@@ -236,6 +247,7 @@ export function NoteEditor({
236247
237248 const provider = new NoteSyncProvider ( {
238249 noteId,
250+ onSaveError : ( ) => onSaveErrorRef . current ( ) ,
239251 } ) ;
240252
241253 providerRef . current = provider ;
@@ -299,10 +311,10 @@ export function NoteEditor({
299311 contentEditable = {
300312 < ContentEditable
301313 className = "min-h-[500px] px-4 py-2 outline-none text-base leading-relaxed"
302- aria-placeholder = "Start writing your note..."
314+ aria-placeholder = { t ( "settings.notes.note.bodyPlaceholder" ) }
303315 placeholder = {
304316 < div className = "absolute top-2 left-4 text-muted-foreground pointer-events-none" >
305- Start writing your note...
317+ { t ( "settings.notes.note.bodyPlaceholder" ) }
306318 </ div >
307319 }
308320 />
0 commit comments