From 52faefc67ffef29e3d208d2233c2547fc0ee47d3 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 04 三月 2023 21:11:41 +0800 Subject: [PATCH] 2023-03-04 --- src/templates/zshare/codemirror/index.jsx | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/templates/zshare/codemirror/index.jsx b/src/templates/zshare/codemirror/index.jsx index 24f6872..aa4698f 100644 --- a/src/templates/zshare/codemirror/index.jsx +++ b/src/templates/zshare/codemirror/index.jsx @@ -23,6 +23,7 @@ value: PropTypes.string, // 鍐呭 mode: PropTypes.any, // 鍙�夛紝璇█妯″紡锛岄粯璁や负sql theme: PropTypes.any, // 鍙�夛紝涓婚鏍峰紡 + func: PropTypes.any, // 缂栬緫瀛樺偍杩囩▼ onChange: PropTypes.func // 鍐呭鍙樺寲鏃跺洖璋� } @@ -38,6 +39,8 @@ editor = null UNSAFE_componentWillMount () { + const { func } = this.props + let options = { lineNumbers: true, lineWrapping: true, @@ -50,6 +53,7 @@ } this.setState({ + style: func ? {fontSize: '14px', lineHeight: '25px'} : {fontSize: '18px', lineHeight: '32px'}, value: this.props.value || '', defaultVal: this.props.value || '', options @@ -146,7 +150,7 @@ } render() { - const { mode } = this.props + const { mode, func } = this.props const { defaultVal, options, fullScreen, style, display } = this.state const menu = ( <Menu> @@ -190,11 +194,11 @@ ) return ( - <div className="code-mirror-wrap" style={fullScreen ? style : null}> + <div className="code-mirror-wrap" style={fullScreen || func ? style : null}> {!mode && !fullScreen ? <FormatPainterOutlined onClick={this.handleFormat}/> : null} {!fullScreen ? <FullscreenOutlined onClick={this.fullScreenChange}/> : null} {fullScreen ? <FullscreenExitOutlined onClick={this.fullScreenChange}/> : null} - {fullScreen ? <Dropdown overlay={menu} placement="bottomRight"> + {fullScreen || func ? <Dropdown overlayClassName="mk-mirror-font" overlay={menu} placement="bottomRight"> <FontSizeOutlined /> </Dropdown> : null} {display ? <CodeMirror -- Gitblit v1.8.0