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";
66
77export class Wiki {
88 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+ ) ;
1219
13- const { header , navigation } = documentationUI . render (
14- this . documentationRenderContainer , { preCacheAllFlags : true }
20+ const documentationRenderContainer = this . documentationRootElement . querySelector (
21+ ".documentation-render-container"
1522 ) ;
23+ for ( const node of documentationRenderContainer . childNodes ) {
24+ node . remove ( ) ;
25+ }
26+ documentationRenderContainer . appendChild ( container ) ;
27+
1628 /** @type {documentationUI.Header } */
1729 this . header = header ;
1830 /** @type {Record<string, documentationUI.Navigation> } */
Original file line number Diff line number Diff line change @@ -47,11 +47,10 @@ const kHeaderMenus = Object.entries(kWikiMenus)
4747
4848/**
4949 * @description Render the documentation module in a given container
50- * @param {!HTMLElement } rootElement
5150 * @param {object } [options]
5251 * @param {boolean } [options.prefetch=false]
5352 */
54- export function render ( rootElement , options = { } ) {
53+ export function render ( options = { } ) {
5554 const { prefetch = false } = options ;
5655
5756 /** @type {Record<string, Navigation> } */
@@ -83,17 +82,13 @@ export function render(rootElement, options = {}) {
8382 }
8483
8584 const header = new Header ( kHeaderMenus , { defaultName : "flags" } ) ;
86- const mainContainer = utils . createDOMElement ( "div" , {
85+ const container = utils . createDOMElement ( "div" , {
8786 className : "documentation--main" ,
8887 childs : [ header . dom , ...containers ]
8988 } ) ;
9089
91- for ( const node of rootElement . childNodes ) {
92- node . remove ( ) ;
93- }
94- rootElement . appendChild ( mainContainer ) ;
95-
9690 return {
91+ container,
9792 header,
9893 navigation
9994 } ;
You can’t perform that action at this time.
0 commit comments