更新示例

This commit is contained in:
liaoxuezhi 2020-09-16 23:41:51 +08:00
parent dbf4555f65
commit b47ffe877a
5 changed files with 65 additions and 13 deletions

View File

@ -9,8 +9,12 @@ git clone -b gh-pages https://$GH_TOKEN@github.com/baidu/amis.git gh-pages
echo "building" echo "building"
node ./scripts/generate-search-data.js node ./scripts/generate-search-data.js
npm run build-schemas
fis3 release gh-pages -c fis3 release gh-pages -c
cp ./schema.json ./gh-pages
# 不走 cdn 了 # 不走 cdn 了
# node ./scripts/upload2cdn.js $1 $2 # node ./scripts/upload2cdn.js $1 $2

View File

@ -48,12 +48,14 @@ amis 是一个低代码前端框架,它使用 JSON 配置来生成页面,可
}, },
"bulkActions": [ "bulkActions": [
{ {
"type": "button",
"label": "批量删除", "label": "批量删除",
"actionType": "ajax", "actionType": "ajax",
"api": "delete:https://houtai.baidu.com/api/sample/${ids|raw}", "api": "delete:https://houtai.baidu.com/api/sample/${ids|raw}",
"confirmText": "确定要批量删除?" "confirmText": "确定要批量删除?"
}, },
{ {
"type": "button",
"label": "批量修改", "label": "批量修改",
"actionType": "dialog", "actionType": "dialog",
"dialog": { "dialog": {
@ -84,7 +86,7 @@ amis 是一个低代码前端框架,它使用 JSON 配置来生成页面,可
"filter-toggler", "filter-toggler",
"bulkActions", "bulkActions",
{ {
"type": "action", "type": "button",
"label": "重置测试数据", "label": "重置测试数据",
"actionType": "ajax", "actionType": "ajax",
"size": "sm", "size": "sm",

View File

@ -227,15 +227,7 @@ export default class PlayGround extends React.Component {
'$1' '$1'
); // ); //
let host = `${window.location.protocol}//${window.location.host}`;
// gh-pages
if (/^\/amis/.test(window.location.pathname)) {
host += '/amis';
}
const json = { const json = {
$schema: `${host}/schema.json#`,
...JSON.parse(schemaContent) ...JSON.parse(schemaContent)
}; };
@ -332,11 +324,61 @@ export default class PlayGround extends React.Component {
window.removeEventListener('mousemove', this.handleMouseMove); 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() { renderEditor() {
return ( return (
<CodeEditor <CodeEditor
value={this.state.schemaCode} value={this.state.schemaCode}
onChange={this.handleChange} onChange={this.handleChange}
// editorFactory={this.editorFactory}
editorDidMount={this.editorDidMount}
language="json" language="json"
/> />
); );

1
examples/docs.json Normal file

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@ const path = require('path');
const fs = require('fs'); const fs = require('fs');
const package = require('./package.json'); const package = require('./package.json');
const parserMarkdown = require('./scripts/md-parser'); 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'); const Resource = fis.require('postpackager-loader/lib/resource.js');
@ -30,15 +30,18 @@ Resource.extend({
}); });
fis.set('project.files', [ fis.set('project.files', [
'schema.json',
'scss/**.scss', 'scss/**.scss',
'/examples/*.html', '/examples/*.html',
'/examples/*.tpl', '/examples/*.tpl',
'/src/**.html', '/src/**.html',
'mock/**', 'mock/**'
'schemas/**',
'/schema.json'
]); ]);
fis.match('/schema.json', {
release: '/$0'
});
fis.match('/mock/**', { fis.match('/mock/**', {
useCompile: false useCompile: false
}); });