From ac890fd996cde9a4afa545434cf9ebfec0c22a80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Padez?= Date: Sun, 23 Aug 2026 14:18:26 +0000 Subject: [PATCH] code editor panel keyed (528 -> 516) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 'editor buffer changed while unfocused' Error stays English — it is the trap marker for docs/editor-buffer-corruption.md, read from a log rather than a screen. --- .../src/apps/CodeEditor/CodeEditor.tsx | 16 +++++++++------- .../src/apps/CodeEditor/CodeEditorHeader.tsx | 4 +++- .../src/apps/CodeEditor/EditorTabs.tsx | 4 +++- .../officerdev/src/apps/CodeEditor/FileTree.tsx | 6 ++++-- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/workspaces/officerdev/src/apps/CodeEditor/CodeEditor.tsx b/src/workspaces/officerdev/src/apps/CodeEditor/CodeEditor.tsx index 053244c0..f8cb285b 100644 --- a/src/workspaces/officerdev/src/apps/CodeEditor/CodeEditor.tsx +++ b/src/workspaces/officerdev/src/apps/CodeEditor/CodeEditor.tsx @@ -13,6 +13,7 @@ import { useFilesRefresh } from '../../channels'; import { useWorkspace } from '../../components/Workspace'; import { useEditorTabs } from './use-editor-tabs'; import { configureMonacoTypescript } from './monaco-setup'; +import { useTranslation } from '../../locales'; type CodeEditorViewProps = { className?: string; @@ -103,6 +104,7 @@ export const CodeEditorView = ({ urlState, panelId, }: CodeEditorViewProps) => { + const { t } = useTranslation(); const { workspace } = useWorkspace(); const { restored, remember } = useEditorTabs(panelId, workspace); const { @@ -138,7 +140,7 @@ export const CodeEditorView = ({ const res = await readFile(path); openFile(path, name, res.content); } catch { - toast.error('Failed to read file'); + toast.error(t('codeEditor.readFailed')); } }; @@ -159,7 +161,7 @@ export const CodeEditorView = ({ .then((res) => alive && openFile(path, path.split('/').pop() ?? path, res.content)) .catch(() => { unreadable.current.add(path); - if (alive) toast.error('Failed to read file'); + if (alive) toast.error(t('codeEditor.readFailed')); }); return () => { alive = false; @@ -273,9 +275,9 @@ export const CodeEditorView = ({ try { await writeFile(activeFile.path, activeFile.content); markSaved(activeFile.path, activeFile.content); - toast.success('File saved'); + toast.success(t('codeEditor.saved')); } catch { - toast.error('Failed to save file'); + toast.error(t('codeEditor.saveFailed')); } }; @@ -322,10 +324,10 @@ export const CodeEditorView = ({ className="px-3 py-2 text-xs font-semibold uppercase tracking-wider flex items-center justify-between gap-2" style={{ color: '#888', borderBottom: `1px solid ${borderColor}` }} > - Explorer + {t('codeEditor.explorer')}