File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 35703570 keyboardFocus = null ;
35713571 _updateTextureDynamic ( ) ;
35723572 } ;
3573- mesh . click = ( intersectionSpec , controllerIndex ) => {
3573+ mesh . click = async ( intersectionSpec , controllerIndex ) => {
35743574 keyboardFocus = null ;
35753575
35763576 const { id, href, name} = intersectionSpec ;
35973597 while ( root . firstChild ) {
35983598 root . removeChild ( root . firstChild ) ;
35993599 }
3600+ } else if ( id === 'action-copy-scene' ) {
3601+ const s = root . outerHTML . replace ( / ^ ( < x r - s i t e ) i d = " r o o t " / , '$1' ) ;
3602+ console . log ( 'copy' , s ) ;
3603+ clipboard . copy ( s ) ;
3604+ } else if ( id === 'action-paste-scene' ) {
3605+ const s = await clipboard . paste ( ) ;
3606+ const dom = new DOMParser ( ) . parseFromString ( s , 'text/html' ) ;
3607+ console . log ( 'paste' , s , dom . body . childNodes [ 0 ] . nodeName ) ;
3608+ if ( dom . body . childNodes . length === 1 && dom . body . childNodes [ 0 ] . nodeName === 'XR-SITE' ) {
3609+ console . log ( 'paste ok' ) ;
3610+ root . innerHTML = dom . body . childNodes [ 0 ] . innerHTML ;
3611+ } else {
3612+ console . log ( 'paste fail' ) ;
3613+ }
36003614 } else if ( href ) {
36013615 const xrIframe = document . createElement ( 'xr-iframe' ) ;
36023616 xrIframe . src = href ;
You can’t perform that action at this time.
0 commit comments