-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Expand file tree
/
Copy pathafter-load.js
More file actions
27 lines (22 loc) · 801 Bytes
/
after-load.js
File metadata and controls
27 lines (22 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const afterLoad = (system) => {
const { editorContentFixturesSelectors, editorActions, EditorContentOrigin } = system;
const definitionUrl =
typeof process.env.REACT_APP_DEFINITION_URL === 'string'
? process.env.REACT_APP_DEFINITION_URL.trim()
: '';
const definitionFile =
typeof process.env.REACT_APP_DEFINITION_FILE === 'string'
? process.env.REACT_APP_DEFINITION_FILE.trim()
: '';
if (definitionUrl) {
editorActions.importUrl(definitionUrl);
return;
}
if (definitionFile) {
editorActions.importUrl(definitionFile);
return;
}
const contentFixture = editorContentFixturesSelectors.selectAsyncAPI260StreetlightsYAML();
editorActions.setContent(contentFixture, EditorContentOrigin.InitialFixtureLoad);
};
export default afterLoad;