Skip to content

Commit 7ed799d

Browse files
save file
1 parent 3a74d19 commit 7ed799d

File tree

1 file changed

+57
-42
lines changed

1 file changed

+57
-42
lines changed

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

Lines changed: 57 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,7 @@
8282
https://ext-code-test.com/html-sandbox/html-sandbox.html
8383
-->
8484
<div id=hldr>
85-
<iframe src='https://sandbox-ext-code-com-1024713184986.us-central1.run.app/html-sandbox/html-sandbox.html'
86-
sandbox='allow-scripts allow-same-origin allow-forms allow-downloads allow-pointer-lock allow-popups-to-escape-sandbox'
87-
allow='clipboard-write; clipboard-read; camera; microphone; geolocation; accelerometer; gyroscope; magnetometer; payment; usb; serial; bluetooth;
88-
xr-spatial-tracking; autoplay; encrypted-media; picture-in-picture; screen-wake-lock; web-share'
89-
></iframe>
85+
<iframe></iframe>
9086
<div id=glass></div>
9187
</div>
9288

@@ -134,8 +130,13 @@
134130

135131

136132
var sandbox_url;
137-
138-
133+
var iframe_src = 'https://sandbox-ext-code-com-1024713184986.us-central1.run.app/html-sandbox/html-sandbox.html'
134+
var iframe_sandbox = 'allow-scripts allow-same-origin allow-forms allow-downloads allow-pointer-lock allow-popups-to-escape-sandbox'
135+
var iframe_allow = `clipboard-write; clipboard-read; camera; microphone; geolocation; accelerometer; gyroscope; magnetometer; payment; usb; serial; bluetooth;
136+
xr-spatial-tracking; autoplay; encrypted-media; picture-in-picture; screen-wake-lock; web-share`;
137+
138+
139+
139140
var btn = {};
140141
btn.console = {};
141142
obj.on = {};
@@ -167,10 +168,12 @@
167168

168169
var hdr = $(shadow,'#hdr');
169170

171+
chk.isolate = $.chkbox(hdr,'#isolate');
172+
chk.isolate.checked = window.crossOriginIsolated;
173+
170174
chk['allow-scripts'] = $.chkbox(hdr,'#allow-scripts');
171175
chk['allow-modals'] = $.chkbox(hdr,'#allow-modals');
172176
chk['allow-popups'] = $.chkbox(hdr,'#allow-popups');
173-
chk['isolate'] = $.chkbox(hdr,'#isolate',btn.isolate);
174177

175178
chk['console-show'] = $.chkbox(hdr,'#console-show',btn.console.show);
176179
chk['console-echo'] = $.chkbox(hdr,'#console-echo');
@@ -201,7 +204,7 @@
201204

202205
}//kill
203206

204-
207+
/*
205208
btn.isolate = function(chk){
206209
207210
var url = new URL(sandbox_url);
@@ -213,8 +216,9 @@
213216
}
214217
215218
}//isolate
216-
217-
219+
*/
220+
221+
218222
btn.console.show = function(chk){
219223

220224
if(chk.checked){
@@ -289,44 +293,31 @@
289293
}
290294

291295
var attr = [...tokens].join(' ');
292-
//console.log(attr);
296+
debug(attr);
293297
iframe.setAttribute('sandbox',attr);
294298

295299
}//sandbox
296300

297301

298-
obj.srcdoc = function(html){
299-
300-
iframe.remove();
301-
iframe = iframe.cloneNode();
302-
303-
build.sandbox();
304-
305-
hldr.append(iframe);
306-
307-
308-
if(!chk['console-persist'].checked){
309-
webconsole.clear();
310-
if(chk['console-echo'].checked){
311-
console.clear();
312-
}
313-
}
314-
315-
iframe.srcdoc = html;
316-
317-
}//srcdoc
318-
319-
320302
obj.sandbox = function(html){
321303
debug('sandbox');
322304
iframe.remove();
323305
iframe = iframe.cloneNode();
324306
debug(sandbox_url);
325307
build.sandbox();
326-
iframe.src = sandbox_url;
308+
309+
iframe.setAttribute('allow',iframe_allow);
310+
debug(iframe_allow);
311+
var src = iframe.src;
312+
if(chk.isolate.checked){
313+
src += '?isolate';
314+
}
315+
iframe.src = src;
316+
debug(src);
327317
iframe.onload = onload;
328318
hldr.append(iframe);
329319

320+
330321
function onload(){
331322
debug('onload');
332323
iframe.onload = null;
@@ -341,21 +332,45 @@
341332
var echo = chk['console-echo'].checked;
342333
iframe.contentWindow.postMessage({type:'run',html,echo},'*');
343334

344-
//var blob=new Blob([html],{type:'text/html'});
345-
//var url=URL.createObjectURL(blob);
346-
//iframe.src=url;
347-
348335
}//onload
349336

350337
}//sandbox
351338

352339

353-
obj.blob = function(html){
340+
/*
341+
obj.srcdoc = function(html){
354342
343+
iframe.remove();
344+
iframe = iframe.cloneNode();
345+
346+
build.sandbox();
347+
348+
hldr.append(iframe);
349+
350+
351+
if(!chk['console-persist'].checked){
352+
webconsole.clear();
353+
if(chk['console-echo'].checked){
354+
console.clear();
355+
}
356+
}
357+
358+
iframe.srcdoc = html;
359+
360+
}//srcdoc
361+
*/
362+
363+
364+
/*
365+
obj.blob = function(html){
355366
367+
var blob=new Blob([html],{type:'text/html'});
368+
var url=URL.createObjectURL(blob);
369+
iframe.src=url;
370+
356371
}//blob
357-
358-
372+
*/
373+
359374
obj.kill = function(){return kill()} //d
360375

361376
function kill(){

0 commit comments

Comments
 (0)