mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-30 10:59:42 +08:00
docs: 文档里的 playground 改成左右布局,减少高度占用,更方便修改配置 (#2928)
This commit is contained in:
parent
e721eb407a
commit
3097c70963
@ -103,6 +103,27 @@ order: 19
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## 编辑器展现控制
|
||||||
|
|
||||||
|
通过 `options` 来控制编辑器展现,比如下面的配置可以关闭行号
|
||||||
|
|
||||||
|
```schema: scope="body"
|
||||||
|
{
|
||||||
|
"type": "form",
|
||||||
|
"api": "/api/mock2/form/saveForm",
|
||||||
|
"body": [
|
||||||
|
{
|
||||||
|
"type": "editor",
|
||||||
|
"name": "editor",
|
||||||
|
"label": "编辑器",
|
||||||
|
"options": {
|
||||||
|
"lineNumbers": "off"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## 属性表
|
## 属性表
|
||||||
|
|
||||||
除了支持 [普通表单项属性表](./formitem#%E5%B1%9E%E6%80%A7%E8%A1%A8) 中的配置以外,还支持下面一些配置
|
除了支持 [普通表单项属性表](./formitem#%E5%B1%9E%E6%80%A7%E8%A1%A8) 中的配置以外,还支持下面一些配置
|
||||||
@ -112,4 +133,4 @@ order: 19
|
|||||||
| language | `string` | `javascript` | 编辑器高亮的语言,支持通过 `${xxx}` 变量获取 |
|
| language | `string` | `javascript` | 编辑器高亮的语言,支持通过 `${xxx}` 变量获取 |
|
||||||
| size | `string` | `md` | 编辑器高度,取值可以是 `md`、`lg`、`xl`、`xxl` |
|
| size | `string` | `md` | 编辑器高度,取值可以是 `md`、`lg`、`xl`、`xxl` |
|
||||||
| allowFullscreen | `boolean` | `false` | 是否显示全屏模式开关 |
|
| allowFullscreen | `boolean` | `false` | 是否显示全屏模式开关 |
|
||||||
| options | `object` | | monaco 编辑器的其它配置,比如是否显示行号等,请参考[这里](https://microsoft.github.io/monaco-editor/api/enums/monaco.editor.editoroption.html),不过无法设置 readOnly,只读模式需要使用 `disabled: true` |
|
| options | `object` | | monaco 编辑器的其它配置,比如是否显示行号等,请参考[这里](https://microsoft.github.io/monaco-editor/api/enums/monaco.editor.EditorOption.html),不过无法设置 readOnly,只读模式需要使用 `disabled: true` |
|
||||||
|
@ -441,6 +441,9 @@ export default class PlayGround extends React.Component {
|
|||||||
<CodeEditor
|
<CodeEditor
|
||||||
value={this.state.schemaCode}
|
value={this.state.schemaCode}
|
||||||
onChange={this.handleChange}
|
onChange={this.handleChange}
|
||||||
|
options={{
|
||||||
|
lineNumbers: 'off'
|
||||||
|
}}
|
||||||
// editorFactory={this.editorFactory}
|
// editorFactory={this.editorFactory}
|
||||||
editorDidMount={this.editorDidMount}
|
editorDidMount={this.editorDidMount}
|
||||||
language="json"
|
language="json"
|
||||||
|
@ -1028,6 +1028,7 @@ body.dark {
|
|||||||
.Playgroud {
|
.Playgroud {
|
||||||
border: 1px solid #ddd;
|
border: 1px solid #ddd;
|
||||||
background: var(--body-bg);
|
background: var(--body-bg);
|
||||||
|
display: flex;
|
||||||
|
|
||||||
body.dark & {
|
body.dark & {
|
||||||
background: #191c22;
|
background: #191c22;
|
||||||
@ -1035,11 +1036,11 @@ body.dark {
|
|||||||
}
|
}
|
||||||
|
|
||||||
&-preview {
|
&-preview {
|
||||||
border-bottom: 1px solid #ddd;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
flex-grow: 1;
|
||||||
|
|
||||||
> div {
|
> div {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
@ -1047,7 +1048,7 @@ body.dark {
|
|||||||
}
|
}
|
||||||
|
|
||||||
&-code {
|
&-code {
|
||||||
flex-shrink: 0;
|
border-left: 1px solid #ddd;
|
||||||
height: 200px;
|
width: 350px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user