mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-12 17:50:42 +01:00
17710c20ab
see tinymce.moxiecode.com/ for more info
111 lines
4.1 KiB
HTML
111 lines
4.1 KiB
HTML
<html>
|
|
<head>
|
|
|
|
<!-- tinyMCE -->
|
|
<script language="javascript" type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script>
|
|
<script language="javascript" type="text/javascript">
|
|
tinyMCE.init({
|
|
theme : "advanced",
|
|
//language : "de",
|
|
mode : "exact",
|
|
elements : "elm1,elm2",
|
|
//insertlink_callback : "customInsertLink",
|
|
//insertimage_callback : "customInsertImage",
|
|
save_callback : "customSave",
|
|
content_css : "example_advanced.css",
|
|
extended_valid_elements : "a[href|target|name]",
|
|
plugins : "table",
|
|
theme_advanced_buttons3_add_before : "tablecontrols,separator",
|
|
//invalid_elements : "a",
|
|
theme_advanced_styles : "Header 1=header1;Header 2=header2;Header 3=header3;Table Row=tableRow1", // Theme specific setting CSS classes
|
|
debug : false
|
|
});
|
|
|
|
// Custom insert link callback, extends the link function
|
|
function customInsertLink(href, target) {
|
|
var result = new Array();
|
|
|
|
alert("customInsertLink called href: " + href + " target: " + target);
|
|
|
|
result['href'] = "http://www.sourceforge.net";
|
|
result['target'] = '_blank';
|
|
|
|
return result;
|
|
}
|
|
|
|
// Custom insert image callback, extends the image function
|
|
function customInsertImage(src, alt, border, hspace, vspace, width, height, align) {
|
|
var result = new Array();
|
|
|
|
var debug = "CustomInsertImage called:\n"
|
|
debug += "src: " + src + "\n";
|
|
debug += "alt: " + alt + "\n";
|
|
debug += "border: " + border + "\n";
|
|
debug += "hspace: " + hspace + "\n";
|
|
debug += "vspace: " + vspace + "\n";
|
|
debug += "width: " + width + "\n";
|
|
debug += "height: " + height + "\n";
|
|
debug += "align: " + align + "\n";
|
|
alert(debug);
|
|
|
|
result['src'] = "logo.jpg";
|
|
result['alt'] = "test description";
|
|
result['border'] = "2";
|
|
result['hspace'] = "5";
|
|
result['vspace'] = "5";
|
|
result['width'] = width;
|
|
result['height'] = height;
|
|
result['align'] = "right";
|
|
|
|
return result;
|
|
}
|
|
|
|
// Custom save callback, gets called when the contents is to be submitted
|
|
function customSave(id, content) {
|
|
alert(id + "=" + content);
|
|
}
|
|
</script>
|
|
<!-- /tinyMCE -->
|
|
|
|
</head>
|
|
<body>
|
|
|
|
<a href="example_full.htm">[Full featured example]</a> [Advanced example] <a href="example_simple.htm">[Simple example]</a>
|
|
|
|
<h3>Advanced example</h3>
|
|
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>
|
|
<br>
|
|
|
|
<!-- Form with textare element with width: 100% -->
|
|
<form method="post" action="http://tinymce.moxiecode.com/dump.php?example=true">
|
|
<textarea name="elm1" style="width:100%" rows="15">
|
|
<span class="header1">Test header 1</span><br />
|
|
<span class="header2">Test header 2</span><br />
|
|
<span class="header3">Test header 3</span><br />
|
|
Some <b>element</b>, this is to be editor 1. <br /> This editor instance has a 100% width to it.
|
|
<p>Some paragraph. <a href="http://www.sourceforge.net">Some link</a></p>
|
|
<img src="logo.jpg">
|
|
</textarea>
|
|
<br>
|
|
<input type="button" name="save" value="save" onclick="tinyMCE.triggerSave();">
|
|
</form>
|
|
|
|
<!-- Div elements that gets to be a editor instance aswell -->
|
|
<div id="elm2" style="width:450px; height:250px">
|
|
Some <b>element</b>, this is to be editor 2. <br /> This editor instance is a DIV element instead of a textarea.
|
|
<p>Some paragraph. <a href="http://www.sourceforge.net">Some link</a></p>
|
|
<img src="logo.jpg">
|
|
</div>
|
|
|
|
<br>
|
|
|
|
Some custom actions:
|
|
<a href="javascript:tinyMCE.execCommand('Bold');">[Bold]</a> |
|
|
<a href="javascript:tinyMCE.execCommand('Italic');">[Italic]</a>
|
|
<a href="javascript:void(0);" onclick="tinyMCE.execCommand('mceInsertContent',false,'<b>Hello world!!</b>');">[Insert some HTML]</a>
|
|
<a href="javascript:void(0);" onclick="tinyMCE.execCommand('mceReplaceContent',false,'<b>{$selection}</b>');">[Replace selection]</a>
|
|
|
|
<br>
|
|
|
|
</body>
|
|
</html> |