From 85e7455092508267c95969ba15a789123915bb70 Mon Sep 17 00:00:00 2001 From: Michael An <1822852997@qq.com> Date: Fri, 10 Oct 2025 16:11:58 +0800 Subject: [PATCH] fix shared txt file line wrap --- frontend/src/shared-file-view-text.js | 3 ++- frontend/src/view-file-text.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/shared-file-view-text.js b/frontend/src/shared-file-view-text.js index 9a017814f9..cd40dfd80c 100644 --- a/frontend/src/shared-file-view-text.js +++ b/frontend/src/shared-file-view-text.js @@ -19,10 +19,11 @@ const FileContent = ({ lineWrapping }) => { }; const SharedFileViewText = () => { - let [lineWrapping, setLineWrapping] = useState(localStorage.getItem('sf_txt_file_line_wrapping') === 'true' || true); + let [lineWrapping, setLineWrapping] = useState(localStorage.getItem('sf_txt_file_line_wrapping') !== 'false'); const updateLineWrapping = (newLineWrapping) => { setLineWrapping(newLineWrapping); + localStorage.setItem('sf_txt_file_line_wrapping', newLineWrapping); }; return ( diff --git a/frontend/src/view-file-text.js b/frontend/src/view-file-text.js index ac1a0b6525..319febe197 100644 --- a/frontend/src/view-file-text.js +++ b/frontend/src/view-file-text.js @@ -49,7 +49,7 @@ class ViewFileText extends React.Component { needSave: false, isSaving: false, participants: [], - lineWrapping: localStorage.getItem('sf_txt_file_line_wrapping') === 'true' || true, + lineWrapping: localStorage.getItem('sf_txt_file_line_wrapping') !== 'false', }; this.onSave = this.onSave.bind(this); this.isParticipant = false;