Fix: Add New File Language Api Wrong
This commit is contained in:
parent
537c9ae40a
commit
0e2cc884a7
|
|
@ -1,8 +1,94 @@
|
|||
// import React, { Component } from "react";
|
||||
// import Meditor from "./m_editor";
|
||||
// import "./index.css";
|
||||
// import { Input } from "antd";
|
||||
// import FileLanguage from '../Component/FileLanguage';
|
||||
|
||||
// class Index extends Component {
|
||||
// constructor(props) {
|
||||
// super(props);
|
||||
// this.state = {
|
||||
// editorValue: "",
|
||||
// filename: "",
|
||||
// language: undefined
|
||||
// };
|
||||
// }
|
||||
|
||||
// // 命名文件
|
||||
// changeFileName = (e) => {
|
||||
// this.setState({
|
||||
// filename: e.target.value,
|
||||
// });
|
||||
// };
|
||||
// // 取消,弹框询问
|
||||
// CancelAddFile = () => {
|
||||
// this.props.history.goBack();
|
||||
// };
|
||||
|
||||
// select_language = (e) => {
|
||||
// console.log(e)
|
||||
// this.setState({
|
||||
// language: e
|
||||
// })
|
||||
|
||||
// }
|
||||
|
||||
// render() {
|
||||
// const { pathname } = this.props.location;
|
||||
// const { filename, language } = this.state;
|
||||
// const urlroot = pathname.split("newfile")[1];
|
||||
// const file_path = `${urlroot}/${filename}`;
|
||||
// const { projectDetail } = this.props;
|
||||
|
||||
// return (
|
||||
// <React.Fragment>
|
||||
// <div className="main">
|
||||
// <p className="pb15 bor-bottom-greyE font-16 color-grey-3 mb20">
|
||||
// 新建文件
|
||||
// </p>
|
||||
// <div>
|
||||
// <div className="grid-item mb20">
|
||||
// <div className="grid-item">
|
||||
// <div className="setInputAddon">
|
||||
// <Input
|
||||
// addonBefore={`/${
|
||||
// projectDetail && projectDetail.identifier
|
||||
// }${urlroot}/`}
|
||||
// value={filename}
|
||||
// onChange={this.changeFileName}
|
||||
// placeholder="命名文件..."
|
||||
// />
|
||||
// </div>
|
||||
// <a onClick={this.CancelAddFile} className="color-blue">
|
||||
// 取消
|
||||
// </a>
|
||||
// </div>
|
||||
// <div className="text-right">
|
||||
// <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"
|
||||
// ></Meditor>
|
||||
// </div>
|
||||
// </div>
|
||||
// </React.Fragment>
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
// export default Index;
|
||||
|
||||
import React, { Component } from "react";
|
||||
import Meditor from "./m_editor";
|
||||
import Top from "../Main/DetailTop";
|
||||
import "./index.css";
|
||||
import { Input } from "antd";
|
||||
import FileLanguage from '../Component/FileLanguage';
|
||||
import { Input, Select } from "antd";
|
||||
|
||||
class Index extends Component {
|
||||
constructor(props) {
|
||||
|
|
@ -39,9 +125,62 @@ class Index extends Component {
|
|||
const urlroot = pathname.split("newfile")[1];
|
||||
const file_path = `${urlroot}/${filename}`;
|
||||
const { projectDetail } = this.props;
|
||||
|
||||
const Option = Select.Option;
|
||||
const languages = [
|
||||
"apex",
|
||||
"azcli",
|
||||
"bat",
|
||||
"clojure",
|
||||
"coffee",
|
||||
"cpp",
|
||||
"csharp",
|
||||
"csp",
|
||||
"css",
|
||||
"dockerfile",
|
||||
"fsharp",
|
||||
"go",
|
||||
"handlebars",
|
||||
"html",
|
||||
"ini",
|
||||
"java",
|
||||
"javascript",
|
||||
"json",
|
||||
"less",
|
||||
"lua",
|
||||
"markdown",
|
||||
"msdax",
|
||||
"mysql",
|
||||
"objective",
|
||||
"perl",
|
||||
"pgsql",
|
||||
"php",
|
||||
"postiats",
|
||||
"powerquery",
|
||||
"powershell",
|
||||
"pug",
|
||||
"python",
|
||||
"r",
|
||||
"razor",
|
||||
"redis",
|
||||
"redshift",
|
||||
"ruby",
|
||||
"rust",
|
||||
"sb",
|
||||
"scheme",
|
||||
"scss",
|
||||
"shell",
|
||||
"solidity",
|
||||
"sql",
|
||||
"st",
|
||||
"swift",
|
||||
"typescript",
|
||||
"vb",
|
||||
"xml",
|
||||
"yaml",
|
||||
];
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Top {...this.props} {...this.state} />
|
||||
<div className="main">
|
||||
<p className="pb15 bor-bottom-greyE font-16 color-grey-3 mb20">
|
||||
新建文件
|
||||
|
|
@ -64,7 +203,12 @@ class Index extends Component {
|
|||
</a>
|
||||
</div>
|
||||
<div className="text-right">
|
||||
<FileLanguage language={language} select_language={this.select_language}></FileLanguage>
|
||||
<Select showSearch={true} placeholder={"请选择文本语言"} style={{ width: 200 }} value={language} onChange={this.select_language}>
|
||||
<Option value={undefined}>请选择文本语言</Option>
|
||||
{languages.map((item, key) => {
|
||||
return <Option value={item}>{item}</Option>;
|
||||
})}
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
<Meditor
|
||||
|
|
|
|||
Loading…
Reference in New Issue