mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-11 09:11:05 +01:00
592 lines
14 KiB
HTML
592 lines
14 KiB
HTML
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
<html>
|
||
|
<head>
|
||
|
<title>Javascript Functions</title>
|
||
|
<link href="css/screen.css" rel="stylesheet" type="text/css" />
|
||
|
</head>
|
||
|
<body>
|
||
|
|
||
|
<div class="header">
|
||
|
<h1>Javascript Functions</h1>
|
||
|
</div>
|
||
|
|
||
|
<div class="content">
|
||
|
<p>This is for advanced users, TinyMCE has a global instance with some public functions that can be called from the page.</p>
|
||
|
<h3>tinyMCE.triggerSave([skip_cleanup], [skip_callback]);</h3>
|
||
|
<p>
|
||
|
Makes a cleanup and moves the contents from the editor to the form field. This method is automaticly called by tinyMCE by adding a trigger on the forms submit method.
|
||
|
</p>
|
||
|
<p>
|
||
|
<table border="1" cellspacing="0" cellpadding="4">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<td colspan="2">Parameters</td>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>[skip_cleanup]</td>
|
||
|
<td>Disables the cleanup process of trigger save. Defaults to false. (Optional)</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>[skip_callback]</td>
|
||
|
<td>Disables the execution of the <a href="option_save_callback.html">save_callback</a> function. Defaults to false. (Optional)</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
|
||
|
skip_callback
|
||
|
</p>
|
||
|
<p>
|
||
|
Returns: Nothing
|
||
|
</p>
|
||
|
<div class="separator"></div>
|
||
|
<h3>tinyMCE.updateContent(form_element_name);</h3>
|
||
|
<p>
|
||
|
Moves the contents from the form element to the editor, this does the opposite of triggerSave(). This method can be used when you want to change the contents of the editor dynamicly.
|
||
|
</p>
|
||
|
<p>
|
||
|
<table border="1" cellspacing="0" cellpadding="4">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<td colspan="2">Parameters</td>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>form_element_name</td>
|
||
|
<td>The name of the form element to get contents from.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</p>
|
||
|
<p>
|
||
|
Returns: Nothing
|
||
|
</p>
|
||
|
<div class="separator"></div>
|
||
|
<h3>tinyMCE.execInstanceCommand(editor_id, command, [user_interface], [value]);</h3>
|
||
|
<p>
|
||
|
This method executes a command by name on the editor instance specified by the editor_id parameter.
|
||
|
</p>
|
||
|
<p>
|
||
|
<table border="1" cellspacing="0" cellpadding="4">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<td colspan="2">Parameters</td>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>editor_id</td>
|
||
|
<td>ID of editor instance or element id/name of the replaced element.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>command</td>
|
||
|
<td>Command to execute check the execCommand function for details.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>[user_interface]</td>
|
||
|
<td>Is a user interface to be used or not.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>[value]</td>
|
||
|
<td>Value to pass with command for example a URL..</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</p>
|
||
|
<p>
|
||
|
Returns: Nothing
|
||
|
</p>
|
||
|
<div class="separator"></div>
|
||
|
<h3>tinyMCE.execCommand(command, [user_interface], [value]);</h3>
|
||
|
<p>
|
||
|
This method executes a command by name on the selected editor instance.
|
||
|
</p>
|
||
|
<p>
|
||
|
<table border="1" cellspacing="0" cellpadding="4">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<td colspan="2">Parameters</td>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>command</td>
|
||
|
<td>Command to execute for example "Bold" or "Italic". These are defined by Mozilla <a href="http://www.mozilla.org/editor/midas-spec.html">Midas specification</a> or <a href="http://msdn.microsoft.com/workshop/author/dhtml/reference/commandids.asp">Microsoft specification</a>. But there are a some TinyMCE specific commands many other commands are available within plugins and themes.<br /><br />
|
||
|
<table border="0" cellspacing="0" cellpadding="2">
|
||
|
<tr>
|
||
|
<td>mceLink</td>
|
||
|
<td>Opens the insert link dialog and inserts a link.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>mceImage</td>
|
||
|
<td>Opens the insert image dialog and inserts a image.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>mceCleanup</td>
|
||
|
<td>Removed unwanted elements and attributes from the HTML code.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>mceHelp</td>
|
||
|
<td>Opens the manual pages.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>mceAddControl</td>
|
||
|
<td>Adds a editor control to the element id/name specified as value.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>mceRemoveControl</td>
|
||
|
<td>Removes a specific control by editor_id name. The value is the editor_id to remove, editor ids are in the following format: "mce_editor_<index>". DOM element ids and form element names can allso be used.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>mceFocus</td>
|
||
|
<td>Focuses the editor by the id placed in value. Editor id's are in the format "mce_editor_<index>". DOM element ids and form element names can allso be used.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>mceSetCSSClass</td>
|
||
|
<td>Sets the CSS class attribute or creates a new span of the selection. The value is the css class name to assign to selected element or new span element.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>mceInsertContent</td>
|
||
|
<td>Inserts contents of value parameter to current cursor position.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>mceReplaceContent</td>
|
||
|
<td>Replaces the current selection with the HTML code in value. The {$selection} variable gets replaced with the currently selected text contents.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>mceSetAttribute</td>
|
||
|
<td>Sets a attribute of the currenly selected element. The value of this command should be a name/value array with the following parameters.<br /><br />
|
||
|
name - Attribute name to set.<br />
|
||
|
value - Attrbute value to set.<br />
|
||
|
[targets] - Target elements to add attribute on. Default: p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address.<br /><br />
|
||
|
Example of usage:<br />
|
||
|
tinyMCE.execCommand('mceSetAttribute',false,{name:'align',value:'right'});<br />
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>mceToggleVisualAid</td>
|
||
|
<td>Toggles visual aid/guidelines mode on/off.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>mceAnchor</td>
|
||
|
<td>Inserts a named anchor element, the value is the name of the anchor.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>mceResetDesignMode</td>
|
||
|
<td>Resets the designMode state of all editor instances, this command is useful on Firefox if the editor is placed in tabs or shown/hidden with style.display="none/block". Call this command after the editor displayed again.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>mceSelectNode</td>
|
||
|
<td>Selects the node/element passed as value. This command will also scroll to the elements location within the editor.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>mceSelectNodeDepth</td>
|
||
|
<td>Selects the node/element by depth relative from the current node. So a value of 0 will select the currently focused node. This command will also scroll to the elements location within the editor.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td></td>
|
||
|
<td></td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>[user_interface]</td>
|
||
|
<td>Tells if the command is to display a user interface or not. True/False option.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>[value]</td>
|
||
|
<td>Value to pass for the command for example to insertLink it's the URL of the link.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
|
||
|
</p>
|
||
|
<p>
|
||
|
Returns: Nothing
|
||
|
</p>
|
||
|
<p>
|
||
|
Example:
|
||
|
</p>
|
||
|
<p>
|
||
|
<div class="example">
|
||
|
<pre>
|
||
|
<a href="javascript:tinymce.execCommand('Bold');">[Do bold]</a>
|
||
|
</pre>
|
||
|
</div>
|
||
|
</p>
|
||
|
<div class="separator"></div>
|
||
|
<h3>tinyMCE.insertLink(href, target);</h3>
|
||
|
|
||
|
<p>This method inserts a link a the cursor position of the selected editor instance or updates the selected link with new data. This method should be called upon "ok" in the insertLink popup when you create custom themes.
|
||
|
</p>
|
||
|
<table border="1" cellspacing="0" cellpadding="4">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<td colspan="2">Parameters</td>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>href</td>
|
||
|
<td>HREF/URL of the link.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>target</td>
|
||
|
<td>Target of the link.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<p>
|
||
|
Returns: Nothing
|
||
|
</p>
|
||
|
<div class="separator"></div>
|
||
|
<h3>tinyMCE.insertImage(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout);</h4>
|
||
|
<p>
|
||
|
This method inserts a image a the cursor position of the selected editor instance or updates the selected image with new data. This method should be called upon "ok" in the insertImage popup when you create custom themes.
|
||
|
</p>
|
||
|
<table border="1" cellspacing="0" cellpadding="4">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<td colspan="2">Parameters</td>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>src</td>
|
||
|
<td>Image src url.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>alt</td>
|
||
|
<td>Alternative text of img element.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>border</td>
|
||
|
<td>Border of image element.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>hspace</td>
|
||
|
<td>Horizontal spacing of image element.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>vspace</td>
|
||
|
<td>Vertical spacing of image element.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>width</td>
|
||
|
<td>Width of image element.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>height</td>
|
||
|
<td>Height of image element.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>align</td>
|
||
|
<td>Alignment of image element.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>title</td>
|
||
|
<td>Link title of image element.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>onmouseover</td>
|
||
|
<td>On mouse over event handler of image element.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>onmouseout</td>
|
||
|
<td>On mouse out event handler of image element.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
<p>
|
||
|
Returns: Nothing
|
||
|
</p>
|
||
|
<div class="separator"></div>
|
||
|
<h3>tinyMCE.triggerNodeChange();</h3>
|
||
|
<p>This method is to be called when external changes is made to the editor. This method will then call the "handleNodeChangeCallback" callback in the theme.
|
||
|
</p>
|
||
|
<p>
|
||
|
Parameters:
|
||
|
</p>
|
||
|
<p>
|
||
|
None
|
||
|
</p>
|
||
|
<p>
|
||
|
Returns: Nothing
|
||
|
</p>
|
||
|
<div class="separator"></div>
|
||
|
<h3>tinyMCE.getContent();</h3>
|
||
|
<p>
|
||
|
This method returns the HTML contents of the currently selected editor or null if no editor was selected.
|
||
|
</p>
|
||
|
<p>
|
||
|
Parameters:
|
||
|
</p>
|
||
|
<p>
|
||
|
None
|
||
|
</p>
|
||
|
<p>
|
||
|
Returns: HTML contents of the currently selected editor or null.
|
||
|
</p>
|
||
|
<div class="separator"></div>
|
||
|
<h3>Syntax: tinyMCE.setContent(html);</h3>
|
||
|
|
||
|
<p>This method sets the HTML contents of the currently selected editor.</p>
|
||
|
|
||
|
<p>
|
||
|
<table border="1" cellspacing="0" cellpadding="4">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<td colspan="2">Parameters</td>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>html</td>
|
||
|
<td>HTML Source code to set.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</p>
|
||
|
<p>
|
||
|
Returns: None.
|
||
|
</p>
|
||
|
<div class="separator"></div>
|
||
|
<h3>tinyMCE.getInstanceById(editor_id);</h3>
|
||
|
<p>
|
||
|
This method returns a editor instance by editor id.
|
||
|
</p>
|
||
|
<p>
|
||
|
<table border="1" cellspacing="0" cellpadding="4">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<td colspan="2">Parameters</td>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>editor_id</td>
|
||
|
<td>Editor instance to retrive.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</p>
|
||
|
<p>
|
||
|
Returns: TinyMCE Editor instance (TinyMCEControl).
|
||
|
</p>
|
||
|
<div class="separator"></div>
|
||
|
<h3>tinyMCE.importThemeLanguagePack([theme]);</h3>
|
||
|
<p>
|
||
|
This method imports/loads theme specific language packs. This may be called from custom themes.
|
||
|
</p>
|
||
|
<p>
|
||
|
<table border="1" cellspacing="0" cellpadding="4">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<td colspan="2">Parameters</td>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>[theme]</td>
|
||
|
<td>Name of the current theme. This is a optional parameter it defaults to the global "theme" setting. This parameter is useful within theme plugins.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</p>
|
||
|
<p>
|
||
|
Returns: None.
|
||
|
</p>
|
||
|
<div class="separator"></div>
|
||
|
<h3>tinyMCE.importPluginLanguagePack(plugin, valid_languages);</h3>
|
||
|
<p>
|
||
|
This method imports/loads plugin specific language packs. This may be called from custom plugins.
|
||
|
</p>
|
||
|
<p>
|
||
|
<table border="1" cellspacing="0" cellpadding="4">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<td colspan="2">Parameters</td>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>plugin</td>
|
||
|
<td>Name of the current plugin.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>valid_languages</td>
|
||
|
<td>Comma separated list of supported languagepacks.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</p>
|
||
|
<p>
|
||
|
Returns: None.
|
||
|
</p>
|
||
|
<div class="separator"></div>
|
||
|
<h3>tinyMCE.applyTemplate(html);</h3>
|
||
|
<p>
|
||
|
This method replaces settings and lang variables in the theme.
|
||
|
</p>
|
||
|
<p>
|
||
|
<table border="1" cellspacing="0" cellpadding="4">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<td colspan="2">Parameters</td>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>html</td>
|
||
|
<td>HTML code to apply theme variable substitution on.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</p>
|
||
|
<p>
|
||
|
Returns: New converted, HTML code.
|
||
|
</p>
|
||
|
<div class="separator"></div>
|
||
|
<h3>tinyMCE.openWindow(template, [args]);</h3>
|
||
|
<p>This method opens a new window by the template data assigned, it will get the width, height and html data from template parameters. The args array contains variable names to be substituted.</p>
|
||
|
<p>
|
||
|
There are some custom window arguments:
|
||
|
</p>
|
||
|
<p>
|
||
|
<table border="1" cellspacing="0" cellpadding="4">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<td colspan="2">Parameters</td>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>mce_replacevariables</td>
|
||
|
<td>Enables/Disables the language/variable replacement of the document HTML. Enabled by default.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>mce_windowresize</td>
|
||
|
<td>Enables/Disables the auto resize feature of popupwindows. Enabled by default.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</p>
|
||
|
|
||
|
<p>
|
||
|
<table border="1" cellspacing="0" cellpadding="4">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<td colspan="2">Parameters</td>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>template</td>
|
||
|
<td>Name/Value array with width, height, html and file keys in it.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>[args]</td>
|
||
|
<td>Name/Value array with variable names to replace. Variables in the template file key value (URL) gets replaced with the argument list.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</p>
|
||
|
<p>
|
||
|
Returns: None.
|
||
|
</p>
|
||
|
<div class="separator"></div>
|
||
|
<h3>tinyMCE.getWindowArg(name, [default_value]);</h3>
|
||
|
<p>
|
||
|
This method returns a window argument defined by name. This function is to be used in theme popup windows to retrive dialog parameters.
|
||
|
</p>
|
||
|
<p>
|
||
|
<table border="1" cellspacing="0" cellpadding="4">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<td colspan="2">Parameters</td>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>name</td>
|
||
|
<td>Name of window argument to get.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>[default_value]</td>
|
||
|
<td>Default value to be returned if window argument is missing.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</p>
|
||
|
<p>
|
||
|
Returns: Window argument value.
|
||
|
</p>
|
||
|
<div class="separator"></div>
|
||
|
<h3>tinyMCE.setWindowArg(name, value);</h3>
|
||
|
<p>This method sets a window argument by name. This can for example be useful if plugin are to call other plugins.</p>
|
||
|
<p>
|
||
|
<table border="1" cellspacing="0" cellpadding="4">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<td colspan="2">Parameters</td>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>name</td>
|
||
|
<td>Name of window argument to set.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>value</td>
|
||
|
<td>Value to set in window argument.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</p>
|
||
|
<p>
|
||
|
Returns: Window argument value.
|
||
|
</p>
|
||
|
<div class="separator"></div>
|
||
|
<h3>tinyMCE.getParam(name, [default_value], [strip_whitespace]);</h3>
|
||
|
<p>This method returns a TinyMCE configuration parameter.</p>
|
||
|
<p>
|
||
|
<table border="1" cellspacing="0" cellpadding="4">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<td colspan="2">Parameters:</td>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<tr>
|
||
|
<td>name</td>
|
||
|
<td>Name of window argument to get.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>[default_value]</td>
|
||
|
<td>Default value to be returned if window argument is missing.</td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>[strip_whitespace]</td>
|
||
|
<td>If true all whitespace will be removed from return value, default: false.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</p>
|
||
|
<p>
|
||
|
Returns: TinyMCE configuration parameter.
|
||
|
</p>
|
||
|
</div>
|
||
|
|
||
|
<div class="footer">
|
||
|
<div class="helpindexlink"><a href="index.html">Index</a></div>
|
||
|
<div class="copyright">Copyright © 2005 Moxiecode Systems AB</div>
|
||
|
<br style="clear: both" />
|
||
|
</div>
|
||
|
|
||
|
</body>
|
||
|
</html>
|