-
Notifications
You must be signed in to change notification settings - Fork 0
/
Editor.htm
228 lines (213 loc) · 5.85 KB
/
Editor.htm
1
<!DOCTYPE HTML><html><head> <title>L'éditeur</title> <link rel="stylesheet" type="text/css" href="src/css/styles.css"> <link rel="stylesheet" type="text/css" href="src/css/syntaxes.css"> <link rel="stylesheet" type="text/css" href="src/stats.css"> <link rel="stylesheet" type="text/css" href="src/toc.css"> <style>#eEditeur { height: 350px; width: 100%; }#eGraphiques { float: left; margin: 1em 0; }.diagram IMG { border: none; float: left; height: auto !important; width: 19.5% !important; }.benchmark { width: 50%; }.replacements > TD > DIV,.replacements > TD > PRE { background:lime; margin:0; } </style></head><body spellcheck="false"><a href="./index.htm">index</a><h1> L'éditeur</h1><div><h2>Objectif</h2> <ul> <li>Editer ou juste afficher un ou plusieurs documents avec coloration lexicales.</li> <li>Remplacer un élément html : <code>Editor.replaceElement( e )</code></li> </ul> <table> <tr class="replacements"> <th>textarea</th> <td><textarea id="eTest1" class="JS">str_replace =function( A1, A2, m ){ return m[ m.constructor==Array ? 'replace' : 'str_replace' ]( A1, A2 ) }</textarea><textarea wrap="off">str_replace =function( A1, A2, m ){ return m[ m.constructor==Array ? 'replace' : 'str_replace' ]( A1, A2 ) }</textarea> </td> </tr> <tr class="replacements"> <th>pre</th> <td><pre id="eTest2" class="JS">str_replace =function( A1, A2, m ){ return m[ m.constructor==Array ? 'replace' : 'str_replace' ]( A1, A2 ) }</pre><pre>str_replace =function( A1, A2, m ){ return m[ m.constructor==Array ? 'replace' : 'str_replace' ]( A1, A2 ) }</pre> </td> </tr> <tr class="replacements"> <th>div <!-- --></th> <td><div id="eTest3" class="JS" style="height: 50px;"><!--str_replace =function( A1, A2, m ){ return m[ m.constructor==Array ? 'replace' : 'str_replace' ]( A1, A2 ) }--></div> </td> </tr> </table></div><div><h2>Aperçu</h2> <ol> <li>Cliquez dans l'éditeur. <li>Essayez le raccourcie <kbd>ALT+W</kbd>. <li>Cliquez sur le bouton "Editeur". <li>Cochez la case "Barre menu". </ol> <div id="eEditeur"></div> <div class="benchmark"> <h3>Statistiques Editor.prototype</h3> <div id="eStats1" class="stats"></div> </div> <div class="benchmark"> <h3>Statistiques Editor</h3> <div id="eStats2" class="stats"></div> </div> <div style="clear:left;"></div></div><div><h2>Diagrammes 'UML'</h2> <div id="eGraphiques"></div> <img src="diagram/Class.Editor.gif"></div><div id="eContents"><!--/* 1 - JavaScript syntax */ var n = nInt1/4 + 4/nInt1 + 10 var oEditor = new EditorSample ( eContent ,{ // a single line comment ( a single quote ' ) aArray : [ true , false , null , undefined , Infinity , NaN ], sDoubleQuoteString : "/* a multi line comment */ // a single line comment " , sSingleQuoteString : '/* a multi line comment */ // a single line comment ' sBracketsTest1_1 : "{[(", sBracketsTest1_2 : "}])", /* a multi line comment ( a double quote " ) */ }) RegExp.extend({ escape :function( s ){ // Bracket test 2 var re1 = /(\.|\?|\*|\+|\\|\(|\)|\[|\]|\}|\{|\$|\^|\|)/g , re2 = /("|')/gm return s.replace( re1 , "\\$1" ) } })/* 2 - PHP */ <?php function phpSafe ( $strText ){ // a single line comment ( a double quote ") $tmpString = $strText ; $tmpString = str_replace( chr(92) , "" , $tmpString ); return rawurldecode( $tmpString ); } /* a multi line comment ( a single quote ) */ $hiddencontent = phpSafe( $_POST[ 'content' ]); ?>--></div><script src="shared.js"></script><script src="src/js/Editor.js"></script><script src="src/js/Commands.js"></script><script src="src/js/KeyBoard.js"></script><!-- <script src="src/js/Selection.js"></script> --><script src="src/js/Syntax.js"></script><script src="src/js/CommandsDesc.js"></script><script src="src/stats.js"></script><script type="text/JavaScript">_( 'eEditeur,eContents,eDocName' )if( _( 'eTest1' )) Editor.replaceElement( eTest1 )if( _( 'eTest2' )) Editor.replaceElement( eTest2 )if( _( 'eTest3' )) Editor.replaceElement( eTest3 )BenchmarkFunctions( _('eStats1'), Editor.prototype, 'dialog,execCommand,mapDocuments,newDoc,rename,resizeTo,setDocActive,'+ 'focus,blur,getLine,placeHandle,setAttribute,getContents,setContents' )BenchmarkFunctions( _('eStats2'), Editor, 'addModule,loadModules,loadFile,mapDocuments,mapEditors,extend,addStrategy,'+ 'getUniqueId,addInHistory' // Méthode spéciale : insertTextFromTextarea ) var oEditor = new Editor ( eEditeur, { sSyntax: 'JS', bTopMenu:0, bContentEditable:0, sTopMenu :'DOCUMENT_NEW,DOCUMENT_SAVE,|,FULLSCREEN,|,UNDO,REDO,|,SHOW_INVISIBLES,|,ZOOM_IN,ZOOM_OUT,|,DIALOGS' })oEditor.newDoc( 'chemin/test/test.js', eContents.firstChild.data )oEditor.newDoc( 'chemin/test/test.css', 'BODY.fullscreen {\r\n\ overflow: hidden !important;\r\n\ position: relative;\r\n\ }' )oEditor.newDoc( 'chemin/test/index.html', [ '<html>', ' <head>', ' <title></title>', ' <style>', ' </style>', ' </head>', ' <body class="fullscreen">', ' <script>', ' </'+'script>', ' </body>', '</html>' ].join('\r') )var D = oEditor.oActiveDocumentD.oCaret.setIndex( 24 )D.write( 'Hello World !' ) //, function(){ alert('voilà !')} )</script><script>var eGraphiques = document.getElementById( 'eGraphiques' )var aGraph =[ [ 'GrapheUML' , 'Diagramme de classes' ], [ 'graphCaretInsertion' , 'Insertion au curseur' ], [ 'graphSelectionReplacement' , 'Remplacement du texte sélectionné' ] ]for(var i=0, ni=aGraph.length; i<ni; i++ ){ var eA = document.createElement('A') eA.href = 'diagram/'+ aGraph[i][0] +'.html' eA.className = 'diagram' eA.title = aGraph[i][1] var eIMG = document.createElement('IMG') eIMG.src = 'diagram/'+ aGraph[i][0] +'_1_1.png' eA.appendChild( eIMG ) eGraphiques.appendChild( eA ) }</script> <script src="src/toc.js"></script> <script>setTOC("Editor.htm")</script></body></html>