新建文件border和编辑器的高度
This commit is contained in:
parent
202cec92e9
commit
4a5d4ea288
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue