From cddabbaf0eaf893c1dde3f5eaf6cca11f2e6c3f3 Mon Sep 17 00:00:00 2001 From: whyour Date: Sun, 22 Nov 2026 15:21:37 +0800 Subject: [PATCH] fix: add word wrap to task detail script editor --- src/pages/crontab/detail.tsx | 67 +++++++++++++++++++++++++----------- src/pages/crontab/index.less | 17 +++++++++ 2 files changed, 64 insertions(+), 20 deletions(-) diff --git a/src/pages/crontab/detail.tsx b/src/pages/crontab/detail.tsx index fd1ee984..2cfe40c9 100644 --- a/src/pages/crontab/detail.tsx +++ b/src/pages/crontab/detail.tsx @@ -13,6 +13,8 @@ import { Divider, Typography, Tooltip, + Space, + Switch, } from 'antd'; import { ClockCircleOutlined, @@ -69,6 +71,11 @@ const CronDetailModal = ({ }) => { const [activeTabKey, setActiveTabKey] = useState('runningHistory'); const [value, setValue] = useState(''); + const [wordWrap, setWordWrap] = useState( + () => + (localStorage.getItem('qinglong_editor_word_wrap') ?? + localStorage.getItem('qinglong_config_word_wrap')) === 'true', + ); const [scriptState, setScriptState] = useState< 'loading' | 'ready' | 'failed' >('loading'); @@ -156,6 +163,7 @@ const CronDetailModal = ({ lineNumbersMinChars: 3, glyphMargin: false, accessibilitySupport: 'off', + wordWrap: wordWrap ? 'on' : 'off', }} onMount={(editor, monaco) => { editorRef.current = editor; @@ -519,6 +527,34 @@ const CronDetailModal = ({ } }, [cron]); + const scriptActions = activeTabKey === 'script' && + scriptState === 'ready' && ( + + + {intl.get('自动换行')} + { + setWordWrap(checked); + localStorage.setItem( + 'qinglong_editor_word_wrap', + String(checked), + ); + }} + /> + + + -