|
290 | 290 |
|
291 | 291 | btn['snippet-editor'] = async function(){ |
292 | 292 |
|
293 | | - var wciframe = await btn.niframe(); |
| 293 | + var node = document.createElement('view-port'); |
| 294 | + node.toggleAttribute('component',true); |
| 295 | + document.body.append(node); |
| 296 | + var mod2 = mod.create({mod,name:'view-port'}); |
| 297 | + var result = await mod.build({root:node,mod:mod2}); |
| 298 | + var viewport = mod2['view-port']; |
| 299 | + await mod2.auto(); |
294 | 300 |
|
295 | 301 | var node = document.createElement('snippet-editor'); |
296 | 302 | node.toggleAttribute('component',true); |
297 | | - //document.body.append(node); |
298 | | - wciframe.iframe.contentDocument.body.append(node); |
| 303 | + viewport.body.append(node); |
299 | 304 | var mod2 = mod.create({mod,name:'snippet-editor'}); |
300 | 305 | var result = await mod.build({root:node,mod:mod2}); |
301 | 306 | var snippet = mod2['snippet-editor']; |
302 | 307 | await mod2.auto(); |
| 308 | + viewport.css('snippet-editor {height:100%}'); |
303 | 309 |
|
304 | 310 |
|
305 | 311 | var node = document.createElement('webcontainer-fs'); |
306 | 312 | node.setAttribute('component','page'); |
307 | | - wciframe.iframe.contentDocument.body.append(node); |
| 313 | + viewport.body.append(node); |
308 | 314 | var mod2 = mod.create({mod,name:'webcontainer-fs'}); |
309 | 315 | var result = await mod.build({root:node,mod:mod2}); |
310 | 316 | var wcfs = mod2['webcontainer-fs']; |
311 | 317 | wcfs.initmod({filemod:snippet.filemod,ext,$,menu,source,webcontainer,log,debug,complete}); |
312 | | - |
313 | 318 | await wcfs.init(); |
314 | 319 | wcfs.initdom(); |
315 | 320 |
|
|
0 commit comments