diff --git a/index.html b/index.html index fb4dbf6..0a6815a 100644 --- a/index.html +++ b/index.html @@ -2201,21 +2201,7 @@ function highlight(code = `console.log("Here is your code."); var x = 5;`, langu return colorRange } -document.body.addEventListener( "highlighterready", (e) => { - //fetch("colorme.js").then(r=>r.text()).then( page => { addCodeEditor( page ) }) - - fetch( 'colorme.js').then(r=>r.text()).then( src => { - let parts = 5 // can't handle odd splits... - let pl = src.length/parts - for (let n=0; nr.text()).then( page => { addCodeEditor( page, "" ) }) //if (AFRAME.utils.device.checkHeadsetConnected()) AFRAME.scenes[0].enterVR(); //document.querySelector("#snapping-sound").components.sound.playSound(); @@ -2521,7 +2507,7 @@ function addGuttersToTroikaElement( codeEditor ){ function getNumberOfLinesFromCodeEditor(codeEditor){ let newLines = codeEditor.page.match(/\n/g) if (!newLines) return 1 // undefined or 0 - return newLines.length + return newLines.length+1 } // add jxr command on top of the editor e.g "jxr focusCodeEditor()" which would replace keyboard input @@ -2619,6 +2605,17 @@ function addCodeEditor(page="jxr console.log('hello world')", language="javascri return codeEditor } +function addCodeMultipleEditors(parts, src, language, name='splitededitor'){ + let editorParts = [] + let pl = src.length/parts + for (let n=0; nr.text()).then( src => { - let parts = 4 // can't handle odd splits... - let pl = src.length/parts - for (let n=0; nr.text()).then( src => { + addCodeMultipleEditors(2, src, '', name='splitreader') }) + document.body.addEventListener( "highlighterready", (e) => { + //fetch("colorme.js").then(r=>r.text()).then( page => { addCodeEditor( page ) }) + fetch( 'colorme.js').then(r=>r.text()).then( src => { + addCodeMultipleEditors(40, src, 'javascript', name='splitededitor') + }) + }, false); + // should become a component instead //startExperience() //doublePinchToScale()