Skip to content

Commit c2483c8

Browse files
save file
1 parent 4872fd8 commit c2483c8

File tree

1 file changed

+55
-5
lines changed

1 file changed

+55
-5
lines changed

html-components/list/web-console/web-console.html

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<script src='https://cdn.jsdelivr.net/npm/wunderbaum@0/dist/wunderbaum.umd.min.js'></script>
3232

3333

34-
<script src='https://libs.ext-code.com/js/dom/component/component.js?init'></script>
34+
<script src='https://libs.ext-code.com/js/dom/component/v2.0/component.js?init'></script>
3535

3636
<script>
3737

@@ -101,7 +101,11 @@
101101
#demo-tree
102102
{margin:50px 0;height:auto !important;border:none !important;overflow:visible;box-sizing:border-box;outline:none}
103103

104+
#view-hdr
105+
{padding:5px 10px;font-weight:bold;}
104106

107+
web-editor
108+
{border:1px solid lightgray;border-radius:5px;padding:10px}
105109
</style>
106110

107111
</head>
@@ -127,9 +131,12 @@ <h3>
127131

128132
</section>
129133

134+
<div id=view-hdr>
135+
</div>
136+
130137
<div id=view style='display:none'>
131138
<snippet-html-console component></snippet-html-console>
132-
<web-editor component></web-editor>
139+
<web-editor component fullsize></web-editor>
133140
</div>
134141

135142

@@ -144,7 +151,7 @@ <h3>
144151
//:
145152

146153

147-
function initdom(){
154+
async function initdom(){
148155
debug('initdom');
149156

150157
var html = md.render(txt);
@@ -160,6 +167,9 @@ <h3>
160167
});
161168

162169

170+
await show.source('latest');
171+
$('#view').style.display = '';
172+
163173
}//initdom
164174

165175

@@ -184,13 +194,53 @@ <h3>
184194
}//depth
185195

186196
var d = depth(e);
187-
console.log(d,e.node.title);
188-
console.log(`Thank you for activating ${e.node}.`);
197+
if(d==1)return;
198+
199+
var par = e.node.parent.title;
200+
var file = e.node.title;
201+
console.log(d,par,file);
202+
switch(par){
189203

204+
case 'source' : show.source(file); break;
205+
case 'examples' : show.example(file); break;
206+
207+
}//switch
190208

191209
}//show
192210

193211

212+
show.source = async function(file){
213+
214+
$('#view-hdr').textContent = 'source : '+file;
215+
$('web-editor').style.display = '';
216+
$('snippet-html-console').style.display = 'none';
217+
218+
var url = 'https://libs.ext-code.com/html/web-console/';
219+
if(file=='latest'){
220+
url += 'web-console.html';
221+
}else{
222+
url += `${file}/web-console-${file}.html`;
223+
}
224+
225+
var {error,txt} = await get(url);
226+
if(error)return;
227+
228+
editor.setvalue(txt);
229+
230+
}//source
231+
232+
233+
show.example = async function(file){
234+
}//example
235+
236+
237+
async function get(url){
238+
239+
var txt = await fetch(url).then(res=>res.text());
240+
return {txt};
241+
}//get
242+
243+
194244
</script>
195245

196246

0 commit comments

Comments
 (0)