@@ -43,86 +43,97 @@ const guideBlock = createComponent<
4343 }
4444 } ,
4545 async render ( element , { environment } ) {
46- if ( element . context . type !== "document" ) {
47- throw new Error ( "Invalid context" ) ;
48- }
49- const { context, state } = element ;
50- const { editable } = context ;
46+ return (
47+ < block >
48+ < webframe
49+ source = { {
50+ url : "https://wolvenkit.github.io/gitbook-debug-guide/" ,
51+ } }
52+ aspectRatio = { 16 / 9 }
53+ />
54+ </ block >
55+ ) ;
5156
52- let parsedContent : Content | null = null ;
53- let error : string | null = null ;
57+ // if (element.context.type !== "document") {
58+ // throw new Error("Invalid context");
59+ // }
60+ // const { context, state } = element;
61+ // const { editable } = context;
5462
55- const result = loadContent ( state . content ) ;
56- if ( typeof result === "string" ) {
57- error = result ;
58- } else {
59- parsedContent = result ;
60- }
63+ // let parsedContent: Content | null = null;
64+ // let error: string | null = null;
6165
62- const historyLength = state . stepHistory . length ;
63- const currentStepName = state . stepHistory [ historyLength - 1 ] ;
64- const step = parsedContent ?. [ currentStepName ] ;
65-
66- const showBack = ! step . hide_back && historyLength > 1 ;
67-
68- element . setCache ( {
69- maxAge : 0 ,
70- } ) ;
71-
72- /// EDITOR
73- const getEditor = ( ) => (
74- < codeblock
75- state = "content"
76- content = { state . content }
77- header = { [ < markdown content = "## Debug Guide" /> ] }
78- syntax = "yaml"
79- onContentChange = { {
80- action : "@editor.node.updateProps" ,
81- props : {
82- content : element . dynamicState ( "content" ) ,
83- } ,
84- } }
85- footer = { [
86- < divider /> ,
87- error ? (
88- < vstack align = "center" >
89- < text style = "code" > { error } </ text >
90- </ vstack >
91- ) : (
92- createGuide ( step , showBack )
93- ) ,
94- ] }
95- />
96- ) ;
66+ // const result = loadContent(state.content);
67+ // if (typeof result === "string") {
68+ // error = result;
69+ // } else {
70+ // parsedContent = result;
71+ // }
72+
73+ // const historyLength = state.stepHistory.length;
74+ // const currentStepName = state.stepHistory[historyLength - 1];
75+ // const step = parsedContent?.[currentStepName];
76+
77+ // const showBack = !step.hide_back && historyLength > 1;
78+
79+ // element.setCache({
80+ // maxAge: 0,
81+ // });
82+
83+ // /// EDITOR
84+ // const getEditor = () => (
85+ // <codeblock
86+ // state="content"
87+ // content={state.content}
88+ // header={[<markdown content="## Debug Guide" />]}
89+ // syntax="yaml"
90+ // onContentChange={{
91+ // action: "@editor.node.updateProps",
92+ // props: {
93+ // content: element.dynamicState("content"),
94+ // },
95+ // }}
96+ // footer={[
97+ // <divider />,
98+ // error ? (
99+ // <vstack align="center">
100+ // <text style="code">{error}</text>
101+ // </vstack>
102+ // ) : (
103+ // createGuide(step, showBack, element.dynamicState("content"))
104+ // ),
105+ // ]}
106+ // />
107+ // );
108+
109+ // // FRONTEND
110+
111+ // // Make sure there is a way to get out of non-existing step (for whatever reason)
112+ // const getGuide = () =>
113+ // step ? (
114+ // createGuide(step, showBack, element.dynamicState("content"))
115+ // ) : (
116+ // <vstack>
117+ // <markdown content="## An error has occurred, please press the button bellow." />
118+ // <button
119+ // label="Reset / Try again"
120+ // onPress={{
121+ // action: "click",
122+ // step: "start",
123+ // }}
124+ // />
125+ // </vstack>
126+ // );
127+
128+ // const getFrontend = () =>
129+ // error ? (
130+ // // Don't show errors to users
131+ // <markdown content="# Error!\nDebug Guide is misconfigured.\nPlease contact authors of this wiki!" />
132+ // ) : (
133+ // getGuide()
134+ // );
97135
98- // FRONTEND
99-
100- // Make sure there is a way to get out of non-existing step (for whatever reason)
101- const getGuide = ( ) =>
102- step ? (
103- createGuide ( step , showBack )
104- ) : (
105- < vstack >
106- < markdown content = "## An error has occurred, please press the button bellow." />
107- < button
108- label = "Reset / Try again"
109- onPress = { {
110- action : "click" ,
111- step : "start" ,
112- } }
113- />
114- </ vstack >
115- ) ;
116-
117- const getFrontend = ( ) =>
118- error ? (
119- // Don't show errors to users
120- < markdown content = "# Error!\nDebug Guide is misconfigured.\nPlease contact authors of this wiki!" />
121- ) : (
122- getGuide ( )
123- ) ;
124-
125- return < block > { editable ? getEditor ( ) : getFrontend ( ) } </ block > ;
136+ // return <block>{editable ? getEditor() : getFrontend()}</block>;
126137 } ,
127138} ) ;
128139
0 commit comments