mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
更新示例
This commit is contained in:
parent
dbf4555f65
commit
b47ffe877a
@ -9,8 +9,12 @@ git clone -b gh-pages https://$GH_TOKEN@github.com/baidu/amis.git gh-pages
|
||||
echo "building"
|
||||
node ./scripts/generate-search-data.js
|
||||
|
||||
npm run build-schemas
|
||||
|
||||
fis3 release gh-pages -c
|
||||
|
||||
cp ./schema.json ./gh-pages
|
||||
|
||||
# 不走 cdn 了
|
||||
# node ./scripts/upload2cdn.js $1 $2
|
||||
|
||||
|
@ -48,12 +48,14 @@ amis 是一个低代码前端框架,它使用 JSON 配置来生成页面,可
|
||||
},
|
||||
"bulkActions": [
|
||||
{
|
||||
"type": "button",
|
||||
"label": "批量删除",
|
||||
"actionType": "ajax",
|
||||
"api": "delete:https://houtai.baidu.com/api/sample/${ids|raw}",
|
||||
"confirmText": "确定要批量删除?"
|
||||
},
|
||||
{
|
||||
"type": "button",
|
||||
"label": "批量修改",
|
||||
"actionType": "dialog",
|
||||
"dialog": {
|
||||
@ -84,7 +86,7 @@ amis 是一个低代码前端框架,它使用 JSON 配置来生成页面,可
|
||||
"filter-toggler",
|
||||
"bulkActions",
|
||||
{
|
||||
"type": "action",
|
||||
"type": "button",
|
||||
"label": "重置测试数据",
|
||||
"actionType": "ajax",
|
||||
"size": "sm",
|
||||
|
@ -227,15 +227,7 @@ export default class PlayGround extends React.Component {
|
||||
'$1'
|
||||
); // 去掉注释
|
||||
|
||||
let host = `${window.location.protocol}//${window.location.host}`;
|
||||
|
||||
// 如果在 gh-pages 里面
|
||||
if (/^\/amis/.test(window.location.pathname)) {
|
||||
host += '/amis';
|
||||
}
|
||||
|
||||
const json = {
|
||||
$schema: `${host}/schema.json#`,
|
||||
...JSON.parse(schemaContent)
|
||||
};
|
||||
|
||||
@ -332,11 +324,61 @@ export default class PlayGround extends React.Component {
|
||||
window.removeEventListener('mousemove', this.handleMouseMove);
|
||||
}
|
||||
|
||||
editorDidMount = (editor, monaco) => {
|
||||
this.editor = editor;
|
||||
this.monaco = monaco;
|
||||
|
||||
let host = `${window.location.protocol}//${window.location.host}`;
|
||||
|
||||
// 如果在 gh-pages 里面
|
||||
if (/^\/amis/.test(window.location.pathname)) {
|
||||
host += '/amis';
|
||||
}
|
||||
|
||||
const schemaUrl = `${host}/schema.json`;
|
||||
|
||||
monaco.languages.json.jsonDefaults.setDiagnosticsOptions({
|
||||
schemas: [
|
||||
{
|
||||
uri: schemaUrl,
|
||||
fileMatch: ['*']
|
||||
}
|
||||
],
|
||||
validate: true,
|
||||
enableSchemaRequest: true,
|
||||
allowComments: true
|
||||
});
|
||||
};
|
||||
|
||||
// editorFactory = (containerElement, monaco, options) => {
|
||||
// this.model = monaco.editor.createModel(
|
||||
// this.state.schemaCode,
|
||||
// 'json',
|
||||
// monaco.Uri.parse(`isuda://schemas/page.json`)
|
||||
// );
|
||||
|
||||
// return monaco.editor.create(containerElement, {
|
||||
// autoIndent: true,
|
||||
// formatOnType: true,
|
||||
// formatOnPaste: true,
|
||||
// selectOnLineNumbers: true,
|
||||
// scrollBeyondLastLine: false,
|
||||
// folding: true,
|
||||
// minimap: {
|
||||
// enabled: false
|
||||
// },
|
||||
// ...options,
|
||||
// model: this.model
|
||||
// });
|
||||
// };
|
||||
|
||||
renderEditor() {
|
||||
return (
|
||||
<CodeEditor
|
||||
value={this.state.schemaCode}
|
||||
onChange={this.handleChange}
|
||||
// editorFactory={this.editorFactory}
|
||||
editorDidMount={this.editorDidMount}
|
||||
language="json"
|
||||
/>
|
||||
);
|
||||
|
1
examples/docs.json
Normal file
1
examples/docs.json
Normal file
File diff suppressed because one or more lines are too long
11
fis-conf.js
11
fis-conf.js
@ -5,7 +5,7 @@ const path = require('path');
|
||||
const fs = require('fs');
|
||||
const package = require('./package.json');
|
||||
const parserMarkdown = require('./scripts/md-parser');
|
||||
fis.get('project.ignore').push('public/**', 'gh-pages/**', '.*/**');
|
||||
fis.get('project.ignore').push('public/**', 'gh-pages/**');
|
||||
// 配置只编译哪些文件。
|
||||
|
||||
const Resource = fis.require('postpackager-loader/lib/resource.js');
|
||||
@ -30,15 +30,18 @@ Resource.extend({
|
||||
});
|
||||
|
||||
fis.set('project.files', [
|
||||
'schema.json',
|
||||
'scss/**.scss',
|
||||
'/examples/*.html',
|
||||
'/examples/*.tpl',
|
||||
'/src/**.html',
|
||||
'mock/**',
|
||||
'schemas/**',
|
||||
'/schema.json'
|
||||
'mock/**'
|
||||
]);
|
||||
|
||||
fis.match('/schema.json', {
|
||||
release: '/$0'
|
||||
});
|
||||
|
||||
fis.match('/mock/**', {
|
||||
useCompile: false
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user