[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
1 <html> 2 <head> 3 4 <!-- tinyMCE --> 5 <script language="javascript" type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script> 6 <script language="javascript" type="text/javascript"> 7 tinyMCE.init({ 8 theme : "advanced", 9 //language : "de", 10 mode : "exact", 11 elements : "elm1,elm2", 12 //insertlink_callback : "customInsertLink", 13 //insertimage_callback : "customInsertImage", 14 save_callback : "customSave", 15 content_css : "example_advanced.css", 16 extended_valid_elements : "a[href|target|name]", 17 plugins : "table", 18 theme_advanced_buttons3_add_before : "tablecontrols,separator", 19 //invalid_elements : "a", 20 theme_advanced_styles : "Header 1=header1;Header 2=header2;Header 3=header3;Table Row=tableRow1", // Theme specific setting CSS classes 21 debug : false 22 }); 23 24 // Custom insert link callback, extends the link function 25 function customInsertLink(href, target) { 26 var result = new Array(); 27 28 alert("customInsertLink called href: " + href + " target: " + target); 29 30 result['href'] = "http://www.sourceforge.net"; 31 result['target'] = '_blank'; 32 33 return result; 34 } 35 36 // Custom insert image callback, extends the image function 37 function customInsertImage(src, alt, border, hspace, vspace, width, height, align) { 38 var result = new Array(); 39 40 var debug = "CustomInsertImage called:\n" 41 debug += "src: " + src + "\n"; 42 debug += "alt: " + alt + "\n"; 43 debug += "border: " + border + "\n"; 44 debug += "hspace: " + hspace + "\n"; 45 debug += "vspace: " + vspace + "\n"; 46 debug += "width: " + width + "\n"; 47 debug += "height: " + height + "\n"; 48 debug += "align: " + align + "\n"; 49 alert(debug); 50 51 result['src'] = "logo.jpg"; 52 result['alt'] = "test description"; 53 result['border'] = "2"; 54 result['hspace'] = "5"; 55 result['vspace'] = "5"; 56 result['width'] = width; 57 result['height'] = height; 58 result['align'] = "right"; 59 60 return result; 61 } 62 63 // Custom save callback, gets called when the contents is to be submitted 64 function customSave(id, content) { 65 alert(id + "=" + content); 66 } 67 </script> 68 <!-- /tinyMCE --> 69 70 </head> 71 <body> 72 73 <a href="example_full.htm">[Full featured example]</a> [Advanced example] <a href="example_simple.htm">[Simple example]</a> 74 75 <h3>Advanced example</h3> 76 This page shows a more complex usage of TinyMCE. On this page the mode is set to convert specific elements in this case a DIV element and a TEXTAREA into editor instances. The example below uses a custom CSS, thats why the text is red and it allso uses the "advanced" theme that includes more options than the default one. The code allso includes examples of custom call back functions and much more. Notice the submit button at the end of the page, this button triggers a save action. Read more about the features and possible settings of TinyMCE in the <a href="../docs/index.htm">manual</a>.<br> 77 <br> 78 79 <!-- Form with textare element with width: 100% --> 80 <form method="post" action="http://tinymce.moxiecode.com/dump.php?example=true"> 81 <textarea name="elm1" style="width:100%" rows="15"> 82 <span class="header1">Test header 1</span><br /> 83 <span class="header2">Test header 2</span><br /> 84 <span class="header3">Test header 3</span><br /> 85 Some <b>element</b>, this is to be editor 1. <br /> This editor instance has a 100% width to it. 86 <p>Some paragraph. <a href="http://www.sourceforge.net">Some link</a></p> 87 <img src="logo.jpg"> 88 </textarea> 89 <br> 90 <input type="button" name="save" value="save" onclick="tinyMCE.triggerSave();"> 91 </form> 92 93 <!-- Div elements that gets to be a editor instance aswell --> 94 <div id="elm2" style="width:450px; height:250px"> 95 Some <b>element</b>, this is to be editor 2. <br /> This editor instance is a DIV element instead of a textarea. 96 <p>Some paragraph. <a href="http://www.sourceforge.net">Some link</a></p> 97 <img src="logo.jpg"> 98 </div> 99 100 <br> 101 102 Some custom actions: 103 <a href="javascript:tinyMCE.execCommand('Bold');">[Bold]</a> | 104 <a href="javascript:tinyMCE.execCommand('Italic');">[Italic]</a> 105 <a href="javascript:void(0);" onclick="tinyMCE.execCommand('mceInsertContent',false,'<b>Hello world!!</b>');">[Insert some HTML]</a> 106 <a href="javascript:void(0);" onclick="tinyMCE.execCommand('mceReplaceContent',false,'<b>{$selection}</b>');">[Replace selection]</a> 107 108 <br> 109 110 </body> 111 </html>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |