File tree Expand file tree Collapse file tree 2 files changed +20
-13
lines changed
workspaces/documentation-ui Expand file tree Collapse file tree 2 files changed +20
-13
lines changed Original file line number Diff line number Diff line change @@ -6,13 +6,25 @@ import { PackageInfo } from "../package/package.js";
6
6
7
7
export class Wiki {
8
8
constructor ( ) {
9
- this . documentationRootElement = document . querySelector ( "#documentation-root-element" ) ;
10
- this . documentationRenderContainer = this . documentationRootElement . querySelector ( ".documentation-render-container" ) ;
11
- this . openButton = this . documentationRootElement . querySelector ( ".open-button" ) ;
9
+ this . documentationRootElement = document . querySelector (
10
+ "#documentation-root-element"
11
+ ) ;
12
+ this . openButton = this . documentationRootElement . querySelector (
13
+ ".open-button"
14
+ ) ;
15
+
16
+ const { container, header, navigation } = documentationUI . render (
17
+ { preCacheAllFlags : true }
18
+ ) ;
12
19
13
- const { header , navigation } = documentationUI . render (
14
- this . documentationRenderContainer , { preCacheAllFlags : true }
20
+ const documentationRenderContainer = this . documentationRootElement . querySelector (
21
+ ".documentation-render-container"
15
22
) ;
23
+ for ( const node of documentationRenderContainer . childNodes ) {
24
+ node . remove ( ) ;
25
+ }
26
+ documentationRenderContainer . appendChild ( container ) ;
27
+
16
28
/** @type {documentationUI.Header } */
17
29
this . header = header ;
18
30
/** @type {Record<string, documentationUI.Navigation> } */
Original file line number Diff line number Diff line change @@ -47,11 +47,10 @@ const kHeaderMenus = Object.entries(kWikiMenus)
47
47
48
48
/**
49
49
* @description Render the documentation module in a given container
50
- * @param {!HTMLElement } rootElement
51
50
* @param {object } [options]
52
51
* @param {boolean } [options.prefetch=false]
53
52
*/
54
- export function render ( rootElement , options = { } ) {
53
+ export function render ( options = { } ) {
55
54
const { prefetch = false } = options ;
56
55
57
56
/** @type {Record<string, Navigation> } */
@@ -83,17 +82,13 @@ export function render(rootElement, options = {}) {
83
82
}
84
83
85
84
const header = new Header ( kHeaderMenus , { defaultName : "flags" } ) ;
86
- const mainContainer = utils . createDOMElement ( "div" , {
85
+ const container = utils . createDOMElement ( "div" , {
87
86
className : "documentation--main" ,
88
87
childs : [ header . dom , ...containers ]
89
88
} ) ;
90
89
91
- for ( const node of rootElement . childNodes ) {
92
- node . remove ( ) ;
93
- }
94
- rootElement . appendChild ( mainContainer ) ;
95
-
96
90
return {
91
+ container,
97
92
header,
98
93
navigation
99
94
} ;
You can’t perform that action at this time.
0 commit comments