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) => {
return URL.createObjectURL(blob);
};
const handleWrap = () => {
editorInstance?.current?.updateOptions({ wordWrap: 'on' });
};
/**
* editorDidMount
* @param {editor.IStandaloneCodeEditor} editor
......@@ -200,7 +204,8 @@ const CodeShow = (props: CodeShowFormProps) => {
handleBackBottom,
handleUpScroll,
handleDownScroll,
handleDownloadLog
handleDownloadLog,
handleWrap
};
/**
......
......@@ -22,6 +22,7 @@ import { l } from '@/utils/intl';
import {
CloudDownloadOutlined,
DownCircleFilled,
EnterOutlined,
StopFilled,
SyncOutlined,
UpCircleFilled,
......@@ -48,6 +49,7 @@ type EditFloatBtnProps = {
handleUpScroll?: () => void; // up scroll callback
handleDownScroll?: () => void; // down scroll callback
handleDownloadLog?: () => string; // download log callback
handleWrap?: () => void; // wrap callback
};
const EditorFloatBtn: React.FC<EditFloatBtnProps> = (props) => {
/**
......@@ -65,7 +67,8 @@ const EditorFloatBtn: React.FC<EditFloatBtnProps> = (props) => {
handleBackBottom,
handleUpScroll,
handleDownScroll,
handleDownloadLog
handleDownloadLog,
handleWrap
} = props;
/**
......@@ -121,6 +124,11 @@ const EditorFloatBtn: React.FC<EditFloatBtnProps> = (props) => {
href={handleDownloadLog ? handleDownloadLog() : '123 '}
title={'Download'}
/>
<CircleBtn
icon={<EnterOutlined />}
onClick={() => handleWrap && handleWrap()}
title={l('button.wrap')}
/>
</Space>
</>
);
......
......@@ -79,6 +79,7 @@ export default {
'button.backTop': 'Back Top',
'button.backBottom': 'Back Bottom',
'button.downScroll': 'Down Scroll',
'button.wrap': 'Wrap',
'button.upScroll': 'Up Scroll',
'button.stopRefresh': 'Stop Auto Refresh',
'button.startRefresh': 'Start Auto Refresh(5s/e)',
......
......@@ -79,6 +79,7 @@ export default {
'button.backTop': '返回顶部',
'button.backBottom': '去底部',
'button.downScroll': '向下滚动',
'button.wrap': '换行',
'button.upScroll': '向上滚动',
'button.stopRefresh': '停止自动刷新',
'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