Skip to content

Commit 85f7bc2

Browse files
save file
1 parent 1bfcd9c commit 85f7bc2

File tree

1 file changed

+55
-25
lines changed

1 file changed

+55
-25
lines changed

utils/editors/js-console/v2.0/js-console-v2.0.html

Lines changed: 55 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11

22

3+
<!-- headers
4+
cross-origin-isolate
5+
-->
6+
7+
38
<!DOCTYPE html>
49

510
<html lang=en>
@@ -62,12 +67,14 @@
6267
var menumod;
6368
var keydown;
6469
var debug;
70+
var ls;
6571

6672
var menu;
6773

6874
var hdr;
6975
var mainmenu;
7076
var filemod;
77+
var autosave;
7178
var publish;
7279
var editor;
7380
var output;
@@ -83,12 +90,13 @@
8390
menu = menumod();
8491

8592

86-
mod.base.add({ext,$,datatype,keydown,menu,menumod,ace});
93+
mod.base.add({ext,$,datatype,keydown,menu,menumod,ace,ls});
8794

8895

8996
hdr = mod['editors-hdr'];
9097
mainmenu = mod['main-menu'];
9198
filemod = mod['file-mod'];
99+
autosave = mod['auto-save'];
92100
publish = mod['publish-ui'];
93101
editor = mod['web-editor'];
94102
output = mod['output-console']
@@ -100,6 +108,7 @@
100108
hdr.initmod({ext,$,menu});
101109
mainmenu.initmod({ext,$,menu,editor,filemod});
102110
filemod.initmod({ext,$,menu,menumod,complete,source,focus,log});
111+
autosave.initmod({$,menu,keydown,log,save:btn.save});
103112
publish.initmod({ext,$,ui,menu,source,complete,log});
104113
editor.initmod({ext,$,menu,ace,on});
105114
output.initmod({ext,$});
@@ -109,6 +118,7 @@
109118
mainmenu.init(),
110119
hdr.init(),
111120
filemod.init(),
121+
autosave.init(),
112122
publish.init(),
113123
editor.init(),
114124
output.init(),
@@ -118,6 +128,7 @@
118128

119129
//:
120130

131+
121132
icon.def = $('[rel*=icon]').href;
122133

123134
window.onfocus = ()=>editor && editor.focus();
@@ -140,14 +151,19 @@
140151

141152
({ext} = await import('https://libs.ext-code.com/js/io/ext-loader/ext-loader.m.js'));
142153

154+
var lsmod;
155+
143156
var promise = ext.load.libs(
144157
'js/dom/$.js',
145158
'js/core/datatype.js',
146159
'js/dom/menumod/menumod.js',
147160
'js/dom/keydown/keydown.js',
148-
'js/debug/debug.js'
161+
'js/debug/debug.js',
162+
'js/core/ls-mod/ls-mod.js',
149163
);
150-
[$,datatype,menumod,keydown,debug] = await promise;
164+
[$,datatype,menumod,keydown,debug,lsmod] = await promise;
165+
166+
ls = lsmod();
151167

152168
mod.stack.complete;
153169

@@ -250,12 +266,15 @@
250266

251267
<div id=save-root>
252268
<button id=save>save</button>
269+
<auto-save v2.0 component=grp></auto-save>
270+
<!--
253271
<checkbox-one id=autosave></checkbox-one>
254272
<div id=save-menu-root class=menu-root>
255273
<img id=save-menu-icon class=menu-icon>
256274
<div id=save-menu class=menu style='display:none'>
257275
</div>
258276
</div>
277+
-->
259278
</div>
260279

261280
<publish-ui component></publish-ui>
@@ -303,12 +322,13 @@
303322

304323

305324

306-
325+
<!--
307326
<checkbox-one-template>
308327
<script src='https://html-loader-1024713184986.us-central1.run.app/'></script>
309328
</checkbox-one-template>
310-
311-
329+
-->
330+
331+
312332
</body>
313333

314334

@@ -317,7 +337,7 @@
317337

318338
var root;
319339

320-
var autosave;
340+
//var autosave;
321341

322342
var iframe;
323343

@@ -345,28 +365,21 @@
345365
menu.add.style();
346366

347367

348-
hdr.initdom();
349-
350-
351-
mainmenu.initdom(root);
352-
353-
filemod.initdom(root);
354-
355-
356368
$(root,'#save').onclick = btn.save;
357369

358-
var card = $(root,'#save-root .menu');
359-
$(root,'.menu-icon').onclick = menu.click(card,false,false);
370+
//var card = $(root,'#save-root .menu');
371+
//$(root,'.menu-icon').onclick = menu.click(card,false,false);
372+
360373

361-
autosave = $(root,'#autosave');
362-
autosave.checked = false;
374+
//autosave = $(root,'#autosave');
375+
//autosave.checked = false;
363376

364377

365-
publish.initdom(root);
366378

367379
$(root,'#run').onclick = run;
368380
mode.iframe = $(root,'#iframe');
369381
mode.async = $(root,'#async');
382+
370383
$(root,'#syntax-chk').onclick = btn.syntax;
371384
$(root,'#prettier').onclick = btn.prettier;
372385
$(root,'#terser').onclick = btn.terser;
@@ -380,23 +393,33 @@
380393
var view = $('#view');
381394
ui.root = view;
382395

383-
editor.initdom(view,{mode:'javascript'});
384396

385397
slider.node = $.slider('web-editor','#page-slider','output-console',slider,ui);
386-
output.initdom(root);
387398

388399

389-
log.initdom();
400+
await Promise.all([
401+
hdr.initdom(),
402+
mainmenu.initdom(root),
403+
filemod.initdom(root),
404+
autosave.initdom(),
405+
publish.initdom(root),
406+
editor.initdom(view,{mode:'javascript'}),
407+
output.initdom(root),
408+
log.initdom(),
409+
]);
390410

391411

392412

393413
//ui.setup(view);
394414

415+
416+
395417
publish.query();
396418
editor.focus();
397419

398420
query();
399421

422+
400423
}//initdom
401424

402425

@@ -605,6 +628,11 @@
605628
function source(){
606629

607630
var txt = editor.getValue();
631+
632+
if(autosave.trim.checked){
633+
txt = autosave.txt.trim(txt);
634+
}
635+
608636
var blob = new Blob([txt]);
609637
return blob;
610638

@@ -658,6 +686,7 @@
658686
//:
659687

660688

689+
/*
661690
window.onmessage = function(e){
662691
663692
var err;
@@ -685,8 +714,9 @@
685714
}
686715
687716
}//onmessage
688-
689-
717+
*/
718+
719+
690720
//:
691721

692722

0 commit comments

Comments
 (0)