Skip to content

Commit 1412e8e

Browse files
save file
1 parent a826268 commit 1412e8e

File tree

1 file changed

+47
-50
lines changed

1 file changed

+47
-50
lines changed

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

Lines changed: 47 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@
2626
<script src='https://cdn.jsdelivr.net/npm/markdown-it/dist/markdown-it.min.js'></script>
2727
<link rel=stylesheet href='/css/github-markdown-light.css'>
2828

29+
/*
2930
<link rel=stylesheet href='https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css'>
3031
<link rel=stylesheet href='https://cdn.jsdelivr.net/npm/wunderbaum@0/dist/wunderbaum.min.css'>
3132
<script src='https://cdn.jsdelivr.net/npm/wunderbaum@0/dist/wunderbaum.umd.min.js'></script>
32-
33-
33+
*/
34+
35+
3436
<script src='https://libs.ext-code.com/js/dom/component/v2.0/component.js?init'></script>
3537

3638
<script>
@@ -40,6 +42,7 @@
4042

4143
var ace;
4244
var md;
45+
var dirtree;
4346
var snippet;
4447
var editor;
4548
var log;
@@ -52,7 +55,7 @@
5255

5356
await load();
5457

55-
58+
dirtree = mod['dir-tree'];
5659
snippet = mod['snippet-html-console'];
5760
editor = mod['web-editor'];
5861
log = mod['log-mod'];
@@ -160,7 +163,7 @@ <h3>
160163
</span>
161164
</h3>
162165

163-
<div id=demo-tree class='wb-skeleton wb-initializing wb-fade-expander'></div>
166+
<dir-tree component></dir-tree>
164167

165168
</section>
166169

@@ -184,6 +187,10 @@ <h3>
184187
var cache = {};
185188

186189

190+
var callback = {};
191+
var show = {};
192+
193+
187194
//:
188195

189196

@@ -195,15 +202,20 @@ <h3>
195202

196203

197204
var node = $('#demo-tree');
205+
206+
/*
198207
var tree = new mar10.Wunderbaum({
199208
element:node,
200209
source: files,
201210
init:e=>{e.tree.setFocus()},
202211
activate:show
203212
});
213+
*/
214+
files = dirtree.build(files);
215+
dirtree.display(files,{callback});
204216

205217

206-
await show.source('latest');
218+
await show.examples('web-console-v2.0-test-2.html');
207219
$('#view').style.display = '';
208220

209221
}//initdom
@@ -212,32 +224,14 @@ <h3>
212224
//:
213225

214226

215-
function show(e){
227+
callback.file = function(name,o){
216228

217-
var depth = e=>{
218-
219-
var c = 0;
220-
var node = e.node;
221-
while(node.parent){
222-
223-
c++;
224-
node = node.parent;
225-
226-
}//while
227-
return c;
228-
229-
}//depth
230-
231-
var d = depth(e);
232-
if(d==1)return;
233-
234-
var par = e.node.parent.title;
235-
var file = e.node.title;
236-
console.log(d,par,file);
229+
var par = o.parent.name;
230+
console.log(par,name);
237231
switch(par){
238232

239-
case 'source' : show.source(file); break;
240-
case 'examples' : show.example(file); break;
233+
case 'source' : show.source(name); break;
234+
case 'examples' : show.examples(name); break;
241235

242236
}//switch
243237

@@ -264,7 +258,7 @@ <h3>
264258
}//source
265259

266260

267-
show.example = async function(file){
261+
show.examples = async function(file){
268262

269263
$('#view-hdr').textContent = 'example : '+file;
270264
$('web-editor').style.display = 'none';
@@ -273,6 +267,7 @@ <h3>
273267
var url = 'https://libs.ext-code.com/html/web-console/test/'+file;
274268
var {txt} = await get(url);
275269
if(!txt)return;
270+
console.log(1);
276271
snippet.editor.setvalue(txt);
277272

278273
}//example
@@ -320,29 +315,31 @@ <h3>
320315
<script>
321316

322317

323-
324-
325-
var files = [
326-
327-
{
328-
title: 'source',
329-
expanded: true,
330-
children: [
331-
{title:'latest'},
332-
{title:'v2.0'}
333-
],
318+
/*
319+
var data = {
320+
'tmp' : {
321+
'tmp-1' : {
322+
'test.txt':null,
323+
},
324+
'my-file-1.bin':null,
325+
'my-file-2.bin':null,
326+
},
327+
'hello-1.txt':null,
328+
'hello-2.txt':null,
329+
};
330+
*/
331+
332+
333+
var files = {
334+
'source' : {
335+
'latest' : null,
336+
'v2.0' : null,
334337
},
335-
336-
{
337-
title: 'examples',
338-
expanded:true,
339-
children:[
340-
{title:'web-console-v2.0-test-1.html'},
341-
{title:'web-console-v2.0-test-2.html'}
342-
]
338+
'examples' : {
339+
'web-console-v2.0-test-1.html':null,
340+
'web-console-v2.0-test-2.html':null,
343341
},
344-
345-
];
342+
};
346343

347344

348345

0 commit comments

Comments
 (0)