import React from 'react';
import Editor from 'react-monaco-editor';

function Editors({value,onChange,theme,height,visible}){
  const editor_options = {
    lineNumbers: "on",
    wordWrap: true, //强制换行
    selectOnLineNumbers: true,
    lineHeight: 24,
    renderLineHighlight: "line",
    revealHorizontalRightPadding: 5,
    placeholder:"请输入内容",
    readOnly: visible,
    cursorStyle: visible ? "underline-thin" : "line",
    folding: true,
    foldingStrategy: "indentation", // 代码可分小段折叠
    automaticLayout: true, // 自适应布局
    minimap: {
      // 不要小地图
      enabled: false,
    },
  }
  return(
    <Editor
      height={height}
      language={"yml"}
      theme={theme}
      placeholder="请输入内容"
      value={value}
      options={editor_options}
      onChange={(value)=>onChange(value)}
      disabled={true}
    ></Editor>
  )
}
export default Editors;