新建文件border和编辑器的高度

This commit is contained in:
caishi 2021-10-08 18:33:12 +08:00
parent 202cec92e9
commit 4a5d4ea288
3 changed files with 48 additions and 42 deletions

View File

@ -65,16 +65,18 @@ class Index extends Component {
<FileLanguage language={language} select_language={this.select_language}></FileLanguage>
</div>
</div>
<Meditor
{...this.props}
{...this.state}
filepath={`${file_path}`}
language = {language}
content={undefined}
readOnly={false}
editorType="new"
descName={filename && `Add ${filename}`}
></Meditor>
<div className="editorBorder">
<Meditor
{...this.props}
{...this.state}
filepath={`${file_path}`}
language = {language}
content={undefined}
readOnly={false}
editorType="new"
descName={filename && `Add ${filename}`}
></Meditor>
</div>
</div>
</div>
</React.Fragment>

View File

@ -8,7 +8,13 @@
border: 1px solid #d9d9d9!important;
border-right: none!important;
}
.editorBorder .editorBorderBox{
border:1px solid #eee;
border-radius: 2px;
}
.editorBorder .editorBorderSubmitBox{
padding:20px 0px!important;
}
.userScrew{
margin:20px 0px;
border:1px solid #f4f4f4;

View File

@ -69,10 +69,12 @@ class m_editor extends Component {
);
const lineCount = editor.getModel().getLineCount() || 1;
const height =
let height =
editor.getTopForLineNumber(lineCount + 1) +
lineHeight +
padding;
padding ;
if(height<400){height = 400;}
if (this.state.prevHeight !== height) {
this.setState({
@ -89,36 +91,32 @@ class m_editor extends Component {
return (
<React.Fragment>
<div>
<div className="">
<Editor
language={language ? language : "plaintext"}
theme={"vs-grey"}
placeholder="请输入内容"
value={editorValue}
options={editor_options}
onChange={this.changeEditor}
editorWillMount={this.editorWillMount}
editorDidMount={handleEditorMount}
/>
</div>
{!readOnly && (
<div style={{marginTop:"20px",padding:"20px"}}>
<UserSubmitComponent
{...this.props}
{...this.state}
filepath={`${this.props.filepath}`}
content={editorValue}
editor_type={editorType}
currentBranch={currentBranch}
descName={descName}
></UserSubmitComponent>
</div>
)}
</div>
<div className="editorBorderBox">
<Editor
language={language ? language : "plaintext"}
theme={"vs-grey"}
placeholder="请输入内容"
value={editorValue}
options={editor_options}
onChange={this.changeEditor}
editorWillMount={this.editorWillMount}
editorDidMount={handleEditorMount}
/>
</div>
{!readOnly && (
<div className="editorBorderSubmitBox" style={{marginTop:"20px",padding:"20px"}}>
<UserSubmitComponent
{...this.props}
{...this.state}
filepath={`${this.props.filepath}`}
content={editorValue}
editor_type={editorType}
currentBranch={currentBranch}
descName={descName}
></UserSubmitComponent>
</div>
)}
</React.Fragment>
);
}