Unverified Commit 40aa4109 authored by Zzm0809's avatar Zzm0809 Committed by GitHub

[Feature]support codeshow wrap-button (#2924)

* support-code-show-wrap-button * Spotless Apply --------- Co-authored-by: 's avatarZzm0809 <Zzm0809@users.noreply.github.com>
parent 6bfe4663
...@@ -166,6 +166,10 @@ const CodeShow = (props: CodeShowFormProps) => { ...@@ -166,6 +166,10 @@ const CodeShow = (props: CodeShowFormProps) => {
return URL.createObjectURL(blob); return URL.createObjectURL(blob);
}; };
const handleWrap = () => {
editorInstance?.current?.updateOptions({ wordWrap: 'on' });
};
/** /**
* editorDidMount * editorDidMount
* @param {editor.IStandaloneCodeEditor} editor * @param {editor.IStandaloneCodeEditor} editor
...@@ -200,7 +204,8 @@ const CodeShow = (props: CodeShowFormProps) => { ...@@ -200,7 +204,8 @@ const CodeShow = (props: CodeShowFormProps) => {
handleBackBottom, handleBackBottom,
handleUpScroll, handleUpScroll,
handleDownScroll, handleDownScroll,
handleDownloadLog handleDownloadLog,
handleWrap
}; };
/** /**
......
...@@ -22,6 +22,7 @@ import { l } from '@/utils/intl'; ...@@ -22,6 +22,7 @@ import { l } from '@/utils/intl';
import { import {
CloudDownloadOutlined, CloudDownloadOutlined,
DownCircleFilled, DownCircleFilled,
EnterOutlined,
StopFilled, StopFilled,
SyncOutlined, SyncOutlined,
UpCircleFilled, UpCircleFilled,
...@@ -48,6 +49,7 @@ type EditFloatBtnProps = { ...@@ -48,6 +49,7 @@ type EditFloatBtnProps = {
handleUpScroll?: () => void; // up scroll callback handleUpScroll?: () => void; // up scroll callback
handleDownScroll?: () => void; // down scroll callback handleDownScroll?: () => void; // down scroll callback
handleDownloadLog?: () => string; // download log callback handleDownloadLog?: () => string; // download log callback
handleWrap?: () => void; // wrap callback
}; };
const EditorFloatBtn: React.FC<EditFloatBtnProps> = (props) => { const EditorFloatBtn: React.FC<EditFloatBtnProps> = (props) => {
/** /**
...@@ -65,7 +67,8 @@ const EditorFloatBtn: React.FC<EditFloatBtnProps> = (props) => { ...@@ -65,7 +67,8 @@ const EditorFloatBtn: React.FC<EditFloatBtnProps> = (props) => {
handleBackBottom, handleBackBottom,
handleUpScroll, handleUpScroll,
handleDownScroll, handleDownScroll,
handleDownloadLog handleDownloadLog,
handleWrap
} = props; } = props;
/** /**
...@@ -121,6 +124,11 @@ const EditorFloatBtn: React.FC<EditFloatBtnProps> = (props) => { ...@@ -121,6 +124,11 @@ const EditorFloatBtn: React.FC<EditFloatBtnProps> = (props) => {
href={handleDownloadLog ? handleDownloadLog() : '123 '} href={handleDownloadLog ? handleDownloadLog() : '123 '}
title={'Download'} title={'Download'}
/> />
<CircleBtn
icon={<EnterOutlined />}
onClick={() => handleWrap && handleWrap()}
title={l('button.wrap')}
/>
</Space> </Space>
</> </>
); );
......
...@@ -79,6 +79,7 @@ export default { ...@@ -79,6 +79,7 @@ export default {
'button.backTop': 'Back Top', 'button.backTop': 'Back Top',
'button.backBottom': 'Back Bottom', 'button.backBottom': 'Back Bottom',
'button.downScroll': 'Down Scroll', 'button.downScroll': 'Down Scroll',
'button.wrap': 'Wrap',
'button.upScroll': 'Up Scroll', 'button.upScroll': 'Up Scroll',
'button.stopRefresh': 'Stop Auto Refresh', 'button.stopRefresh': 'Stop Auto Refresh',
'button.startRefresh': 'Start Auto Refresh(5s/e)', 'button.startRefresh': 'Start Auto Refresh(5s/e)',
......
...@@ -79,6 +79,7 @@ export default { ...@@ -79,6 +79,7 @@ export default {
'button.backTop': '返回顶部', 'button.backTop': '返回顶部',
'button.backBottom': '去底部', 'button.backBottom': '去底部',
'button.downScroll': '向下滚动', 'button.downScroll': '向下滚动',
'button.wrap': '换行',
'button.upScroll': '向上滚动', 'button.upScroll': '向上滚动',
'button.stopRefresh': '停止自动刷新', 'button.stopRefresh': '停止自动刷新',
'button.startRefresh': '开始自动刷新(5s/次)', 'button.startRefresh': '开始自动刷新(5s/次)',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment