403 lines
16 KiB
HTML
403 lines
16 KiB
HTML
<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
|
||
<html>
|
||
<head>
|
||
<title>
|
||
Overview
|
||
</title>
|
||
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
|
||
<script>
|
||
function asd() {
|
||
|
||
parent.document.title="TinyMCE_Event.class.js Overview";
|
||
|
||
}
|
||
</script>
|
||
</head>
|
||
<body bgcolor="white" onload="asd();">
|
||
|
||
<!-- ========== START OF NAVBAR ========== -->
|
||
<a name="navbar_top"><!-- --></a>
|
||
<table border="0" width="100%" cellpadding="1" cellspacing="0">
|
||
<tr>
|
||
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
|
||
<a name="navbar_top_firstrow"><!-- --></a>
|
||
<table border="0" cellpadding="0" cellspacing="3">
|
||
<tr align="center" valign="top">
|
||
|
||
|
||
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a> </td>
|
||
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> <font class="NavBarFont1Rev"><b>File</b></font> </td>
|
||
|
||
|
||
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font> </td>
|
||
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a> </td>
|
||
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a> </td>
|
||
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a> </td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
<td bgcolor="#EEEEFF" align="right" valign="top">
|
||
<em>
|
||
<b></b></em>
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
||
PREV
|
||
NEXT</font></td>
|
||
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
||
<a href="index.html" target="_top"><b>FRAMES</b></a>
|
||
<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
|
||
|
||
<script>
|
||
<!--
|
||
if(window==top) {
|
||
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
|
||
}
|
||
//-->
|
||
</script>
|
||
<noscript>
|
||
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
|
||
</noscript>
|
||
</font></td>
|
||
</tr>
|
||
</table>
|
||
<!-- =========== END OF NAVBAR =========== -->
|
||
|
||
<hr>
|
||
<center>
|
||
|
||
<h2>TinyMCE_Event.class.js</h2>
|
||
|
||
</center>
|
||
|
||
|
||
|
||
|
||
<h4>Summary</h4>
|
||
<p>
|
||
|
||
No overview generated for 'TinyMCE_Event.class.js'<BR/><BR/>
|
||
|
||
</p>
|
||
|
||
<hr>
|
||
|
||
|
||
|
||
<!-- ========== METHOD SUMMARY =========== -->
|
||
|
||
<!-- ========== END METHOD SUMMARY =========== -->
|
||
|
||
|
||
<pre class="sourceview"><span class="comment">/**
|
||
* $RCSfile: overview-summary-TinyMCE_Event.class.js.html,v $
|
||
* $Revision: 1.42 $
|
||
* $Date: 2006/04/14 20:00:30 $
|
||
*
|
||
* <span class="attrib">@author</span> Moxiecode
|
||
* <span class="attrib">@copyright</span> Copyright <20> 2004-2006, Moxiecode Systems AB, All rights reserved.
|
||
*
|
||
* The contents of this file will be wrapped in a class later on.
|
||
*/</span>
|
||
|
||
<span class="comment">/**
|
||
* Sets the enabled/disabled state of build in events on the specific node.
|
||
* This function is needed since some events gets executed in WYSIWYG mode.
|
||
*
|
||
* <span class="attrib">@param</span> {HTMLNode} node HTML node to enable/disable events on.
|
||
* <span class="attrib">@param</span> {boolean} state true/false state if the events should be disabled or enabled.
|
||
* <span class="attrib">@private</span>
|
||
*/</span>
|
||
TinyMCE_Engine.<span class="reserved">prototype</span>._setEventsEnabled = <span class="reserved">function</span>(node, state) {
|
||
var events = new Array(<span class="literal">'onfocus'</span>,<span class="literal">'onblur'</span>,<span class="literal">'onclick'</span>,<span class="literal">'ondblclick'</span>,
|
||
<span class="literal">'onmousedown'</span>,<span class="literal">'onmouseup'</span>,<span class="literal">'onmouseover'</span>,<span class="literal">'onmousemove'</span>,
|
||
<span class="literal">'onmouseout'</span>,<span class="literal">'onkeypress'</span>,<span class="literal">'onkeydown'</span>,<span class="literal">'onkeydown'</span>,<span class="literal">'onkeyup'</span>);
|
||
|
||
var evs = tinyMCE.settings[<span class="literal">'event_elements'</span>].split(<span class="literal">','</span>);
|
||
<span class="reserved">for</span> (var y=0; y<evs.length; y++){
|
||
var elms = node.getElementsByTagName(evs[y]);
|
||
<span class="reserved">for</span> (var i=0; i<elms.length; i++) {
|
||
var event = <span class="literal">""</span>;
|
||
|
||
<span class="reserved">for</span> (var x=0; x<events.length; x++) {
|
||
<span class="reserved">if</span> ((event = tinyMCE.getAttrib(elms[i], events[x])) != <span class="literal">''</span>) {
|
||
event = tinyMCE.cleanupEventStr(<span class="literal">""</span> + event);
|
||
|
||
<span class="reserved">if</span> (!state)
|
||
event = <span class="literal">"return true;"</span> + event;
|
||
<span class="reserved">else</span>
|
||
event = event.replace(/^<span class="reserved">return</span> true;/gi, <span class="literal">''</span>);
|
||
|
||
elms[i].removeAttribute(events[x]);
|
||
elms[i].setAttribute(events[x], event);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
};
|
||
|
||
<span class="comment">/**
|
||
* Patch function for MSIE specific events, this one simply grabs the window.event object and
|
||
* passes it as a argument to the handleEvent function of the TinyMCE_Engine class.
|
||
*
|
||
* <span class="attrib">@param</span> {string} editor_id Editor id to patch.
|
||
* <span class="attrib">@private</span>
|
||
*/</span>
|
||
TinyMCE_Engine.<span class="reserved">prototype</span>._eventPatch = <span class="reserved">function</span>(editor_id) {
|
||
var n, inst, win, e;
|
||
|
||
<span class="comment">// Remove odd, error</span>
|
||
<span class="reserved">if</span> (typeof(tinyMCE) == <span class="literal">"undefined"</span>)
|
||
<span class="reserved">return</span> true;
|
||
|
||
try {
|
||
<span class="comment">// Try selected instance first</span>
|
||
<span class="reserved">if</span> (tinyMCE.selectedInstance) {
|
||
win = tinyMCE.selectedInstance.getWin();
|
||
|
||
<span class="reserved">if</span> (win && win.event) {
|
||
e = win.event;
|
||
|
||
<span class="reserved">if</span> (!e.target)
|
||
e.target = e.srcElement;
|
||
|
||
TinyMCE_Engine.<span class="reserved">prototype</span>.handleEvent(e);
|
||
<span class="reserved">return</span>;
|
||
}
|
||
}
|
||
|
||
<span class="comment">// Search for it</span>
|
||
<span class="reserved">for</span> (n in tinyMCE.instances) {
|
||
inst = tinyMCE.instances[n];
|
||
|
||
<span class="reserved">if</span> (!tinyMCE.isInstance(inst))
|
||
continue;
|
||
|
||
tinyMCE.selectedInstance = inst;
|
||
win = inst.getWin();
|
||
|
||
<span class="reserved">if</span> (win && win.event) {
|
||
e = win.event;
|
||
|
||
<span class="reserved">if</span> (!e.target)
|
||
e.target = e.srcElement;
|
||
|
||
TinyMCE_Engine.<span class="reserved">prototype</span>.handleEvent(e);
|
||
<span class="reserved">return</span>;
|
||
}
|
||
}
|
||
} catch (ex) {
|
||
<span class="comment">// Ignore error if iframe is pointing to external URL</span>
|
||
}
|
||
};
|
||
|
||
<span class="comment">/**
|
||
* Unload document event handler function. This function will be executed when the
|
||
* page is unloaded, this will automaticly move the current editor contents to the textarea element this enables
|
||
* the editor to restore it's state when the user presses the back button in the browser.
|
||
* This will execute the triggerSave function.
|
||
*/</span>
|
||
TinyMCE_Engine.<span class="reserved">prototype</span>.unloadHandler = <span class="reserved">function</span>() {
|
||
tinyMCE.triggerSave(true, true);
|
||
};
|
||
|
||
<span class="comment">/**
|
||
* Adds the handleEvent function to the specified editor instance.
|
||
*
|
||
* <span class="attrib">@param</span> {inst} inst Editor control instance to add event handler to.
|
||
*/</span>
|
||
TinyMCE_Engine.<span class="reserved">prototype</span>.addEventHandlers = <span class="reserved">function</span>(inst) {
|
||
var doc = inst.getDoc();
|
||
|
||
inst.switchSettings();
|
||
|
||
<span class="reserved">if</span> (tinyMCE.isMSIE) {
|
||
tinyMCE.addEvent(doc, <span class="literal">"keypress"</span>, TinyMCE_Engine.<span class="reserved">prototype</span>._eventPatch);
|
||
tinyMCE.addEvent(doc, <span class="literal">"keyup"</span>, TinyMCE_Engine.<span class="reserved">prototype</span>._eventPatch);
|
||
tinyMCE.addEvent(doc, <span class="literal">"keydown"</span>, TinyMCE_Engine.<span class="reserved">prototype</span>._eventPatch);
|
||
tinyMCE.addEvent(doc, <span class="literal">"mouseup"</span>, TinyMCE_Engine.<span class="reserved">prototype</span>._eventPatch);
|
||
tinyMCE.addEvent(doc, <span class="literal">"click"</span>, TinyMCE_Engine.<span class="reserved">prototype</span>._eventPatch);
|
||
} <span class="reserved">else</span> {
|
||
tinyMCE.addEvent(doc, <span class="literal">"keypress"</span>, tinyMCE.handleEvent);
|
||
tinyMCE.addEvent(doc, <span class="literal">"keydown"</span>, tinyMCE.handleEvent);
|
||
tinyMCE.addEvent(doc, <span class="literal">"keyup"</span>, tinyMCE.handleEvent);
|
||
tinyMCE.addEvent(doc, <span class="literal">"click"</span>, tinyMCE.handleEvent);
|
||
tinyMCE.addEvent(doc, <span class="literal">"mouseup"</span>, tinyMCE.handleEvent);
|
||
tinyMCE.addEvent(doc, <span class="literal">"mousedown"</span>, tinyMCE.handleEvent);
|
||
tinyMCE.addEvent(doc, <span class="literal">"focus"</span>, tinyMCE.handleEvent);
|
||
tinyMCE.addEvent(doc, <span class="literal">"blur"</span>, tinyMCE.handleEvent);
|
||
|
||
eval(<span class="literal">'try { doc.designMode = "On"; } catch(e) {}'</span>); <span class="comment">// Force designmode</span>
|
||
}
|
||
};
|
||
|
||
<span class="comment">/**
|
||
* Mouse move handler function, this will be executed each time
|
||
* the mouse is moved within a editor instance. This function stores away the current selection in MSIE
|
||
* this will then be used when a undo/redo level is added.
|
||
*/</span>
|
||
TinyMCE_Engine.<span class="reserved">prototype</span>.onMouseMove = <span class="reserved">function</span>() {
|
||
var inst;
|
||
|
||
<span class="reserved">if</span> (!tinyMCE.hasMouseMoved) {
|
||
inst = tinyMCE.selectedInstance;
|
||
|
||
<span class="comment">// Workaround for bug #1437457 (Odd MSIE bug)</span>
|
||
<span class="reserved">if</span> (inst.isFocused) {
|
||
inst.undoBookmark = inst.selection.getBookmark();
|
||
tinyMCE.hasMouseMoved = true;
|
||
}
|
||
}
|
||
|
||
<span class="comment">// tinyMCE.cancelEvent(inst.getWin().event);</span>
|
||
<span class="comment">// return false;</span>
|
||
};
|
||
|
||
<span class="comment">/**
|
||
* Cancels the specified event, this will disable the event from be passed to other listeners in event chain.
|
||
*
|
||
* <span class="attrib">@param</span> {DOMEvent} e Event to cancel.
|
||
*/</span>
|
||
TinyMCE_Engine.<span class="reserved">prototype</span>.cancelEvent = <span class="reserved">function</span>(e) {
|
||
<span class="reserved">if</span> (tinyMCE.isMSIE) {
|
||
e.returnValue = false;
|
||
e.cancelBubble = true;
|
||
} <span class="reserved">else</span>
|
||
e.preventDefault();
|
||
};
|
||
|
||
<span class="comment">/**
|
||
* Adds a event handler function to the specified object.
|
||
*
|
||
* <span class="attrib">@param</span> {HTMLElement} o Object to add event handler to.
|
||
* <span class="attrib">@param</span> {string} n Event name to listen to for example "click".
|
||
* <span class="attrib">@param</span> {function} h Function handler to execute when event occurs.
|
||
*/</span>
|
||
TinyMCE_Engine.<span class="reserved">prototype</span>.addEvent = <span class="reserved">function</span>(o, n, h) {
|
||
<span class="reserved">if</span> (o.attachEvent)
|
||
o.attachEvent(<span class="literal">"on"</span> + n, h);
|
||
<span class="reserved">else</span>
|
||
o.addEventListener(n, h, false);
|
||
};
|
||
|
||
<span class="comment">/**
|
||
* Adds accessibility keydown handler to the specified select element.
|
||
*
|
||
* <span class="attrib">@param</span> {DOMEvent} e Event that gets passed when the element is focused.
|
||
* <span class="attrib">@param</span> {HTMLElement} s Select element that the keydown handler gets added to.
|
||
* <span class="attrib">@param</span> {DOMWindow} w DOM window reference to add.
|
||
*/</span>
|
||
TinyMCE_Engine.<span class="reserved">prototype</span>.addSelectAccessibility = <span class="reserved">function</span>(e, s, w) {
|
||
<span class="comment">// Add event handlers </span>
|
||
<span class="reserved">if</span> (!s._isAccessible) {
|
||
s.onkeydown = tinyMCE.accessibleEventHandler;
|
||
s.onblur = tinyMCE.accessibleEventHandler;
|
||
s._isAccessible = true;
|
||
s._win = w;
|
||
}
|
||
|
||
<span class="reserved">return</span> false;
|
||
};
|
||
|
||
<span class="comment">/**
|
||
* Accessibility handler that gets executed when the user hits a key in a select element.
|
||
* This handler trams the enter/return or space key and then executes the onchange event handler.
|
||
*
|
||
* <span class="attrib">@param</span> {DOMEvent} e DOM event object instance.
|
||
*/</span>
|
||
TinyMCE_Engine.<span class="reserved">prototype</span>.accessibleEventHandler = <span class="reserved">function</span>(e) {
|
||
var win = <span class="reserved">this</span>._win;
|
||
e = tinyMCE.isMSIE ? win.event : e;
|
||
var elm = tinyMCE.isMSIE ? e.srcElement : e.target;
|
||
|
||
<span class="comment">// Unpiggyback onchange on blur</span>
|
||
<span class="reserved">if</span> (e.type == <span class="literal">"blur"</span>) {
|
||
<span class="reserved">if</span> (elm.oldonchange) {
|
||
elm.onchange = elm.oldonchange;
|
||
elm.oldonchange = null;
|
||
}
|
||
|
||
<span class="reserved">return</span> true;
|
||
}
|
||
|
||
<span class="comment">// Piggyback onchange</span>
|
||
<span class="reserved">if</span> (elm.nodeName == <span class="literal">"SELECT"</span> && !elm.oldonchange) {
|
||
elm.oldonchange = elm.onchange;
|
||
elm.onchange = null;
|
||
}
|
||
|
||
<span class="comment">// Execute onchange and remove piggyback</span>
|
||
<span class="reserved">if</span> (e.keyCode == 13 || e.keyCode == 32) {
|
||
elm.onchange = elm.oldonchange;
|
||
elm.onchange();
|
||
elm.oldonchange = null;
|
||
|
||
tinyMCE.cancelEvent(e);
|
||
<span class="reserved">return</span> false;
|
||
}
|
||
|
||
<span class="reserved">return</span> true;
|
||
};
|
||
</pre>
|
||
<hr>
|
||
|
||
|
||
|
||
<!-- ========== START OF NAVBAR ========== -->
|
||
<a name="navbar_top"><!-- --></a>
|
||
<table border="0" width="100%" cellpadding="1" cellspacing="0">
|
||
<tr>
|
||
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
|
||
<a name="navbar_top_firstrow"><!-- --></a>
|
||
<table border="0" cellpadding="0" cellspacing="3">
|
||
<tr align="center" valign="top">
|
||
|
||
|
||
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a> </td>
|
||
<td bgcolor="#FFFFFF" class="NavBarCell1Rev"> <font class="NavBarFont1Rev"><b>File</b></font> </td>
|
||
|
||
|
||
<td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font> </td>
|
||
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a> </td>
|
||
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a> </td>
|
||
<td bgcolor="#EEEEFF" class="NavBarCell1"> <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a> </td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
|
||
<b></b></em>
|
||
</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
||
PREV
|
||
NEXT</font></td>
|
||
<td bgcolor="white" class="NavBarCell2"><font size="-2">
|
||
<a href="index.html" target="_top"><b>FRAMES</b></a>
|
||
<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
|
||
|
||
<script>
|
||
<!--
|
||
if(window==top) {
|
||
document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
|
||
}
|
||
//-->
|
||
</script>
|
||
<noscript>
|
||
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
|
||
</noscript>
|
||
</font></td>
|
||
</tr>
|
||
</table>
|
||
<!-- =========== END OF NAVBAR =========== -->
|
||
|
||
<hr>
|
||
<font size="-1">
|
||
|
||
</font>
|
||
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Fri Apr 14 21:59:23 2006</div>
|
||
</body>
|
||
</html>
|