更新示例的 schema

This commit is contained in:
liaoxuezhi 2020-09-30 13:47:25 +08:00
parent 8291897ec7
commit 9fe6ea8d68

View File

@ -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
});
}