mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 11:58:10 +08:00
更新示例的 schema
This commit is contained in:
parent
8291897ec7
commit
9fe6ea8d68
@ -18,7 +18,6 @@ function loadEditor() {
|
||||
export default function (schema) {
|
||||
if (!schema['$schema']) {
|
||||
schema = {
|
||||
$schema: 'https://houtai.baidu.com/v2/schemas/page.json',
|
||||
...schema
|
||||
};
|
||||
}
|
||||
@ -156,9 +155,25 @@ export default function (schema) {
|
||||
}
|
||||
|
||||
handleEditorMount(editor, 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,
|
||||
validate: true
|
||||
allowComments: true
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user