Skip to content

Commit 0add6c3

Browse files
save file
1 parent 9b606b3 commit 0add6c3

File tree

1 file changed

+47
-2
lines changed

1 file changed

+47
-2
lines changed

utils/editors/html-editor/html/output-html/v2.0/output-html-v2.0.html

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,20 @@
3939
</span>
4040

4141
<div style='flex:1'></div>
42+
43+
<span id=console-show class=radio>
44+
<input type=checkbox checked>
45+
console
46+
</span>
47+
<span id=console-echo class=radio>
48+
<input type=checkbox checked>
49+
echo
50+
</span>
51+
<span id=console-persist class=radio>
52+
<input type=checkbox checked>
53+
persist
54+
</span>
55+
4256
<button id=kill style='margin-right:20px'>kill</button>
4357
</div>
4458

@@ -126,10 +140,15 @@
126140

127141

128142
var hdr = $(shadow,'#hdr');
143+
129144
chk['allow-scripts'] = $.chkbox(hdr,'#allow-scripts');
130145
chk['allow-modals'] = $.chkbox(hdr,'#allow-modals');
131146
chk['allow-popups'] = $.chkbox(hdr,'#allow-popups');
132147

148+
chk['console-show'] = $.chkbox(hdr,'#console-show',btn.show_console);
149+
chk['console-echo'] = $.chkbox(hdr,'#console-echo');
150+
chk['console-persist'] = $.chkbox(hdr,'#console-persist');
151+
133152
$(hdr,'#kill').onclick = btn.kill;
134153

135154

@@ -152,6 +171,15 @@
152171
}//kill
153172

154173

174+
btn.show_console = function(chk){
175+
176+
console.log(chk);
177+
178+
//webconsole.host.s
179+
180+
}//show_console
181+
182+
155183
obj.glass = function(show=true){
156184

157185
var display = 'none';
@@ -180,7 +208,7 @@
180208

181209

182210

183-
obj.srcdoc = function(html){
211+
build.sandbox = function(){
184212

185213
var attr = def_sandbox;
186214
//console.log(attr);
@@ -200,14 +228,31 @@
200228
//console.log(attr);
201229
iframe.setAttribute('sandbox',attr);
202230

231+
}//sandbox
232+
233+
234+
obj.srcdoc = function(html){
235+
236+
build.sandbox();
237+
238+
if(!chk['console-persist'].checked){
239+
console.clear();
240+
}
241+
203242
iframe.srcdoc = html;
204243

205244
}//srcdoc
206245

207246

208247
obj.sandbox = function(html){
209248
debug('sandbox');
210-
iframe.contentWindow.postMessage({type:'run',html},'*');
249+
build.sandbox();
250+
251+
if(!chk['console-persist'].checked){
252+
console.clear();
253+
}
254+
var echo = chk['console-echo'].checked;
255+
iframe.contentWindow.postMessage({type:'run',html,echo},'*');
211256

212257
}//sandbox
213258

0 commit comments

Comments
 (0)